Whamcloud - gitweb
Land b_smallfix onto HEAD (20040423_1603)
authoradilger <adilger>
Fri, 23 Apr 2004 23:12:23 +0000 (23:12 +0000)
committeradilger <adilger>
Fri, 23 Apr 2004 23:12:23 +0000 (23:12 +0000)
b=3043, b=3258, b=3219, b=2410

69 files changed:
ldiskfs/kernel_patches/series/ldiskfs-2.6-suse.series
lnet/include/linux/kp30.h
lnet/include/linux/libcfs.h
lnet/include/linux/portals_compat25.h
lnet/include/lnet/lnetctl.h
lnet/include/lnet/ptlctl.h
lnet/libcfs/debug.c
lnet/libcfs/proc.c
lnet/utils/debug.c
lnet/utils/l_ioctl.c
lnet/utils/portals.c
lnet/utils/wirecheck.c
lustre/ChangeLog
lustre/include/linux/lustre_net.h
lustre/include/linux/obd_class.h
lustre/kernel_patches/patches/ext3-htree-2.4.19-pre1.patch
lustre/kernel_patches/patches/ext3-htree-2.4.21-chaos.patch
lustre/kernel_patches/patches/ext3-htree-2.4.22-rh.patch
lustre/kernel_patches/patches/ext3-htree-suse.patch
lustre/kernel_patches/patches/ext3-htree.patch
lustre/kernel_patches/patches/htree-ext3-2.4.18.patch
lustre/kernel_patches/series/ldiskfs-2.6-suse.series
lustre/ldlm/ldlm_lib.c
lustre/ldlm/ldlm_lockd.c
lustre/liblustre/llite_lib.c
lustre/liblustre/tests/echo_test.c
lustre/llite/.cvsignore
lustre/llite/llite_lib.c
lustre/lov/lov_obd.c
lustre/mdc/mdc_request.c
lustre/mds/handler.c
lustre/mds/mds_reint.c
lustre/mds/mds_unlink_open.c
lustre/obdclass/obd_config.c
lustre/obdclass/sysctl.c
lustre/obdecho/.cvsignore
lustre/obdfilter/filter_io.c
lustre/ost/ost_handler.c
lustre/portals/include/linux/kp30.h
lustre/portals/include/linux/libcfs.h
lustre/portals/include/linux/portals_compat25.h
lustre/portals/include/portals/ptlctl.h
lustre/portals/libcfs/debug.c
lustre/portals/libcfs/proc.c
lustre/portals/utils/debug.c
lustre/portals/utils/l_ioctl.c
lustre/portals/utils/portals.c
lustre/portals/utils/wirecheck.c
lustre/ptlrpc/client.c
lustre/ptlrpc/events.c
lustre/ptlrpc/niobuf.c
lustre/ptlrpc/pinger.c
lustre/ptlrpc/recov_thread.c
lustre/ptlrpc/service.c
lustre/tests/.cvsignore
lustre/tests/Makefile.am
lustre/tests/acceptance-small.sh
lustre/tests/mount2.sh [deleted file]
lustre/tests/mount2lov.sh [deleted file]
lustre/tests/multiop.c
lustre/tests/openfilleddirunlink.c [new file with mode: 0644]
lustre/tests/recovery-small.sh
lustre/tests/replay-single.sh
lustre/tests/sanity.sh
lustre/tests/stat.c
lustre/tests/stat_fs.h
lustre/tests/test-framework.sh
lustre/utils/llmount.c
lustre/utils/wirecheck.c

index 65e8dcd..cff99dd 100644 (file)
@@ -1,4 +1,3 @@
-header-guards-2.6-suse.patch
 ext3-wantedi-2.6-suse.patch
 ext3-san-jdike-2.6-suse.patch
 iopen-2.6-suse.patch 
 ext3-wantedi-2.6-suse.patch
 ext3-san-jdike-2.6-suse.patch
 iopen-2.6-suse.patch 
@@ -8,4 +7,3 @@ ext3-init-generation-2.6-suse.patch
 ext3-ea-in-inode-2.6-suse.patch
 export-ext3-2.6-suse.patch
 ext3-include-fixes-2.6-suse.patch
 ext3-ea-in-inode-2.6-suse.patch
 export-ext3-2.6-suse.patch
 ext3-include-fixes-2.6-suse.patch
-ext3-xattr-header-move-2.6.suse.patch
index 4ca4047..0aa183e 100644 (file)
@@ -8,7 +8,7 @@
 #define PORTAL_DEBUG
 
 #ifndef offsetof
 #define PORTAL_DEBUG
 
 #ifndef offsetof
-# define offsetof(typ,memb)     ((int)((char *)&(((typ *)0)->memb)))
+# define offsetof(typ,memb)     ((unsigned long)((char *)&(((typ *)0)->memb)))
 #endif
 
 #define LOWEST_BIT_SET(x)       ((x) & ~((x) - 1))
 #endif
 
 #define LOWEST_BIT_SET(x)       ((x) & ~((x) - 1))
@@ -647,7 +647,7 @@ enum {
         NAL_ENUM_END_MARKER
 };
 
         NAL_ENUM_END_MARKER
 };
 
-#define PTL_NALFMT_SIZE         16
+#define PTL_NALFMT_SIZE               26 /* %u:%u.%u.%u.%u (10+4+4+4+3+1) */
 
 #define NAL_MAX_NR (NAL_ENUM_END_MARKER - 1)
 
 
 #define NAL_MAX_NR (NAL_ENUM_END_MARKER - 1)
 
index 99d3877..5b1b8a5 100644 (file)
@@ -6,6 +6,8 @@
 
 #define PORTAL_DEBUG
 
 
 #define PORTAL_DEBUG
 
+/* I think this beast is just trying to get cycles_t and get_cycles().
+ * this should be in its own header. */
 #ifdef __linux__
 # include <asm/types.h>
 # if defined(__powerpc__) && !defined(__KERNEL__)
 #ifdef __linux__
 # include <asm/types.h>
 # if defined(__powerpc__) && !defined(__KERNEL__)
 #  include <asm/timex.h>
 #  undef __KERNEL__
 # else
 #  include <asm/timex.h>
 #  undef __KERNEL__
 # else
-#  include <asm/timex.h>
+#  if defined(__KERNEL__)
+#   include <asm/timex.h>
+#  else
+#   include <sys/time.h>
+#   define cycles_t unsigned long
+static inline cycles_t get_cycles(void) 
+{
+        struct timeval tv;
+        gettimeofday(&tv, NULL);
+        return (tv.tv_sec * 100000) + tv.tv_usec;
+}
+#  endif
 # endif
 #else
 # include <sys/types.h>
 # endif
 #else
 # include <sys/types.h>
@@ -29,7 +42,7 @@ typedef u_int64_t __u64;
 #endif
 
 #ifndef offsetof
 #endif
 
 #ifndef offsetof
-# define offsetof(typ,memb)     ((int)((char *)&(((typ *)0)->memb)))
+# define offsetof(typ,memb)     ((unsigned long)((char *)&(((typ *)0)->memb)))
 #endif
 
 #define LOWEST_BIT_SET(x)       ((x) & ~((x) - 1))
 #endif
 
 #define LOWEST_BIT_SET(x)       ((x) & ~((x) - 1))
index 34c263b..9ab4020 100644 (file)
@@ -60,14 +60,14 @@ extern int is_kernel_text_address(unsigned long addr);
 #endif
 
 #if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
 #endif
 
 #if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
-# define THREAD_NAME(comm, fmt, a...)                                   \
-        sprintf(comm, fmt "|%d", ## a, current->thread.extern_pid)
+# define THREAD_NAME(comm, len, fmt, a...)                              \
+        snprintf(comm, len, fmt "|%d", ## a, current->thread.extern_pid)
 #elif defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
 #elif defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-# define THREAD_NAME(comm, fmt, a...)                                   \
-        sprintf(comm, fmt "|%d", ## a, current->thread.mode.tt.extern_pid)
+# define THREAD_NAME(comm, len, fmt, a...)                              \
+        snprintf(comm, len,fmt"|%d", ## a,current->thread.mode.tt.extern_pid)
 #else
 #else
-# define THREAD_NAME(comm, fmt, a...)                                   \
-        sprintf(comm, fmt, ## a)
+# define THREAD_NAME(comm, len, fmt, a...)                              \
+        snprintf(comm, len, fmt, ## a)
 #endif
 
 #ifdef HAVE_PAGE_LIST
 #endif
 
 #ifdef HAVE_PAGE_LIST
index f3fdaaf..2af336e 100644 (file)
@@ -80,13 +80,15 @@ int jt_dbg_panic(int argc, char **argv);
 int ptl_set_cfg_record_cb(cfg_record_cb_t cb);
 
 /* l_ioctl.c */
 int ptl_set_cfg_record_cb(cfg_record_cb_t cb);
 
 /* l_ioctl.c */
-typedef int (ioc_handler_t)(int dev_id, int opc, void *buf);
+typedef int (ioc_handler_t)(int dev_id, unsigned int opc, void *buf);
 void set_ioc_handler(ioc_handler_t *handler);
 int register_ioc_dev(int dev_id, const char * dev_name);
 void unregister_ioc_dev(int dev_id);
 int set_ioctl_dump(char * file);
 void set_ioc_handler(ioc_handler_t *handler);
 int register_ioc_dev(int dev_id, const char * dev_name);
 void unregister_ioc_dev(int dev_id);
 int set_ioctl_dump(char * file);
-int l_ioctl(int dev_id, int opc, void *buf);
-int parse_dump(char * dump_file, int (*ioc_func)(int dev_id, int opc, void *));
+int l_ioctl(int dev_id, unsigned int opc, void *buf);
+int parse_dump(char * dump_file, ioc_handler_t ioc_func);
 int jt_ioc_dump(int argc, char **argv);
 int jt_ioc_dump(int argc, char **argv);
+extern char *dump_filename;
+int dump(int dev_id, unsigned int opc, void *buf);
 
 #endif
 
 #endif
index f3fdaaf..2af336e 100644 (file)
@@ -80,13 +80,15 @@ int jt_dbg_panic(int argc, char **argv);
 int ptl_set_cfg_record_cb(cfg_record_cb_t cb);
 
 /* l_ioctl.c */
 int ptl_set_cfg_record_cb(cfg_record_cb_t cb);
 
 /* l_ioctl.c */
-typedef int (ioc_handler_t)(int dev_id, int opc, void *buf);
+typedef int (ioc_handler_t)(int dev_id, unsigned int opc, void *buf);
 void set_ioc_handler(ioc_handler_t *handler);
 int register_ioc_dev(int dev_id, const char * dev_name);
 void unregister_ioc_dev(int dev_id);
 int set_ioctl_dump(char * file);
 void set_ioc_handler(ioc_handler_t *handler);
 int register_ioc_dev(int dev_id, const char * dev_name);
 void unregister_ioc_dev(int dev_id);
 int set_ioctl_dump(char * file);
-int l_ioctl(int dev_id, int opc, void *buf);
-int parse_dump(char * dump_file, int (*ioc_func)(int dev_id, int opc, void *));
+int l_ioctl(int dev_id, unsigned int opc, void *buf);
+int parse_dump(char * dump_file, ioc_handler_t ioc_func);
 int jt_ioc_dump(int argc, char **argv);
 int jt_ioc_dump(int argc, char **argv);
+extern char *dump_filename;
+int dump(int dev_id, unsigned int opc, void *buf);
 
 #endif
 
 #endif
index 519db0e..3a6508e 100644 (file)
@@ -968,18 +968,21 @@ char *portals_nid2str(int nal, ptl_nid_t nid, char *str)
         case TCPNAL:
                 /* userspace NAL */
         case SOCKNAL:
         case TCPNAL:
                 /* userspace NAL */
         case SOCKNAL:
-                snprintf(str, PTL_NALFMT_SIZE-1,
-                         "%u:%d.%d.%d.%d", (__u32)(nid >> 32), HIPQUAD(nid));
+                snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u.%u.%u.%u",
+                         (__u32)(nid >> 32), HIPQUAD(nid));
                 break;
         case QSWNAL:
         case GMNAL:
         case IBNAL:
         case SCIMACNAL:
                 break;
         case QSWNAL:
         case GMNAL:
         case IBNAL:
         case SCIMACNAL:
-                snprintf(str, PTL_NALFMT_SIZE-1, LPD64, nid);
+                snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u",
+                         (__u32)(nid >> 32), (__u32)nid);
                 break;
 #endif
         default:
                 break;
 #endif
         default:
-                snprintf(str, PTL_NALFMT_SIZE-1, "(?%llx)", (long long)nid);
+                snprintf(str, PTL_NALFMT_SIZE - 1, "?%d? %llx",
+                         nal, (long long)nid);
+                break;
         }
         return str;
 }
         }
         return str;
 }
index c1b2aec..c850f69 100644 (file)
@@ -62,16 +62,18 @@ extern char debug_daemon_file_path[1024];
 extern char portals_upcall[1024];
 
 #define PSDEV_PORTALS  (0x100)
 extern char portals_upcall[1024];
 
 #define PSDEV_PORTALS  (0x100)
-#define PSDEV_DEBUG           1   /* control debugging */
-#define PSDEV_SUBSYSTEM_DEBUG 2   /* control debugging */
-#define PSDEV_PRINTK          3   /* force all errors to console */
-#define PSDEV_CONSOLE         4   /* allow _any_ messages to console */
-#define PSDEV_DEBUG_PATH      5   /* crashdump log location */
-#define PSDEV_DEBUG_DUMP_PATH 6   /* crashdump tracelog location */
-#define PSDEV_PORTALS_UPCALL  7   /* User mode upcall script  */
-
-#define PORTALS_PRIMARY_CTLCNT 7
-static struct ctl_table portals_table[PORTALS_PRIMARY_CTLCNT + 1] = {
+enum {
+        PSDEV_DEBUG = 1,          /* control debugging */
+        PSDEV_SUBSYSTEM_DEBUG,    /* control debugging */
+        PSDEV_PRINTK,             /* force all errors to console */
+        PSDEV_CONSOLE,            /* allow _any_ messages to console */
+        PSDEV_DEBUG_PATH,         /* crashdump log location */
+        PSDEV_DEBUG_DUMP_PATH,    /* crashdump tracelog location */
+        PSDEV_PORTALS_UPCALL,     /* User mode upcall script  */
+        PSDEV_PORTALS_MEMUSED,    /* bytes currently PORTAL_ALLOCated */
+};
+
+static struct ctl_table portals_table[] = {
         {PSDEV_DEBUG, "debug", &portal_debug, sizeof(int), 0644, NULL,
          &proc_dointvec},
         {PSDEV_SUBSYSTEM_DEBUG, "subsystem_debug", &portal_subsystem_debug,
         {PSDEV_DEBUG, "debug", &portal_debug, sizeof(int), 0644, NULL,
          &proc_dointvec},
         {PSDEV_SUBSYSTEM_DEBUG, "subsystem_debug", &portal_subsystem_debug,
@@ -88,6 +90,8 @@ static struct ctl_table portals_table[PORTALS_PRIMARY_CTLCNT + 1] = {
         {PSDEV_PORTALS_UPCALL, "upcall", portals_upcall,
          sizeof(portals_upcall), 0644, NULL, &proc_dostring,
          &sysctl_string},
         {PSDEV_PORTALS_UPCALL, "upcall", portals_upcall,
          sizeof(portals_upcall), 0644, NULL, &proc_dostring,
          &sysctl_string},
+        {PSDEV_PORTALS_MEMUSED, "memused", (int *)&portal_kmemory.counter,
+         sizeof(int), 0644, NULL, &proc_dointvec},
         {0}
 };
 
         {0}
 };
 
index d2aad31..ae2da55 100644 (file)
@@ -183,9 +183,6 @@ static int applymask(char* procpath, int value)
         return 0;
 }
 
         return 0;
 }
 
-extern char *dump_filename;
-extern int dump(int dev_id, int opc, void *buf);
-
 static void applymask_all(unsigned int subs_mask, unsigned int debug_mask)
 {
         if (!dump_filename) {
 static void applymask_all(unsigned int subs_mask, unsigned int debug_mask)
 {
         if (!dump_filename) {
index 1adcc8e..0671c24 100644 (file)
@@ -56,7 +56,7 @@ static struct ioc_dev ioc_dev_list[10];
 struct dump_hdr {
        int magic;
        int dev_id;
 struct dump_hdr {
        int magic;
        int dev_id;
-       int opc;
+        unsigned int opc;
 };
 
 char *dump_filename;
 };
 
 char *dump_filename;
@@ -101,7 +101,7 @@ open_ioc_dev(int dev_id)
 
 
 static int 
 
 
 static int 
-do_ioctl(int dev_id, int opc, void *buf)
+do_ioctl(int dev_id, unsigned int opc, void *buf)
 {
        int fd, rc;
        
 {
        int fd, rc;
        
@@ -131,7 +131,7 @@ get_dump_file()
  * used, but for now it will assumed whatever app reads the file will
  * know what to do. */
 int 
  * used, but for now it will assumed whatever app reads the file will
  * know what to do. */
 int 
-dump(int dev_id, int opc, void *buf)
+dump(int dev_id, unsigned int opc, void *buf)
 {
        FILE *fp;
        struct dump_hdr dump_hdr;
 {
        FILE *fp;
        struct dump_hdr dump_hdr;
@@ -212,7 +212,7 @@ set_ioctl_dump(char * file)
 }
 
 int
 }
 
 int
-l_ioctl(int dev_id, int opc, void *buf)
+l_ioctl(int dev_id, unsigned int opc, void *buf)
 {
         return current_ioc_handler(dev_id, opc, buf);
 }
 {
         return current_ioc_handler(dev_id, opc, buf);
 }
@@ -226,7 +226,7 @@ l_ioctl(int dev_id, int opc, void *buf)
  * each device used in the dump.
  */
 int 
  * each device used in the dump.
  */
 int 
-parse_dump(char * dump_file, int (*ioc_func)(int dev_id, int opc, void *))
+parse_dump(char * dump_file, ioc_handler_t ioc_func)
 {
        int line =0;
        struct stat st;
 {
        int line =0;
        struct stat st;
index 859c5de..86b2da8 100644 (file)
@@ -373,7 +373,7 @@ __u64 ptl_nid2u64(ptl_nid_t nid)
         case 4:
                 return ((__u32)nid);
         default:
         case 4:
                 return ((__u32)nid);
         default:
-                fprintf(stderr, "Unexpected sizeof(ptl_nid_t) == %d\n", sizeof(nid));
+                fprintf(stderr, "Unexpected sizeof(ptl_nid_t) == %u\n", sizeof(nid));
                 abort();
                 /* notreached */
                 return (-1);
                 abort();
                 /* notreached */
                 return (-1);
@@ -1572,7 +1572,7 @@ lwt_print(FILE *f, cycles_t t0, cycles_t tlast, double mhz, int cpu, lwt_event_t
         if (where == NULL)
                 return (-1);
 
         if (where == NULL)
                 return (-1);
 
-        sprintf(whenstr, LPD64, e->lwte_when - t0);
+        sprintf(whenstr, LPU64, (__u64)(e->lwte_when - t0));
 
         fprintf(f, "%#010lx %#010lx %#010lx %#010lx: %#010lx %1d %10.6f %10.2f %s\n",
                 e->lwte_p1, e->lwte_p2, e->lwte_p3, e->lwte_p4,
 
         fprintf(f, "%#010lx %#010lx %#010lx %#010lx: %#010lx %1d %10.6f %10.2f %s\n",
                 e->lwte_p1, e->lwte_p2, e->lwte_p3, e->lwte_p4,
index a73a521..6316290 100644 (file)
@@ -34,7 +34,7 @@ do {                                                    \
 
 #define CHECK_MEMBER_OFFSET(s,m)                \
 do {                                            \
 
 #define CHECK_MEMBER_OFFSET(s,m)                \
 do {                                            \
-        CHECK_VALUE(offsetof(s, m));            \
+        CHECK_VALUE((int)offsetof(s, m));       \
 } while (0)
 
 #define CHECK_MEMBER_SIZEOF(s,m)                \
 } while (0)
 
 #define CHECK_MEMBER_SIZEOF(s,m)                \
index e1fbe08..1ae5fd4 100644 (file)
@@ -2,6 +2,8 @@ tbd  Cluster File Systems, Inc. <info@clusterfs.com>
        * version 1.2.x
        * bug fixes
        - clear page cache after eviction (2766)
        * version 1.2.x
        * bug fixes
        - clear page cache after eviction (2766)
+       - deal with strange write() on x86-64 (3043)
+       - don't dereference NULL peer_ni in ldlm_handle_ast_error (3258)
 
 tbd  Cluster File Systems, Inc. <info@clusterfs.com>
        * version 1.2.2
 
 tbd  Cluster File Systems, Inc. <info@clusterfs.com>
        * version 1.2.2
@@ -23,8 +25,12 @@ tbd  Cluster File Systems, Inc. <info@clusterfs.com>
        - zero nameidata in detach_mnt in 2.6 (3118)
        - verify d_inode after revalidate_special is valid in 2.6 (3116)
        - use lustre_put_super() to handle zconf unmounts in 2.6 (3064)
        - zero nameidata in detach_mnt in 2.6 (3118)
        - verify d_inode after revalidate_special is valid in 2.6 (3116)
        - use lustre_put_super() to handle zconf unmounts in 2.6 (3064)
+       - initialize RPC timeout timer earlier for 2.6 (3219)
+       - don't dereference NULL reply buffer if mdc_close was never sent (2410)
+       - print nal/nid for unknown nid (3258)
        * miscellania
        - allow default OST striping configuration per directory (1414)
        * miscellania
        - allow default OST striping configuration per directory (1414)
+       - increase maximum number of MDS request buffers for large systems
 
 2004-03-22  Cluster File Systems, Inc. <info@clusterfs.com>
        * version 1.2.1
 
 2004-03-22  Cluster File Systems, Inc. <info@clusterfs.com>
        * version 1.2.1
index aae0442..84062e2 100644 (file)
 #define MDT_MAX_THREADS 32UL
 #define MDT_NUM_THREADS max(min_t(unsigned long, num_physpages / 8192, \
                                   MDT_MAX_THREADS), 2UL)
 #define MDT_MAX_THREADS 32UL
 #define MDT_NUM_THREADS max(min_t(unsigned long, num_physpages / 8192, \
                                   MDT_MAX_THREADS), 2UL)
-#define MDS_NBUF_MAX    512UL
+#define MDS_NBUF_MAX    4096UL
 #define MDS_BUFSIZE     (8 * 1024)
 /* Assume file name length = FNAME_MAX = 256 (true for extN).
  *        path name length = PATH_MAX = 4096
 #define MDS_BUFSIZE     (8 * 1024)
 /* Assume file name length = FNAME_MAX = 256 (true for extN).
  *        path name length = PATH_MAX = 4096
@@ -284,7 +284,7 @@ struct ptlrpc_request {
         unsigned int rq_intr:1, rq_replied:1, rq_err:1,
                 rq_timedout:1, rq_resend:1, rq_restart:1, rq_replay:1,
                 rq_no_resend:1, rq_waiting:1, rq_receiving_reply:1,
         unsigned int rq_intr:1, rq_replied:1, rq_err:1,
                 rq_timedout:1, rq_resend:1, rq_restart:1, rq_replay:1,
                 rq_no_resend:1, rq_waiting:1, rq_receiving_reply:1,
-                rq_no_delay:1;
+                rq_no_delay:1, rq_net_err:1;
         int rq_phase;
         /* client-side refcount for SENT race */
         atomic_t rq_refcount;
         int rq_phase;
         /* client-side refcount for SENT race */
         atomic_t rq_refcount;
@@ -511,6 +511,7 @@ struct ptlrpc_service {
 
 static inline char *ptlrpc_peernid2str(struct ptlrpc_peer *p, char *str)
 {
 
 static inline char *ptlrpc_peernid2str(struct ptlrpc_peer *p, char *str)
 {
+        LASSERT(p->peer_ni != NULL);
         return (portals_nid2str(p->peer_ni->pni_number, p->peer_nid, str));
 }
 
         return (portals_nid2str(p->peer_ni->pni_number, p->peer_nid, str));
 }
 
index 386c393..941d9b5 100644 (file)
@@ -608,6 +608,9 @@ obd_lvfs_fid2dentry(struct obd_export *exp, __u64 id_ino, __u32 gen, __u64 gr)
 #define time_before(t1, t2) ((long)t2 - (long)t1 > 0)
 #endif
 
 #define time_before(t1, t2) ((long)t2 - (long)t1 > 0)
 #endif
 
+/* @max_age is the oldest time in jiffies that we accept using a cached data.
+ * If the cache is older than @max_age we will get a new value from the
+ * target.  Use a value of "jiffies + HZ" to guarantee freshness. */
 static inline int obd_statfs(struct obd_device *obd, struct obd_statfs *osfs,
                              unsigned long max_age)
 {
 static inline int obd_statfs(struct obd_device *obd, struct obd_statfs *osfs,
                              unsigned long max_age)
 {
@@ -623,10 +626,12 @@ static inline int obd_statfs(struct obd_device *obd, struct obd_statfs *osfs,
         CDEBUG(D_SUPER, "osfs %lu, max_age %lu\n", obd->obd_osfs_age, max_age);
         if (time_before(obd->obd_osfs_age, max_age)) {
                 rc = OBP(obd, statfs)(obd, osfs, max_age);
         CDEBUG(D_SUPER, "osfs %lu, max_age %lu\n", obd->obd_osfs_age, max_age);
         if (time_before(obd->obd_osfs_age, max_age)) {
                 rc = OBP(obd, statfs)(obd, osfs, max_age);
-                spin_lock(&obd->obd_osfs_lock);
-                memcpy(&obd->obd_osfs, osfs, sizeof(obd->obd_osfs));
-                obd->obd_osfs_age = jiffies;
-                spin_unlock(&obd->obd_osfs_lock);
+                if (rc == 0) {
+                        spin_lock(&obd->obd_osfs_lock);
+                        memcpy(&obd->obd_osfs, osfs, sizeof(obd->obd_osfs));
+                        obd->obd_osfs_age = jiffies;
+                        spin_unlock(&obd->obd_osfs_lock);
+                }
         } else {
                 CDEBUG(D_SUPER, "using cached obd_statfs data\n");
                 spin_lock(&obd->obd_osfs_lock);
         } else {
                 CDEBUG(D_SUPER, "using cached obd_statfs data\n");
                 spin_lock(&obd->obd_osfs_lock);
index 711e1f2..7865c63 100644 (file)
@@ -1667,8 +1667,8 @@ Index: linux-2.4.19-pre1/fs/ext3/namei.c
 +      data1 = bh2->b_data;
 +
 +      /* The 0th block becomes the root, move the dirents out */
 +      data1 = bh2->b_data;
 +
 +      /* The 0th block becomes the root, move the dirents out */
-+      de = (struct ext3_dir_entry_2 *) &root->dotdot;
-+      de = (struct ext3_dir_entry_2 *) ((char *)de + de->rec_len);
++      de = (struct ext3_dir_entry_2 *)&root->dotdot;
++      de = (struct ext3_dir_entry_2 *)((char *)de + le16_to_cpu(de->rec_len));
 +      len = ((char *) root) + blocksize - (char *) de;
 +      memcpy (data1, de, len);
 +      de = (struct ext3_dir_entry_2 *) data1;
 +      len = ((char *) root) + blocksize - (char *) de;
 +      memcpy (data1, de, len);
 +      de = (struct ext3_dir_entry_2 *) data1;
index 36d6b5e..3a9719b 100644 (file)
@@ -1667,8 +1667,8 @@ Index: linux-2.4.21-chaos/fs/ext3/namei.c
 +      data1 = bh2->b_data;
 +
 +      /* The 0th block becomes the root, move the dirents out */
 +      data1 = bh2->b_data;
 +
 +      /* The 0th block becomes the root, move the dirents out */
-+      de = (struct ext3_dir_entry_2 *) &root->dotdot;
-+      de = (struct ext3_dir_entry_2 *) ((char *)de + de->rec_len);
++      de = (struct ext3_dir_entry_2 *)&root->dotdot;
++      de = (struct ext3_dir_entry_2 *)((char *)de + le16_to_cpu(de->rec_len));
 +      len = ((char *) root) + blocksize - (char *) de;
 +      memcpy (data1, de, len);
 +      de = (struct ext3_dir_entry_2 *) data1;
 +      len = ((char *) root) + blocksize - (char *) de;
 +      memcpy (data1, de, len);
 +      de = (struct ext3_dir_entry_2 *) data1;
index 3230853..436bd34 100644 (file)
 +      data1 = bh2->b_data;
 +
 +      /* The 0th block becomes the root, move the dirents out */
 +      data1 = bh2->b_data;
 +
 +      /* The 0th block becomes the root, move the dirents out */
-+      de = (struct ext3_dir_entry_2 *) &root->dotdot;
-+      de = (struct ext3_dir_entry_2 *) ((char *)de + de->rec_len);
++      de = (struct ext3_dir_entry_2 *)&root->dotdot;
++      de = (struct ext3_dir_entry_2 *)((char *)de + le16_to_cpu(de->rec_len));
 +      len = ((char *) root) + blocksize - (char *) de;
 +      memcpy (data1, de, len);
 +      de = (struct ext3_dir_entry_2 *) data1;
 +      len = ((char *) root) + blocksize - (char *) de;
 +      memcpy (data1, de, len);
 +      de = (struct ext3_dir_entry_2 *) data1;
index ea55ad1..a6e96f0 100644 (file)
@@ -1667,8 +1667,8 @@ Index: linux-2.4.21-suse/fs/ext3/namei.c
 +      data1 = bh2->b_data;
 +
 +      /* The 0th block becomes the root, move the dirents out */
 +      data1 = bh2->b_data;
 +
 +      /* The 0th block becomes the root, move the dirents out */
-+      de = (struct ext3_dir_entry_2 *) &root->dotdot;
-+      de = (struct ext3_dir_entry_2 *) ((char *)de + de->rec_len);
++      de = (struct ext3_dir_entry_2 *)&root->dotdot;
++      de = (struct ext3_dir_entry_2 *)((char *)de + le16_to_cpu(de->rec_len));
 +      len = ((char *) root) + blocksize - (char *) de;
 +      memcpy (data1, de, len);
 +      de = (struct ext3_dir_entry_2 *) data1;
 +      len = ((char *) root) + blocksize - (char *) de;
 +      memcpy (data1, de, len);
 +      de = (struct ext3_dir_entry_2 *) data1;
index 1c1c1ad..903118b 100644 (file)
 +      data1 = bh2->b_data;
 +
 +      /* The 0th block becomes the root, move the dirents out */
 +      data1 = bh2->b_data;
 +
 +      /* The 0th block becomes the root, move the dirents out */
-+      de = (struct ext3_dir_entry_2 *) &root->dotdot;
-+      de = (struct ext3_dir_entry_2 *) ((char *)de + de->rec_len);
++      de = (struct ext3_dir_entry_2 *)&root->dotdot;
++      de = (struct ext3_dir_entry_2 *)((char *)de + le16_to_cpu(de->rec_len));
 +      len = ((char *) root) + blocksize - (char *) de;
 +      memcpy (data1, de, len);
 +      de = (struct ext3_dir_entry_2 *) data1;
 +      len = ((char *) root) + blocksize - (char *) de;
 +      memcpy (data1, de, len);
 +      de = (struct ext3_dir_entry_2 *) data1;
index 2bfd0b9..a8bce7c 100644 (file)
 +              data1 = bh2->b_data;
 +
 +              /* The 0th block becomes the root, move the dirents out */
 +              data1 = bh2->b_data;
 +
 +              /* The 0th block becomes the root, move the dirents out */
-+              de = (struct ext3_dir_entry_2 *) &root->dotdot;
-+              de = (struct ext3_dir_entry_2 *) ((char *)de + de->rec_len);
++              de = (struct ext3_dir_entry_2 *)&root->dotdot;
++              de = (struct ext3_dir_entry_2 *)((char *)de + le16_to_cpu(de->rec_len));
 +              len = ((char *) root) + sb->s_blocksize - (char *) de;
 +              memcpy (data1, de, len);
 +              de = (ext3_dirent *) data1;
 +              len = ((char *) root) + sb->s_blocksize - (char *) de;
 +              memcpy (data1, de, len);
 +              de = (ext3_dirent *) data1;
index 65e8dcd..cff99dd 100644 (file)
@@ -1,4 +1,3 @@
-header-guards-2.6-suse.patch
 ext3-wantedi-2.6-suse.patch
 ext3-san-jdike-2.6-suse.patch
 iopen-2.6-suse.patch 
 ext3-wantedi-2.6-suse.patch
 ext3-san-jdike-2.6-suse.patch
 iopen-2.6-suse.patch 
@@ -8,4 +7,3 @@ ext3-init-generation-2.6-suse.patch
 ext3-ea-in-inode-2.6-suse.patch
 export-ext3-2.6-suse.patch
 ext3-include-fixes-2.6-suse.patch
 ext3-ea-in-inode-2.6-suse.patch
 export-ext3-2.6-suse.patch
 ext3-include-fixes-2.6-suse.patch
-ext3-xattr-header-move-2.6.suse.patch
index 2dce8a4..d17e850 100644 (file)
@@ -713,7 +713,6 @@ void target_start_recovery_timer(struct obd_device *obd, svc_handler_t handler)
         obd->obd_recovery_handler = handler;
         obd->obd_recovery_timer.function = target_recovery_expired;
         obd->obd_recovery_timer.data = (unsigned long)obd;
         obd->obd_recovery_handler = handler;
         obd->obd_recovery_timer.function = target_recovery_expired;
         obd->obd_recovery_timer.data = (unsigned long)obd;
-        init_timer(&obd->obd_recovery_timer);
         spin_unlock_bh(&obd->obd_processing_task_lock);
 
         reset_recovery_timer(obd);
         spin_unlock_bh(&obd->obd_processing_task_lock);
 
         reset_recovery_timer(obd);
index 5ddba66..2a09a2e 100644 (file)
@@ -309,15 +309,10 @@ static void ldlm_failed_ast(struct ldlm_lock *lock, int rc,const char *ast_type)
         struct ptlrpc_connection *conn = lock->l_export->exp_connection;
         char str[PTL_NALFMT_SIZE];
 
         struct ptlrpc_connection *conn = lock->l_export->exp_connection;
         char str[PTL_NALFMT_SIZE];
 
-        CERROR("%s AST failed (%d) for res "LPU64"/"LPU64
-               ", mode %s: evicting client %s@%s NID %s\n",
-               ast_type, rc,
-               lock->l_resource->lr_name.name[0],
-               lock->l_resource->lr_name.name[1],
-               ldlm_lockname[lock->l_granted_mode],
-               lock->l_export->exp_client_uuid.uuid,
-               conn->c_remote_uuid.uuid,
-               ptlrpc_peernid2str(&conn->c_peer, str));
+        LDLM_ERROR(lock, "%s AST failed (%d): evicting client %s@%s NID "LPX64
+                   " (%s)", ast_type, rc, lock->l_export->exp_client_uuid.uuid,
+                   conn->c_remote_uuid.uuid, conn->c_peer.peer_nid,
+                   ptlrpc_peernid2str(&conn->c_peer, str));
         ptlrpc_fail_export(lock->l_export);
 }
 
         ptlrpc_fail_export(lock->l_export);
 }
 
@@ -325,6 +320,7 @@ static int ldlm_handle_ast_error(struct ldlm_lock *lock,
                                  struct ptlrpc_request *req, int rc,
                                  const char *ast_type)
 {
                                  struct ptlrpc_request *req, int rc,
                                  const char *ast_type)
 {
+        struct ptlrpc_peer *peer = &req->rq_import->imp_connection->c_peer;
         char str[PTL_NALFMT_SIZE];
 
         if (rc == -ETIMEDOUT || rc == -EINTR || rc == -ENOTCONN) {
         char str[PTL_NALFMT_SIZE];
 
         if (rc == -ETIMEDOUT || rc == -EINTR || rc == -ENOTCONN) {
@@ -332,7 +328,7 @@ static int ldlm_handle_ast_error(struct ldlm_lock *lock,
                 if (lock->l_export->exp_libclient) {
                         LDLM_DEBUG(lock, "%s AST to liblustre client (nid %s)"
                                    " timeout, just cancelling lock", ast_type,
                 if (lock->l_export->exp_libclient) {
                         LDLM_DEBUG(lock, "%s AST to liblustre client (nid %s)"
                                    " timeout, just cancelling lock", ast_type,
-                                   ptlrpc_peernid2str(&req->rq_peer, str));
+                                   ptlrpc_peernid2str(peer, str));
                         ldlm_lock_cancel(lock);
                         rc = -ERESTART;
                 } else {
                         ldlm_lock_cancel(lock);
                         rc = -ERESTART;
                 } else {
@@ -343,12 +339,11 @@ static int ldlm_handle_ast_error(struct ldlm_lock *lock,
                 if (rc == -EINVAL)
                         LDLM_DEBUG(lock, "client (nid %s) returned %d"
                                    " from %s AST - normal race",
                 if (rc == -EINVAL)
                         LDLM_DEBUG(lock, "client (nid %s) returned %d"
                                    " from %s AST - normal race",
-                                   ptlrpc_peernid2str(&req->rq_peer, str),
+                                   ptlrpc_peernid2str(peer, str),
                                    req->rq_repmsg->status, ast_type);
                 else
                         LDLM_ERROR(lock, "client (nid %s) returned %d "
                                    req->rq_repmsg->status, ast_type);
                 else
                         LDLM_ERROR(lock, "client (nid %s) returned %d "
-                                   "from %s AST", 
-                                   ptlrpc_peernid2str(&req->rq_peer, str),
+                                   "from %s AST", ptlrpc_peernid2str(peer, str),
                                    (req->rq_repmsg != NULL) ?
                                    req->rq_repmsg->status : 0, ast_type);
                 ldlm_lock_cancel(lock);
                                    (req->rq_repmsg != NULL) ?
                                    req->rq_repmsg->status : 0, ast_type);
                 ldlm_lock_cancel(lock);
index 0b549c0..bd000bb 100644 (file)
@@ -81,23 +81,26 @@ char *portals_nid2str(int nal, ptl_nid_t nid, char *str)
         case TCPNAL:
                 /* userspace NAL */
         case SOCKNAL:
         case TCPNAL:
                 /* userspace NAL */
         case SOCKNAL:
-                sprintf(str, "%u:%d.%d.%d.%d", (__u32)(nid >> 32),
-                        HIPQUAD(nid));
+                snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u.%u.%u.%u",
+                         (__u32)(nid >> 32), HIPQUAD(nid));
                 break;
         case QSWNAL:
         case GMNAL:
         case IBNAL:
         case SCIMACNAL:
                 break;
         case QSWNAL:
         case GMNAL:
         case IBNAL:
         case SCIMACNAL:
-                sprintf(str, "%u:%u", (__u32)(nid >> 32), (__u32)nid);
+                snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u",
+                         (__u32)(nid >> 32), (__u32)nid);
                 break;
         default:
                 break;
         default:
-                return NULL;
+                snprintf(str, PTL_NALFMT_SIZE - 1, "?%d? %llx",
+                         nal, (long long)nid);
+                break;
         }
         return str;
 }
 
 void init_current(char *comm)
         }
         return str;
 }
 
 void init_current(char *comm)
-{ 
+{
         current = malloc(sizeof(*current));
         current->fs = malloc(sizeof(*current->fs));
         current->fs->umask = umask(0777);
         current = malloc(sizeof(*current));
         current->fs = malloc(sizeof(*current->fs));
         current->fs->umask = umask(0777);
@@ -145,7 +148,7 @@ libcfs_nal_cmd(struct portals_cfg *pcfg)
 
 extern int class_handle_ioctl(unsigned int cmd, unsigned long arg);
 
 
 extern int class_handle_ioctl(unsigned int cmd, unsigned long arg);
 
-int lib_ioctl_nalcmd(int dev_id, int opc, void * ptr)
+int lib_ioctl_nalcmd(int dev_id, unsigned int opc, void * ptr)
 {
         struct portal_ioctl_data *ptldata;
 
 {
         struct portal_ioctl_data *ptldata;
 
@@ -165,7 +168,7 @@ int lib_ioctl_nalcmd(int dev_id, int opc, void * ptr)
        return (0);
 }
 
        return (0);
 }
 
-int lib_ioctl(int dev_id, int opc, void * ptr)
+int lib_ioctl(int dev_id, unsigned int opc, void * ptr)
 {
         int rc;
 
 {
         int rc;
 
index ca2caaa..139a10a 100644 (file)
@@ -1,3 +1,6 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ */
 #include <stdio.h>
 #include <netinet/in.h>
 #include <sys/socket.h>
 #include <stdio.h>
 #include <netinet/in.h>
 #include <sys/socket.h>
@@ -20,7 +23,7 @@ struct obd_import;
 
 unsigned int portal_subsystem_debug = ~0 - (S_PORTALS | S_QSWNAL | S_SOCKNAL |
                                             S_GMNAL | S_IBNAL);
 
 unsigned int portal_subsystem_debug = ~0 - (S_PORTALS | S_QSWNAL | S_SOCKNAL |
                                             S_GMNAL | S_IBNAL);
-                                                                                                                        
+
 void *inter_module_get(char *arg)
 {
         if (!strcmp(arg, "tcpnal_ni"))
 void *inter_module_get(char *arg)
 {
         if (!strcmp(arg, "tcpnal_ni"))
@@ -42,17 +45,20 @@ char *portals_nid2str(int nal, ptl_nid_t nid, char *str)
         case TCPNAL:
                 /* userspace NAL */
         case SOCKNAL:
         case TCPNAL:
                 /* userspace NAL */
         case SOCKNAL:
-                sprintf(str, "%u:%d.%d.%d.%d", (__u32)(nid >> 32),
-                        HIPQUAD(nid));
+                snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u.%u.%u.%u",
+                         (__u32)(nid >> 32), HIPQUAD(nid));
                 break;
         case QSWNAL:
         case GMNAL:
         case IBNAL:
         case SCIMACNAL:
                 break;
         case QSWNAL:
         case GMNAL:
         case IBNAL:
         case SCIMACNAL:
-                sprintf(str, "%u:%u", (__u32)(nid >> 32), (__u32)nid);
+                snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u",
+                         (__u32)(nid >> 32), (__u32)nid);
                 break;
         default:
                 break;
         default:
-                return NULL;
+                snprintf(str, PTL_NALFMT_SIZE - 1, "?%d? %llx",
+                         nal, (long long)nid);
+                break;
         }
         return str;
 }
         }
         return str;
 }
@@ -101,7 +107,7 @@ int init_lib_portals()
 
 extern int class_handle_ioctl(unsigned int cmd, unsigned long arg);
 
 
 extern int class_handle_ioctl(unsigned int cmd, unsigned long arg);
 
-int liblustre_ioctl(int dev_id, int opc, void *ptr)
+int liblustre_ioctl(int dev_id, unsigned int opc, void *ptr)
 {
        int   rc = -EINVAL;
        
 {
        int   rc = -EINVAL;
        
index 63b271f..d749c61 100644 (file)
@@ -12,3 +12,4 @@ autoMakefile
 .*.cmd
 .*.flags
 .tmp_versions
 .*.cmd
 .*.flags
 .tmp_versions
+.depend
index 5ae049d..bf8fb4c 100644 (file)
@@ -529,7 +529,7 @@ int lustre_fill_super(struct super_block *sb, void *data, int silent)
                 struct config_llog_instance cfg;
                 int len;
 
                 struct config_llog_instance cfg;
                 int len;
 
-                if (!lmd->lmd_mds) {
+                if (lmd->lmd_mds[0] == '\0') {
                         CERROR("no mds name\n");
                         GOTO(out_free, err = -EINVAL);
                 }
                         CERROR("no mds name\n");
                         GOTO(out_free, err = -EINVAL);
                 }
index ff27268..dfecb74 100644 (file)
@@ -1462,12 +1462,11 @@ static int lov_brw_check(struct lov_obd *lov, struct obdo *oa,
         for (i = 0; i < oa_bufs; i++) {
                 int stripe = lov_stripe_number(lsm, pga[i].off);
                 int ost = lsm->lsm_oinfo[stripe].loi_ost_idx;
         for (i = 0; i < oa_bufs; i++) {
                 int stripe = lov_stripe_number(lsm, pga[i].off);
                 int ost = lsm->lsm_oinfo[stripe].loi_ost_idx;
-                struct ldlm_extent ext, subext;
-                ext.start = pga[i].off;
-                ext.end = pga[i].off + pga[i].count;
+                obd_off start, end;
 
 
-                if (!lov_stripe_intersects(lsm, i, ext.start, ext.end,
-                                           &subext.start, &subext.end))
+                if (!lov_stripe_intersects(lsm, i, pga[i].off, 
+                                           pga[i].off + pga[i].count, &start,
+                                           &end))
                         continue;
 
                 if (lov->tgts[ost].active == 0) {
                         continue;
 
                 if (lov->tgts[ost].active == 0) {
@@ -2030,13 +2029,15 @@ static int lov_enqueue(struct obd_export *exp, struct lov_stripe_md *lsm,
         for (i = 0, loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count;
              i++, loi++, lov_lockhp++) {
                 ldlm_policy_data_t sub_ext;
         for (i = 0, loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count;
              i++, loi++, lov_lockhp++) {
                 ldlm_policy_data_t sub_ext;
+                obd_off start, end;
 
                 if (!lov_stripe_intersects(lsm, i, policy->l_extent.start,
 
                 if (!lov_stripe_intersects(lsm, i, policy->l_extent.start,
-                                           policy->l_extent.end,
-                                           &sub_ext.l_extent.start,
-                                           &sub_ext.l_extent.end))
+                                           policy->l_extent.end, &start,
+                                           &end))
                         continue;
 
                         continue;
 
+                sub_ext.l_extent.start = start;
+                sub_ext.l_extent.end = end;
                 sub_ext.l_extent.gid = policy->l_extent.gid;
 
                 if (lov->tgts[loi->loi_ost_idx].active == 0) {
                 sub_ext.l_extent.gid = policy->l_extent.gid;
 
                 if (lov->tgts[loi->loi_ost_idx].active == 0) {
@@ -2173,14 +2174,16 @@ static int lov_match(struct obd_export *exp, struct lov_stripe_md *lsm,
         for (i = 0, loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count;
              i++, loi++, lov_lockhp++) {
                 ldlm_policy_data_t sub_ext;
         for (i = 0, loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count;
              i++, loi++, lov_lockhp++) {
                 ldlm_policy_data_t sub_ext;
+                obd_off start, end;
                 int lov_flags;
 
                 if (!lov_stripe_intersects(lsm, i, policy->l_extent.start,
                 int lov_flags;
 
                 if (!lov_stripe_intersects(lsm, i, policy->l_extent.start,
-                                           policy->l_extent.end,
-                                           &sub_ext.l_extent.start,
-                                           &sub_ext.l_extent.end))
+                                           policy->l_extent.end, &start, &end))
                         continue;
 
                         continue;
 
+                sub_ext.l_extent.start = start;
+                sub_ext.l_extent.end = end;
+
                 if (lov->tgts[loi->loi_ost_idx].active == 0) {
                         CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx);
                         rc = -EIO;
                 if (lov->tgts[loi->loi_ost_idx].active == 0) {
                         CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx);
                         rc = -EIO;
index 30e4fc1..afa8ec0 100644 (file)
@@ -496,8 +496,11 @@ int mdc_close(struct obd_export *exp, struct obdo *obdo,
                                NULL, NULL);
         rc = l_wait_event(req->rq_reply_waitq, mdc_close_check_reply(req),
                           &lwi);
                                NULL, NULL);
         rc = l_wait_event(req->rq_reply_waitq, mdc_close_check_reply(req),
                           &lwi);
-        if (rc == 0) {
-                LASSERTF(req->rq_repmsg != NULL, "req = %p", req);
+        if (req->rq_repmsg == NULL) {
+                CDEBUG(D_HA, "request failed to send: %p, %d\n", req,
+                       req->rq_status);
+                rc = req->rq_status;
+        } else if (rc == 0) {
                 rc = req->rq_repmsg->status;
                 if (req->rq_repmsg->type == PTL_RPC_MSG_ERR) {
                         DEBUG_REQ(D_ERROR, req, "type == PTL_RPC_MSG_ERR, err "
                 rc = req->rq_repmsg->status;
                 if (req->rq_repmsg->type == PTL_RPC_MSG_ERR) {
                         DEBUG_REQ(D_ERROR, req, "type == PTL_RPC_MSG_ERR, err "
index 2d97357..6ebbcad 100644 (file)
@@ -1857,7 +1857,7 @@ static int mdt_setup(struct obd_device *obd, obd_count len, void *buf)
         }
 
         rc = ptlrpc_start_n_threads(obd, mds->mds_setattr_service,
         }
 
         rc = ptlrpc_start_n_threads(obd, mds->mds_setattr_service,
-                                 MDT_NUM_THREADS, "ll_mdt_attr");
+                                    MDT_NUM_THREADS, "ll_mdt_attr");
         if (rc)
                 GOTO(err_thread2, rc);
 
         if (rc)
                 GOTO(err_thread2, rc);
 
index 295f24f..2dfc6c6 100644 (file)
@@ -1183,6 +1183,7 @@ static int mds_reint_unlink(struct mds_update_record *rec, int offset,
 
         cleanup_phase = 1; /* dchild, dparent, locks */
 
 
         cleanup_phase = 1; /* dchild, dparent, locks */
 
+        dget(dchild);
         child_inode = dchild->d_inode;
         if (child_inode == NULL) {
                 CDEBUG(D_INODE, "child doesn't exist (dir %lu, name %s)\n",
         child_inode = dchild->d_inode;
         if (child_inode == NULL) {
                 CDEBUG(D_INODE, "child doesn't exist (dir %lu, name %s)\n",
@@ -1242,13 +1243,6 @@ static int mds_reint_unlink(struct mds_update_record *rec, int offset,
                         GOTO(cleanup, rc = -EISDIR);
         }
 
                         GOTO(cleanup, rc = -EISDIR);
         }
 
-        if (child_inode->i_nlink == (S_ISDIR(child_inode->i_mode) ? 2 : 1) &&
-            mds_open_orphan_count(child_inode) > 0) {
-                rc = mds_open_unlink_rename(rec, obd, dparent, dchild, &handle);
-                cleanup_phase = 4; /* transaction */
-                GOTO(cleanup, rc);
-        }
-
         /* Step 4: Do the unlink: we already verified ur_mode above (bug 72) */
         switch (child_inode->i_mode & S_IFMT) {
         case S_IFDIR:
         /* Step 4: Do the unlink: we already verified ur_mode above (bug 72) */
         switch (child_inode->i_mode & S_IFMT) {
         case S_IFDIR:
@@ -1319,6 +1313,14 @@ static int mds_reint_unlink(struct mds_update_record *rec, int offset,
 
         switch(cleanup_phase) {
         case 4:
 
         switch(cleanup_phase) {
         case 4:
+                LASSERT(dchild != NULL && dchild->d_inode != NULL);
+                LASSERT(atomic_read(&dchild->d_inode->i_count) > 0);
+                if (rc == 0 && dchild->d_inode->i_nlink == 0 &&
+                                mds_open_orphan_count(dchild->d_inode) > 0) {
+                        /* filesystem is really going to destroy an inode
+                         * we have to delay this till inode is opened -bzzz */
+                        mds_open_unlink_rename(rec, obd, dparent, dchild, NULL);
+                }
                 rc = mds_finish_transno(mds, dparent->d_inode, handle, req,
                                         rc, 0);
                 if (!rc)
                 rc = mds_finish_transno(mds, dparent->d_inode, handle, req,
                                         rc, 0);
                 if (!rc)
@@ -1341,6 +1343,7 @@ static int mds_reint_unlink(struct mds_update_record *rec, int offset,
                 else
                         ptlrpc_save_lock(req, &parent_lockh, LCK_PW);
                 l_dput(dchild);
                 else
                         ptlrpc_save_lock(req, &parent_lockh, LCK_PW);
                 l_dput(dchild);
+                l_dput(dchild);
                 l_dput(dparent);
         case 0:
                 break;
                 l_dput(dparent);
         case 0:
                 break;
index 87e9a27..a79e44c 100644 (file)
@@ -60,6 +60,7 @@ int mds_open_unlink_rename(struct mds_update_record *rec,
         struct dentry *pending_child;
         char fidname[LL_FID_NAMELEN];
         int fidlen = 0, rc;
         struct dentry *pending_child;
         char fidname[LL_FID_NAMELEN];
         int fidlen = 0, rc;
+        unsigned mode;
         ENTRY;
 
         LASSERT(!mds_inode_is_orphan(dchild->d_inode));
         ENTRY;
 
         LASSERT(!mds_inode_is_orphan(dchild->d_inode));
@@ -81,18 +82,26 @@ int mds_open_unlink_rename(struct mds_update_record *rec,
                 GOTO(out_dput, rc = 0);
         }
 
                 GOTO(out_dput, rc = 0);
         }
 
-        *handle = fsfilt_start(obd, pending_dir, FSFILT_OP_RENAME, NULL);
-        if (IS_ERR(*handle))
-                GOTO(out_dput, rc = PTR_ERR(*handle));
-
-        lock_kernel();
-        rc = vfs_rename(dparent->d_inode, dchild, pending_dir, pending_child);
-        unlock_kernel();
+        /* link() is semanticaly-wrong for S_IFDIR, so we set S_IFREG
+         * for linking and return real mode back then -bzzz */
+        mode = dchild->d_inode->i_mode;
+        dchild->d_inode->i_mode = S_IFREG;
+        rc = vfs_link(dchild, pending_dir, pending_child);
         if (rc)
         if (rc)
-                CERROR("error renaming orphan %lu/%s to PENDING: rc = %d\n",
-                       dparent->d_inode->i_ino, rec->ur_name, rc);
+                CERROR("error linking orphan %s to PENDING: rc = %d\n",
+                       rec->ur_name, rc);
         else
                 mds_inode_set_orphan(dchild->d_inode);
         else
                 mds_inode_set_orphan(dchild->d_inode);
+
+        /* return mode and correct i_nlink if inode is directory */
+        LASSERT(dchild->d_inode->i_nlink == 1);
+        dchild->d_inode->i_mode = mode;
+        if ((mode & S_IFMT) == S_IFDIR) {
+                dchild->d_inode->i_nlink++;
+                pending_dir->i_nlink++;
+        }
+        mark_inode_dirty(dchild->d_inode);
+
 out_dput:
         dput(pending_child);
 out_lock:
 out_dput:
         dput(pending_child);
 out_lock:
index 7d22ba2..b303f71 100644 (file)
@@ -124,6 +124,7 @@ int class_attach(struct lustre_cfg *lcfg)
 
         /* XXX belongs in setup not attach  */
         /* recovery data */
 
         /* XXX belongs in setup not attach  */
         /* recovery data */
+        init_timer(&obd->obd_recovery_timer);
         spin_lock_init(&obd->obd_processing_task_lock);
         init_waitqueue_head(&obd->obd_next_transno_waitq);
         INIT_LIST_HEAD(&obd->obd_recovery_queue);
         spin_lock_init(&obd->obd_processing_task_lock);
         init_waitqueue_head(&obd->obd_next_transno_waitq);
         INIT_LIST_HEAD(&obd->obd_recovery_queue);
index 8c93a48..158a2de 100644 (file)
@@ -51,6 +51,7 @@ enum {
         OBD_FAIL_LOC = 1,       /* control test failures instrumentation */
         OBD_TIMEOUT,            /* RPC timeout before recovery/intr */
         OBD_UPCALL,             /* path to recovery upcall */
         OBD_FAIL_LOC = 1,       /* control test failures instrumentation */
         OBD_TIMEOUT,            /* RPC timeout before recovery/intr */
         OBD_UPCALL,             /* path to recovery upcall */
+        OBD_MEMUSED,            /* bytes currently OBD_ALLOCated */
         OBD_SYNCFILTER,         /* XXX temporary, as we play with sync osts.. */
 };
 
         OBD_SYNCFILTER,         /* XXX temporary, as we play with sync osts.. */
 };
 
@@ -65,6 +66,8 @@ static ctl_table obd_table[] = {
         /* XXX need to lock so we avoid update races with recovery upcall! */
         {OBD_UPCALL, "upcall", obd_lustre_upcall, 128, 0644, NULL,
                 &proc_dostring, &sysctl_string },
         /* XXX need to lock so we avoid update races with recovery upcall! */
         {OBD_UPCALL, "upcall", obd_lustre_upcall, 128, 0644, NULL,
                 &proc_dostring, &sysctl_string },
+        {OBD_MEMUSED, "memused", (int *)&obd_memory.counter,
+                sizeof(int), 0644, NULL, &proc_dointvec},
         {OBD_SYNCFILTER, "filter_sync_on_commit", &obd_sync_filter, sizeof(int),
                 0644, NULL, &proc_dointvec},
         { 0 }
         {OBD_SYNCFILTER, "filter_sync_on_commit", &obd_sync_filter, sizeof(int),
                 0644, NULL, &proc_dointvec},
         { 0 }
index e31a39b..5d26f00 100644 (file)
@@ -12,3 +12,4 @@ autoMakefile
 *.mod.c
 .*.flags
 .tmp_versions
 *.mod.c
 .*.flags
 .tmp_versions
+.depend
index 3900ad1..b9b7ab3 100644 (file)
@@ -106,6 +106,9 @@ static void filter_grant_incoming(struct obd_export *exp, struct obdo *oa)
 {
         struct filter_export_data *fed;
         struct obd_device *obd = exp->exp_obd;
 {
         struct filter_export_data *fed;
         struct obd_device *obd = exp->exp_obd;
+        static unsigned long last_msg;
+        static int last_count;
+        int mask = D_CACHE;
         ENTRY;
 
         LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock);
         ENTRY;
 
         LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock);
@@ -119,11 +122,20 @@ static void filter_grant_incoming(struct obd_export *exp, struct obdo *oa)
 
         fed = &exp->exp_filter_data;
 
 
         fed = &exp->exp_filter_data;
 
+        /* Don't print this to the console the first time it happens, since
+         * it can happen legitimately on occasion, but only rarely. */
+        if (time_after(jiffies, last_msg + 60 * HZ)) {
+                last_count = 0;
+                last_msg = jiffies;
+        }
+        if ((last_count & (-last_count)) == last_count)
+                mask = D_WARNING;
+        last_count++;
+
         /* Add some margin, since there is a small race if other RPCs arrive
          * out-or-order and have already consumed some grant.  We want to
          * leave this here in case there is a large error in accounting. */
         /* Add some margin, since there is a small race if other RPCs arrive
          * out-or-order and have already consumed some grant.  We want to
          * leave this here in case there is a large error in accounting. */
-        CDEBUG(oa->o_grant > fed->fed_grant + FILTER_GRANT_CHUNK ?
-               D_WARNING : D_CACHE,
+        CDEBUG(oa->o_grant > fed->fed_grant + FILTER_GRANT_CHUNK ? mask:D_CACHE,
                "%s: cli %s/%p reports grant: "LPU64" dropped: %u, local: %lu\n",
                obd->obd_name, exp->exp_client_uuid.uuid, exp, oa->o_grant,
                oa->o_dropped, fed->fed_grant);
                "%s: cli %s/%p reports grant: "LPU64" dropped: %u, local: %lu\n",
                obd->obd_name, exp->exp_client_uuid.uuid, exp, oa->o_grant,
                oa->o_dropped, fed->fed_grant);
index 7158274..80cbedb 100644 (file)
@@ -1149,7 +1149,7 @@ static int ost_setup(struct obd_device *obd, obd_count len, void *buf)
         }
 
         rc = ptlrpc_start_n_threads(obd, ost->ost_create_service, 1,
         }
 
         rc = ptlrpc_start_n_threads(obd, ost->ost_create_service, 1,
-                                    "ll_ost_create");
+                                    "ll_ost_creat");
         if (rc)
                 GOTO(out_create, rc = -EINVAL);
 
         if (rc)
                 GOTO(out_create, rc = -EINVAL);
 
index 4ca4047..0aa183e 100644 (file)
@@ -8,7 +8,7 @@
 #define PORTAL_DEBUG
 
 #ifndef offsetof
 #define PORTAL_DEBUG
 
 #ifndef offsetof
-# define offsetof(typ,memb)     ((int)((char *)&(((typ *)0)->memb)))
+# define offsetof(typ,memb)     ((unsigned long)((char *)&(((typ *)0)->memb)))
 #endif
 
 #define LOWEST_BIT_SET(x)       ((x) & ~((x) - 1))
 #endif
 
 #define LOWEST_BIT_SET(x)       ((x) & ~((x) - 1))
@@ -647,7 +647,7 @@ enum {
         NAL_ENUM_END_MARKER
 };
 
         NAL_ENUM_END_MARKER
 };
 
-#define PTL_NALFMT_SIZE         16
+#define PTL_NALFMT_SIZE               26 /* %u:%u.%u.%u.%u (10+4+4+4+3+1) */
 
 #define NAL_MAX_NR (NAL_ENUM_END_MARKER - 1)
 
 
 #define NAL_MAX_NR (NAL_ENUM_END_MARKER - 1)
 
index 99d3877..5b1b8a5 100644 (file)
@@ -6,6 +6,8 @@
 
 #define PORTAL_DEBUG
 
 
 #define PORTAL_DEBUG
 
+/* I think this beast is just trying to get cycles_t and get_cycles().
+ * this should be in its own header. */
 #ifdef __linux__
 # include <asm/types.h>
 # if defined(__powerpc__) && !defined(__KERNEL__)
 #ifdef __linux__
 # include <asm/types.h>
 # if defined(__powerpc__) && !defined(__KERNEL__)
 #  include <asm/timex.h>
 #  undef __KERNEL__
 # else
 #  include <asm/timex.h>
 #  undef __KERNEL__
 # else
-#  include <asm/timex.h>
+#  if defined(__KERNEL__)
+#   include <asm/timex.h>
+#  else
+#   include <sys/time.h>
+#   define cycles_t unsigned long
+static inline cycles_t get_cycles(void) 
+{
+        struct timeval tv;
+        gettimeofday(&tv, NULL);
+        return (tv.tv_sec * 100000) + tv.tv_usec;
+}
+#  endif
 # endif
 #else
 # include <sys/types.h>
 # endif
 #else
 # include <sys/types.h>
@@ -29,7 +42,7 @@ typedef u_int64_t __u64;
 #endif
 
 #ifndef offsetof
 #endif
 
 #ifndef offsetof
-# define offsetof(typ,memb)     ((int)((char *)&(((typ *)0)->memb)))
+# define offsetof(typ,memb)     ((unsigned long)((char *)&(((typ *)0)->memb)))
 #endif
 
 #define LOWEST_BIT_SET(x)       ((x) & ~((x) - 1))
 #endif
 
 #define LOWEST_BIT_SET(x)       ((x) & ~((x) - 1))
index 34c263b..9ab4020 100644 (file)
@@ -60,14 +60,14 @@ extern int is_kernel_text_address(unsigned long addr);
 #endif
 
 #if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
 #endif
 
 #if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
-# define THREAD_NAME(comm, fmt, a...)                                   \
-        sprintf(comm, fmt "|%d", ## a, current->thread.extern_pid)
+# define THREAD_NAME(comm, len, fmt, a...)                              \
+        snprintf(comm, len, fmt "|%d", ## a, current->thread.extern_pid)
 #elif defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
 #elif defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-# define THREAD_NAME(comm, fmt, a...)                                   \
-        sprintf(comm, fmt "|%d", ## a, current->thread.mode.tt.extern_pid)
+# define THREAD_NAME(comm, len, fmt, a...)                              \
+        snprintf(comm, len,fmt"|%d", ## a,current->thread.mode.tt.extern_pid)
 #else
 #else
-# define THREAD_NAME(comm, fmt, a...)                                   \
-        sprintf(comm, fmt, ## a)
+# define THREAD_NAME(comm, len, fmt, a...)                              \
+        snprintf(comm, len, fmt, ## a)
 #endif
 
 #ifdef HAVE_PAGE_LIST
 #endif
 
 #ifdef HAVE_PAGE_LIST
index f3fdaaf..2af336e 100644 (file)
@@ -80,13 +80,15 @@ int jt_dbg_panic(int argc, char **argv);
 int ptl_set_cfg_record_cb(cfg_record_cb_t cb);
 
 /* l_ioctl.c */
 int ptl_set_cfg_record_cb(cfg_record_cb_t cb);
 
 /* l_ioctl.c */
-typedef int (ioc_handler_t)(int dev_id, int opc, void *buf);
+typedef int (ioc_handler_t)(int dev_id, unsigned int opc, void *buf);
 void set_ioc_handler(ioc_handler_t *handler);
 int register_ioc_dev(int dev_id, const char * dev_name);
 void unregister_ioc_dev(int dev_id);
 int set_ioctl_dump(char * file);
 void set_ioc_handler(ioc_handler_t *handler);
 int register_ioc_dev(int dev_id, const char * dev_name);
 void unregister_ioc_dev(int dev_id);
 int set_ioctl_dump(char * file);
-int l_ioctl(int dev_id, int opc, void *buf);
-int parse_dump(char * dump_file, int (*ioc_func)(int dev_id, int opc, void *));
+int l_ioctl(int dev_id, unsigned int opc, void *buf);
+int parse_dump(char * dump_file, ioc_handler_t ioc_func);
 int jt_ioc_dump(int argc, char **argv);
 int jt_ioc_dump(int argc, char **argv);
+extern char *dump_filename;
+int dump(int dev_id, unsigned int opc, void *buf);
 
 #endif
 
 #endif
index 519db0e..3a6508e 100644 (file)
@@ -968,18 +968,21 @@ char *portals_nid2str(int nal, ptl_nid_t nid, char *str)
         case TCPNAL:
                 /* userspace NAL */
         case SOCKNAL:
         case TCPNAL:
                 /* userspace NAL */
         case SOCKNAL:
-                snprintf(str, PTL_NALFMT_SIZE-1,
-                         "%u:%d.%d.%d.%d", (__u32)(nid >> 32), HIPQUAD(nid));
+                snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u.%u.%u.%u",
+                         (__u32)(nid >> 32), HIPQUAD(nid));
                 break;
         case QSWNAL:
         case GMNAL:
         case IBNAL:
         case SCIMACNAL:
                 break;
         case QSWNAL:
         case GMNAL:
         case IBNAL:
         case SCIMACNAL:
-                snprintf(str, PTL_NALFMT_SIZE-1, LPD64, nid);
+                snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u",
+                         (__u32)(nid >> 32), (__u32)nid);
                 break;
 #endif
         default:
                 break;
 #endif
         default:
-                snprintf(str, PTL_NALFMT_SIZE-1, "(?%llx)", (long long)nid);
+                snprintf(str, PTL_NALFMT_SIZE - 1, "?%d? %llx",
+                         nal, (long long)nid);
+                break;
         }
         return str;
 }
         }
         return str;
 }
index c1b2aec..c850f69 100644 (file)
@@ -62,16 +62,18 @@ extern char debug_daemon_file_path[1024];
 extern char portals_upcall[1024];
 
 #define PSDEV_PORTALS  (0x100)
 extern char portals_upcall[1024];
 
 #define PSDEV_PORTALS  (0x100)
-#define PSDEV_DEBUG           1   /* control debugging */
-#define PSDEV_SUBSYSTEM_DEBUG 2   /* control debugging */
-#define PSDEV_PRINTK          3   /* force all errors to console */
-#define PSDEV_CONSOLE         4   /* allow _any_ messages to console */
-#define PSDEV_DEBUG_PATH      5   /* crashdump log location */
-#define PSDEV_DEBUG_DUMP_PATH 6   /* crashdump tracelog location */
-#define PSDEV_PORTALS_UPCALL  7   /* User mode upcall script  */
-
-#define PORTALS_PRIMARY_CTLCNT 7
-static struct ctl_table portals_table[PORTALS_PRIMARY_CTLCNT + 1] = {
+enum {
+        PSDEV_DEBUG = 1,          /* control debugging */
+        PSDEV_SUBSYSTEM_DEBUG,    /* control debugging */
+        PSDEV_PRINTK,             /* force all errors to console */
+        PSDEV_CONSOLE,            /* allow _any_ messages to console */
+        PSDEV_DEBUG_PATH,         /* crashdump log location */
+        PSDEV_DEBUG_DUMP_PATH,    /* crashdump tracelog location */
+        PSDEV_PORTALS_UPCALL,     /* User mode upcall script  */
+        PSDEV_PORTALS_MEMUSED,    /* bytes currently PORTAL_ALLOCated */
+};
+
+static struct ctl_table portals_table[] = {
         {PSDEV_DEBUG, "debug", &portal_debug, sizeof(int), 0644, NULL,
          &proc_dointvec},
         {PSDEV_SUBSYSTEM_DEBUG, "subsystem_debug", &portal_subsystem_debug,
         {PSDEV_DEBUG, "debug", &portal_debug, sizeof(int), 0644, NULL,
          &proc_dointvec},
         {PSDEV_SUBSYSTEM_DEBUG, "subsystem_debug", &portal_subsystem_debug,
@@ -88,6 +90,8 @@ static struct ctl_table portals_table[PORTALS_PRIMARY_CTLCNT + 1] = {
         {PSDEV_PORTALS_UPCALL, "upcall", portals_upcall,
          sizeof(portals_upcall), 0644, NULL, &proc_dostring,
          &sysctl_string},
         {PSDEV_PORTALS_UPCALL, "upcall", portals_upcall,
          sizeof(portals_upcall), 0644, NULL, &proc_dostring,
          &sysctl_string},
+        {PSDEV_PORTALS_MEMUSED, "memused", (int *)&portal_kmemory.counter,
+         sizeof(int), 0644, NULL, &proc_dointvec},
         {0}
 };
 
         {0}
 };
 
index d2aad31..ae2da55 100644 (file)
@@ -183,9 +183,6 @@ static int applymask(char* procpath, int value)
         return 0;
 }
 
         return 0;
 }
 
-extern char *dump_filename;
-extern int dump(int dev_id, int opc, void *buf);
-
 static void applymask_all(unsigned int subs_mask, unsigned int debug_mask)
 {
         if (!dump_filename) {
 static void applymask_all(unsigned int subs_mask, unsigned int debug_mask)
 {
         if (!dump_filename) {
index 1adcc8e..0671c24 100644 (file)
@@ -56,7 +56,7 @@ static struct ioc_dev ioc_dev_list[10];
 struct dump_hdr {
        int magic;
        int dev_id;
 struct dump_hdr {
        int magic;
        int dev_id;
-       int opc;
+        unsigned int opc;
 };
 
 char *dump_filename;
 };
 
 char *dump_filename;
@@ -101,7 +101,7 @@ open_ioc_dev(int dev_id)
 
 
 static int 
 
 
 static int 
-do_ioctl(int dev_id, int opc, void *buf)
+do_ioctl(int dev_id, unsigned int opc, void *buf)
 {
        int fd, rc;
        
 {
        int fd, rc;
        
@@ -131,7 +131,7 @@ get_dump_file()
  * used, but for now it will assumed whatever app reads the file will
  * know what to do. */
 int 
  * used, but for now it will assumed whatever app reads the file will
  * know what to do. */
 int 
-dump(int dev_id, int opc, void *buf)
+dump(int dev_id, unsigned int opc, void *buf)
 {
        FILE *fp;
        struct dump_hdr dump_hdr;
 {
        FILE *fp;
        struct dump_hdr dump_hdr;
@@ -212,7 +212,7 @@ set_ioctl_dump(char * file)
 }
 
 int
 }
 
 int
-l_ioctl(int dev_id, int opc, void *buf)
+l_ioctl(int dev_id, unsigned int opc, void *buf)
 {
         return current_ioc_handler(dev_id, opc, buf);
 }
 {
         return current_ioc_handler(dev_id, opc, buf);
 }
@@ -226,7 +226,7 @@ l_ioctl(int dev_id, int opc, void *buf)
  * each device used in the dump.
  */
 int 
  * each device used in the dump.
  */
 int 
-parse_dump(char * dump_file, int (*ioc_func)(int dev_id, int opc, void *))
+parse_dump(char * dump_file, ioc_handler_t ioc_func)
 {
        int line =0;
        struct stat st;
 {
        int line =0;
        struct stat st;
index 859c5de..86b2da8 100644 (file)
@@ -373,7 +373,7 @@ __u64 ptl_nid2u64(ptl_nid_t nid)
         case 4:
                 return ((__u32)nid);
         default:
         case 4:
                 return ((__u32)nid);
         default:
-                fprintf(stderr, "Unexpected sizeof(ptl_nid_t) == %d\n", sizeof(nid));
+                fprintf(stderr, "Unexpected sizeof(ptl_nid_t) == %u\n", sizeof(nid));
                 abort();
                 /* notreached */
                 return (-1);
                 abort();
                 /* notreached */
                 return (-1);
@@ -1572,7 +1572,7 @@ lwt_print(FILE *f, cycles_t t0, cycles_t tlast, double mhz, int cpu, lwt_event_t
         if (where == NULL)
                 return (-1);
 
         if (where == NULL)
                 return (-1);
 
-        sprintf(whenstr, LPD64, e->lwte_when - t0);
+        sprintf(whenstr, LPU64, (__u64)(e->lwte_when - t0));
 
         fprintf(f, "%#010lx %#010lx %#010lx %#010lx: %#010lx %1d %10.6f %10.2f %s\n",
                 e->lwte_p1, e->lwte_p2, e->lwte_p3, e->lwte_p4,
 
         fprintf(f, "%#010lx %#010lx %#010lx %#010lx: %#010lx %1d %10.6f %10.2f %s\n",
                 e->lwte_p1, e->lwte_p2, e->lwte_p3, e->lwte_p4,
index a73a521..6316290 100644 (file)
@@ -34,7 +34,7 @@ do {                                                    \
 
 #define CHECK_MEMBER_OFFSET(s,m)                \
 do {                                            \
 
 #define CHECK_MEMBER_OFFSET(s,m)                \
 do {                                            \
-        CHECK_VALUE(offsetof(s, m));            \
+        CHECK_VALUE((int)offsetof(s, m));       \
 } while (0)
 
 #define CHECK_MEMBER_SIZEOF(s,m)                \
 } while (0)
 
 #define CHECK_MEMBER_SIZEOF(s,m)                \
index 0cbcff2..d17540c 100644 (file)
@@ -400,6 +400,13 @@ static int ptlrpc_check_reply(struct ptlrpc_request *req)
                 DEBUG_REQ(D_NET, req, "REPLIED:");
                 GOTO(out, rc = 1);
         }
                 DEBUG_REQ(D_NET, req, "REPLIED:");
                 GOTO(out, rc = 1);
         }
+        
+        if (req->rq_net_err && !req->rq_timedout) {
+                spin_unlock_irqrestore (&req->rq_lock, flags);
+                rc = ptlrpc_expire_one_request(req); 
+                spin_lock_irqsave (&req->rq_lock, flags);
+                GOTO(out, rc);
+        }
 
         if (req->rq_err) {
                 DEBUG_REQ(D_ERROR, req, "ABORTED:");
 
         if (req->rq_err) {
                 DEBUG_REQ(D_ERROR, req, "ABORTED:");
@@ -574,7 +581,7 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req)
         rc = ptl_send_rpc(req);
         if (rc) {
                 DEBUG_REQ(D_HA, req, "send failed (%d); expect timeout", rc);
         rc = ptl_send_rpc(req);
         if (rc) {
                 DEBUG_REQ(D_HA, req, "send failed (%d); expect timeout", rc);
-                req->rq_timeout = 1;
+                req->rq_net_err = 1;
                 RETURN(rc);
         }
         RETURN(0);
                 RETURN(rc);
         }
         RETURN(0);
@@ -616,6 +623,9 @@ int ptlrpc_check_set(struct ptlrpc_request_set *set)
                 if (req->rq_phase == RQ_PHASE_INTERPRET)
                         GOTO(interpret, req->rq_status);
 
                 if (req->rq_phase == RQ_PHASE_INTERPRET)
                         GOTO(interpret, req->rq_status);
 
+                if (req->rq_net_err && !req->rq_timedout)
+                        ptlrpc_expire_one_request(req); 
+
                 if (req->rq_err) {
                         ptlrpc_unregister_reply(req);
                         if (req->rq_status == 0)
                 if (req->rq_err) {
                         ptlrpc_unregister_reply(req);
                         if (req->rq_status == 0)
@@ -651,13 +661,9 @@ int ptlrpc_check_set(struct ptlrpc_request_set *set)
                         if (req->rq_waiting || req->rq_resend) {
                                 int status;
 
                         if (req->rq_waiting || req->rq_resend) {
                                 int status;
 
-                                LASSERT (!ptlrpc_client_receiving_reply(req));
-                                LASSERT (req->rq_bulk == NULL ||
-                                         !ptlrpc_bulk_active(req->rq_bulk));
-
                                 spin_lock_irqsave(&imp->imp_lock, flags);
 
                                 spin_lock_irqsave(&imp->imp_lock, flags);
 
-                                if (ptlrpc_import_delay_req(imp, req, &status)) {
+                                if (ptlrpc_import_delay_req(imp, req, &status)){
                                         spin_unlock_irqrestore(&imp->imp_lock,
                                                                flags);
                                         continue;
                                         spin_unlock_irqrestore(&imp->imp_lock,
                                                                flags);
                                         continue;
@@ -691,6 +697,8 @@ int ptlrpc_check_set(struct ptlrpc_request_set *set)
                                         if (req->rq_bulk) {
                                                 __u64 old_xid = req->rq_xid;
 
                                         if (req->rq_bulk) {
                                                 __u64 old_xid = req->rq_xid;
 
+                                                ptlrpc_unregister_bulk (req);
+
                                                 /* ensure previous bulk fails */
                                                 req->rq_xid = ptlrpc_next_xid();
                                                 CDEBUG(D_HA, "resend bulk "
                                                 /* ensure previous bulk fails */
                                                 req->rq_xid = ptlrpc_next_xid();
                                                 CDEBUG(D_HA, "resend bulk "
@@ -705,7 +713,7 @@ int ptlrpc_check_set(struct ptlrpc_request_set *set)
                                         DEBUG_REQ(D_HA, req, "send failed (%d)",
                                                   rc);
                                         force_timer_recalc = 1;
                                         DEBUG_REQ(D_HA, req, "send failed (%d)",
                                                   rc);
                                         force_timer_recalc = 1;
-                                        req->rq_timeout = 0;
+                                        req->rq_net_err = 1;
                                 }
                                 /* need to reset the timeout */
                                 force_timer_recalc = 1;
                                 }
                                 /* need to reset the timeout */
                                 force_timer_recalc = 1;
@@ -1195,6 +1203,7 @@ void ptlrpc_resend_req(struct ptlrpc_request *req)
 
         spin_lock_irqsave (&req->rq_lock, flags);
         req->rq_resend = 1;
 
         spin_lock_irqsave (&req->rq_lock, flags);
         req->rq_resend = 1;
+        req->rq_net_err = 0;
         req->rq_timedout = 0;
         if (req->rq_bulk) {
                 __u64 old_xid = req->rq_xid;
         req->rq_timedout = 0;
         if (req->rq_bulk) {
                 __u64 old_xid = req->rq_xid;
index cd35bd3..a5ec4f1 100644 (file)
@@ -64,7 +64,7 @@ void request_out_callback(ptl_event_t *ev)
                  * like failing sends in client.c does currently...  */
 
                 spin_lock_irqsave(&req->rq_lock, flags);
                  * like failing sends in client.c does currently...  */
 
                 spin_lock_irqsave(&req->rq_lock, flags);
-                req->rq_timeout = 0;
+                req->rq_net_err = 1;
                 spin_unlock_irqrestore(&req->rq_lock, flags);
                 
                 ptlrpc_wake_client_req(req);
                 spin_unlock_irqrestore(&req->rq_lock, flags);
                 
                 ptlrpc_wake_client_req(req);
index 55d8e9c..b628216 100644 (file)
@@ -446,6 +446,7 @@ int ptl_send_rpc(struct ptlrpc_request *request)
         request->rq_replied = 0;
         request->rq_err = 0;
         request->rq_timedout = 0;
         request->rq_replied = 0;
         request->rq_err = 0;
         request->rq_timedout = 0;
+        request->rq_net_err = 0;
         request->rq_resend = 0;
         request->rq_restart = 0;
         spin_unlock_irqrestore (&request->rq_lock, flags);
         request->rq_resend = 0;
         request->rq_restart = 0;
         spin_unlock_irqrestore (&request->rq_lock, flags);
index 5641f63..c6d5c84 100644 (file)
@@ -80,7 +80,9 @@ static int ptlrpc_pinger_main(void *arg)
         RECALC_SIGPENDING;
         SIGNAL_MASK_UNLOCK(current, flags);
 
         RECALC_SIGPENDING;
         SIGNAL_MASK_UNLOCK(current, flags);
 
-        THREAD_NAME(current->comm, "%s", data->name);
+        LASSERTF(strlen(data->name) < sizeof(current->comm),
+                 "name %d > len %d\n",strlen(data->name),sizeof(current->comm));
+        THREAD_NAME(current->comm, sizeof(current->comm) - 1, "%s", data->name);
         unlock_kernel();
 
         /* Record that the thread is running */
         unlock_kernel();
 
         /* Record that the thread is running */
index 3d66eae..490dc36 100644 (file)
@@ -232,8 +232,8 @@ static int log_commit_thread(void *arg)
         SIGNAL_MASK_UNLOCK(current, flags);
 
         spin_lock(&lcm->lcm_thread_lock);
         SIGNAL_MASK_UNLOCK(current, flags);
 
         spin_lock(&lcm->lcm_thread_lock);
-        THREAD_NAME(current->comm, "ll_log_commit_%d",
-                    atomic_read(&lcm->lcm_thread_total));
+        THREAD_NAME(current->comm, sizeof(current->comm) - 1,
+                    "ll_log_comt_%02d", atomic_read(&lcm->lcm_thread_total));
         atomic_inc(&lcm->lcm_thread_total);
         spin_unlock(&lcm->lcm_thread_lock);
         unlock_kernel();
         atomic_inc(&lcm->lcm_thread_total);
         spin_unlock(&lcm->lcm_thread_lock);
         unlock_kernel();
index 1123821..bd0bb45 100644 (file)
@@ -667,7 +667,9 @@ static int ptlrpc_main(void *arg)
         RECALC_SIGPENDING;
         SIGNAL_MASK_UNLOCK(current, flags);
 
         RECALC_SIGPENDING;
         SIGNAL_MASK_UNLOCK(current, flags);
 
-        THREAD_NAME(current->comm, "%s", data->name);
+        LASSERTF(strlen(data->name) < sizeof(current->comm),
+                 "name %d > len %d\n",strlen(data->name),sizeof(current->comm));
+        THREAD_NAME(current->comm, sizeof(current->comm) - 1, "%s", data->name);
         unlock_kernel();
 
         /* Record that the thread is running */
         unlock_kernel();
 
         /* Record that the thread is running */
@@ -747,7 +749,7 @@ static void ptlrpc_stop_thread(struct ptlrpc_service *svc,
         spin_lock_irqsave(&svc->srv_lock, flags);
         list_del(&thread->t_link);
         spin_unlock_irqrestore(&svc->srv_lock, flags);
         spin_lock_irqsave(&svc->srv_lock, flags);
         list_del(&thread->t_link);
         spin_unlock_irqrestore(&svc->srv_lock, flags);
-        
+
         OBD_FREE(thread, sizeof(*thread));
 }
 
         OBD_FREE(thread, sizeof(*thread));
 }
 
@@ -758,7 +760,7 @@ void ptlrpc_stop_all_threads(struct ptlrpc_service *svc)
 
         spin_lock_irqsave(&svc->srv_lock, flags);
         while (!list_empty(&svc->srv_threads)) {
 
         spin_lock_irqsave(&svc->srv_lock, flags);
         while (!list_empty(&svc->srv_threads)) {
-                thread = list_entry(svc->srv_threads.next, 
+                thread = list_entry(svc->srv_threads.next,
                                     struct ptlrpc_thread, t_link);
 
                 spin_unlock_irqrestore(&svc->srv_lock, flags);
                                     struct ptlrpc_thread, t_link);
 
                 spin_unlock_irqrestore(&svc->srv_lock, flags);
@@ -769,6 +771,7 @@ void ptlrpc_stop_all_threads(struct ptlrpc_service *svc)
         spin_unlock_irqrestore(&svc->srv_lock, flags);
 }
 
         spin_unlock_irqrestore(&svc->srv_lock, flags);
 }
 
+/* @base_name should be 12 characters or less - 3 will be added on */
 int ptlrpc_start_n_threads(struct obd_device *dev, struct ptlrpc_service *svc,
                            int num_threads, char *base_name)
 {
 int ptlrpc_start_n_threads(struct obd_device *dev, struct ptlrpc_service *svc,
                            int num_threads, char *base_name)
 {
index 275e52f..4df0fc1 100644 (file)
@@ -62,3 +62,4 @@ XMLCONFIG
 logs
 ostactive
 ll_dirstripe_verify
 logs
 ostactive
 ll_dirstripe_verify
+openfilleddirunlink
index f313234..97cbeee 100644 (file)
@@ -19,7 +19,7 @@ noinst_PROGRAMS += stat createmany statmany multifstat createtest mlink utime cm
 noinst_PROGRAMS += opendirunlink opendevunlink unlinkmany fchdir_test checkstat
 noinst_PROGRAMS += wantedi statone runas openfile getdents mkdirdeep o_directory
 noinst_PROGRAMS += small_write multiop sleeptest ll_sparseness_verify
 noinst_PROGRAMS += opendirunlink opendevunlink unlinkmany fchdir_test checkstat
 noinst_PROGRAMS += wantedi statone runas openfile getdents mkdirdeep o_directory
 noinst_PROGRAMS += small_write multiop sleeptest ll_sparseness_verify
-noinst_PROGRAMS += ll_sparseness_write mrename ll_dirstripe_verify
+noinst_PROGRAMS += ll_sparseness_write mrename ll_dirstripe_verify openfilleddirunlink
 # noinst_PROGRAMS += ldaptest
 bin_PROGRAMS = mcreate munlink mkdirmany iopentest1 iopentest2
 endif # TESTS
 # noinst_PROGRAMS += ldaptest
 bin_PROGRAMS = mcreate munlink mkdirmany iopentest1 iopentest2
 endif # TESTS
@@ -56,6 +56,7 @@ wantedi_SOURCES = wantedi.c
 createtest_SOURCES = createtest.c
 open_delay_SOURCES = open_delay.c
 opendirunlink_SOURCES = opendirunlink.c
 createtest_SOURCES = createtest.c
 open_delay_SOURCES = open_delay.c
 opendirunlink_SOURCES = opendirunlink.c
+openfilleddirunlink_SOURCES = openfilleddirunlink.c
 opendevunlink_SOURCES = opendevunlink.c
 fchdir_test_SOURCES = fchdir_test.c
 getdents_SOURCES=getdents.c
 opendevunlink_SOURCES = opendevunlink.c
 fchdir_test_SOURCES = fchdir_test.c
 getdents_SOURCES=getdents.c
index abe38c8..f10da1d 100755 (executable)
@@ -164,3 +164,7 @@ fi
 if [ "$REPLAY_OST_SINGLE" != "no" ]; then
         sh replay-ost-single.sh
 fi
 if [ "$REPLAY_OST_SINGLE" != "no" ]; then
         sh replay-ost-single.sh
 fi
+
+if [ "$INSANITY" != "no" ]; then
+        sh insanity.sh -r
+fi
diff --git a/lustre/tests/mount2.sh b/lustre/tests/mount2.sh
deleted file mode 100644 (file)
index eaed7e3..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-
-config=${1:-mount2.xml}
-
-SRCDIR=`dirname $0`
-PATH=$SRCDIR:$SRCDIR/../utils:$PATH
-LMC="${LMC:-lmc} -m $config"
-TMP=${TMP:-/tmp}
-
-MDSDEV=${MDSDEV:-$TMP/mds1-`hostname`}
-MDSSIZE=${MDSSIZE:-50000}
-MOUNT=${MOUNT:-/mnt/lustre}
-MOUNT1=${MOUNT1:-${MOUNT}1}
-MOUNT2=${MOUNT2:-${MOUNT}2}
-FSTYPE=${FSTYPE:-ext3}
-
-OSTDEV=${OSTDEV:-$TMP/ost1-`hostname`}
-OSTSIZE=${OSTSIZE:-200000}
-
-rm -f $config
-
-# create nodes
-${LMC} --add node --node localhost || exit 10
-${LMC} --add net --node  localhost --nid localhost --nettype tcp || exit 11
-
-# configure mds server
-${LMC} --add mds  --node localhost --mds mds1 --fstype $FSTYPE --dev $MDSDEV --size $MDSSIZE || exit 20
-
-# configure ost
-${LMC} --add ost --node localhost --ost ost1 --fstype $FSTYPE --dev $OSTDEV --size  $OSTSIZE || exit 30
-
-# create client config
-${LMC} --add mtpt --node localhost --path $MOUNT1 --mds mds1 --ost ost1 || exit 40
-${LMC} --add mtpt --node localhost --path $MOUNT2 --mds mds1 --ost ost1 || exit 40
diff --git a/lustre/tests/mount2lov.sh b/lustre/tests/mount2lov.sh
deleted file mode 100644 (file)
index 1840d19..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/bash
-
-config=${1:-mount2.xml}
-
-SRCDIR=`dirname $0`
-PATH=$SRCDIR:$SRCDIR/../utils:$PATH
-LMC="${LMC:-lmc} -m $config"
-TMP=${TMP:-/tmp}
-
-MDSDEV=${MDSDEV:-$TMP/mds1-`hostname`}
-MDSSIZE=${MDSSIZE:-50000}
-FSTYPE=${FSTYPE:-ext3}
-
-OSTDEV1=${OSTDEV1:-$TMP/ost1-`hostname`}
-OSTDEV2=${OSTDEV2:-$TMP/ost2-`hostname`}
-OSTDEV3=${OSTDEV3:-$TMP/ost3-`hostname`}
-OSTSIZE=${OSTSIZE:-100000}
-
-STRIPE_BYTES=65536
-STRIPES_PER_OBJ=2      # 0 means stripe over all OSTs
-
-rm -f $config
-
-# create nodes
-${LMC} --add net --node  localhost --nid localhost --nettype tcp || exit 1
-
-# configure MDS server
-${LMC} --add mds  --node localhost --mds mds1 --fstype $FSTYPE --dev $MDSDEV --size $MDSSIZE || exit 10
-
-# configure OSTs
-${LMC} --add lov --lov lov1 --mds mds1 --stripe_sz $STRIPE_BYTES --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0 || exit 20
-${LMC} --add ost --node localhost --lov lov1 --fstype $FSTYPE --dev $OSTDEV1 --size $OSTSIZE || exit 21
-${LMC} --add ost --node localhost --lov lov1 --fstype $FSTYPE --dev $OSTDEV2 --size $OSTSIZE || exit 22
-${LMC} --add ost --node localhost --lov lov1 --fstype $FSTYPE --dev $OSTDEV3 --size $OSTSIZE || exit 23
-
-# create client config
-${LMC} --add mtpt --node localhost --path /mnt/lustre1 --mds mds1 --ost lov1 || exit 40
-${LMC} --add mtpt --node localhost --path /mnt/lustre2 --mds mds1 --ost lov1 || exit 41
index 0402aff..c8ac394 100755 (executable)
@@ -204,12 +204,22 @@ int main(int argc, char **argv)
                                 exit(1);
                         }
                         break;
                                 exit(1);
                         }
                         break;
-                case 'w':
-                        if (write(fd, "w", 1) == -1) {
+                case 'w': {
+                        int rc;
+                        if ((rc = write(fd, "w", 1)) == -1) {
                                 perror("write");
                                 exit(1);
                         }
                                 perror("write");
                                 exit(1);
                         }
+                        /* b=3043 write() on Suse x86-64 is returning -errno 
+                           instead of -1, and not setting errno. */
+                        if (rc < 0) {
+                                fprintf(stderr, "MULTIOP: broken write() "
+                                        "returned %d, errno %d\n",
+                                        rc, errno);
+                                exit(1);
+                        }
                         break;
                         break;
+                }
                 case 'W':
                         for (i = 0; i < mmap_len && mmap_ptr; i += 4096)
                                 mmap_ptr[i] += junk++;
                 case 'W':
                         for (i = 0; i < mmap_len && mmap_ptr; i += 4096)
                                 mmap_ptr[i] += junk++;
diff --git a/lustre/tests/openfilleddirunlink.c b/lustre/tests/openfilleddirunlink.c
new file mode 100644 (file)
index 0000000..6c7707f
--- /dev/null
@@ -0,0 +1,79 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+
+/* for O_DIRECTORY */
+#define _GNU_SOURCE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <string.h>
+
+char fname[1024];
+
+
+int main(int argc, char **argv)
+{
+        char *dname1;
+        int fddir1, rc;
+        int fd;
+
+        if (argc != 2) {
+                fprintf(stderr, "usage: %s dirname1\n", argv[0]);
+                exit(1);
+        }
+
+        dname1 = argv[1];
+
+        //create the directory
+        fprintf(stderr, "creating directory %s\n", dname1);
+        rc = mkdir(dname1, 0744);
+        if (rc == -1) {
+                fprintf(stderr, "creating %s fails: %s\n",
+                        dname1, strerror(errno));
+                exit(1);
+        }
+
+        sprintf(fname, "%s/0", dname1);
+        fprintf(stderr, "creating file %s\n", fname);
+        fd = creat(fname, 0666);
+        if (fd < 0) {
+                fprintf(stderr, "creation %s fails: %s\n",
+                        fname, strerror(errno));
+                exit(1);
+        }
+        close(fd);
+
+        // open the dir again
+        fprintf(stderr, "opening directory\n");
+        fddir1 = open(dname1, O_RDONLY | O_DIRECTORY);
+        if (fddir1 == -1) {
+                fprintf(stderr, "open %s fails: %s\n",
+                        dname1, strerror(errno));
+                exit(1);
+        }
+
+        // delete the dir
+        fprintf(stderr, "unlinking %s\n", dname1);
+        rc = rmdir(dname1);
+        if (rc == 0) {
+                fprintf(stderr, "unlinked non-empty %s successfully\n",
+                        dname1);
+                exit(1);
+        }
+
+        if (access(dname1, F_OK) != 0){
+                fprintf(stderr, "can't access %s: %s\n",
+                        dname1, strerror(errno));
+                exit(1);
+        }
+
+        fprintf(stderr, "Ok, everything goes well.\n");
+        return 0;
+}
index bb41aaa..d0dd6f0 100755 (executable)
@@ -217,6 +217,8 @@ test_16() {
     # will get evicted here
     do_facet client "cmp /etc/termcap $MOUNT/termcap"  && return 1
     sysctl -w lustre.fail_loc=0
     # will get evicted here
     do_facet client "cmp /etc/termcap $MOUNT/termcap"  && return 1
     sysctl -w lustre.fail_loc=0
+    # give recovery a chance to finish (shouldn't take long)
+    sleep 1 
     do_facet client "cmp /etc/termcap $MOUNT/termcap"  || return 2
 }
 run_test 16 "timeout bulk put, evict client (2732)"
     do_facet client "cmp /etc/termcap $MOUNT/termcap"  || return 2
 }
 run_test 16 "timeout bulk put, evict client (2732)"
@@ -321,12 +323,10 @@ test_20a() {      # bug 2983 - ldlm_handle_enqueue cleanup
        cancel_lru_locks OSC
 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
        do_facet ost sysctl -w lustre.fail_loc=0x80000308
        cancel_lru_locks OSC
 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
        do_facet ost sysctl -w lustre.fail_loc=0x80000308
-       set -vx
        kill -USR1 $MULTI_PID
        wait $MULTI_PID
        rc=$?
        [ $rc -eq 0 ] && error "multiop didn't fail enqueue: rc $rc" || true
        kill -USR1 $MULTI_PID
        wait $MULTI_PID
        rc=$?
        [ $rc -eq 0 ] && error "multiop didn't fail enqueue: rc $rc" || true
-       set +vx
 }
 run_test 20a "ldlm_handle_enqueue error (should return error)" 
 
 }
 run_test 20a "ldlm_handle_enqueue error (should return error)" 
 
index e9b34ea..fbf8d19 100755 (executable)
@@ -379,6 +379,7 @@ test_18() {
     sleep 1 
     rm -f $DIR/$tfile
     touch $DIR/$tfile-2 || return 1
     sleep 1 
     rm -f $DIR/$tfile
     touch $DIR/$tfile-2 || return 1
+    echo "pid: $pid will close"
     kill -USR1 $pid
     wait $pid || return 2
 
     kill -USR1 $pid
     wait $pid || return 2
 
@@ -836,7 +837,7 @@ test_42() {
     echo wait for MDS to timeout and recover
     sleep $((TIMEOUT * 2))
     unlinkmany $DIR/$tfile-%d 400 400
     echo wait for MDS to timeout and recover
     sleep $((TIMEOUT * 2))
     unlinkmany $DIR/$tfile-%d 400 400
-    $CHECKSTAT -t file $DIR/$tfile-* && return 1 || true
+    $CHECKSTAT -t file $DIR/$tfile-* && return 2 || true
 }
 run_test 42 "recovery after ost failure"
 
 }
 run_test 42 "recovery after ost failure"
 
@@ -866,6 +867,30 @@ test_44() {
 }
 run_test 44 "race in target handle connect"
 
 }
 run_test 44 "race in target handle connect"
 
+# Handle failed close
+test_45() {
+    mdcdev=`awk '/mds_svc_MNT/ {print $1}' < /proc/fs/lustre/devices`
+    $LCTL --device $mdcdev recover
+
+    multiop $DIR/$tfile O_c &
+    pid=$!
+    sleep 1
+
+    # This will cause the CLOSE to fail before even 
+    # allocating a reply buffer
+    $LCTL --device $mdcdev deactivate
+
+    # try the close
+    kill -USR1 $pid
+    wait $pid || return 1
+
+    $LCTL --device $mdcdev activate
+
+    $CHECKSTAT -t file $DIR/$tfile || return 2
+    return 0
+}
+run_test 45 "Handle failed close"
+
 equals_msg test complete, cleaning up
 $CLEANUP
 
 equals_msg test complete, cleaning up
 $CLEANUP
 
index b5cc8be..6b15107 100644 (file)
@@ -869,6 +869,11 @@ test_31d() {
 }
 run_test 31d "remove of open directory ========================="
 
 }
 run_test 31d "remove of open directory ========================="
 
+test_31e() {
+       openfilleddirunlink $DIR/d31e || error
+}
+run_test 31e "remove of open non-removable directory ========================="
+
 test_32a() {
        echo "== more mountpoints and symlinks ================="
        [ -e $DIR/d32a ] && rm -fr $DIR/d32a
 test_32a() {
        echo "== more mountpoints and symlinks ================="
        [ -e $DIR/d32a ] && rm -fr $DIR/d32a
index 4d99771..f27957d 100644 (file)
@@ -145,6 +145,9 @@ void print_human_fstype(struct statfs *statfsbuf)
        case S_MAGIC_ROMFS:
          type = strdup("romfs");
          break;
        case S_MAGIC_ROMFS:
          type = strdup("romfs");
          break;
+       case S_MAGIC_LUSTRE:
+         type = strdup("lustre");
+         break;
 #elif __GNU__
         case FSTYPE_UFS:
           type = strdup("ufs");
 #elif __GNU__
         case FSTYPE_UFS:
           type = strdup("ufs");
@@ -293,17 +296,17 @@ void print_human_access(struct stat *statbuf)
 /* trick gcc into being unable to recognize the %c format so it doesn't
  * issue its inane warning about %c and two-digit year representations. */
 static size_t strftime_wrapper(char *s, size_t max, const char *fmt,
 /* trick gcc into being unable to recognize the %c format so it doesn't
  * issue its inane warning about %c and two-digit year representations. */
 static size_t strftime_wrapper(char *s, size_t max, const char *fmt,
-                               struct tm *tm) {
+                              struct tm *tm) {
        return strftime(s, max, fmt, tm);
 }
 
 void print_human_time(time_t *t)
 {
   char str[40];
        return strftime(s, max, fmt, tm);
 }
 
 void print_human_time(time_t *t)
 {
   char str[40];
-  
-  if (strftime_wrapper(str, 40, "%c", localtime(t)) > 0) 
+
+  if (strftime_wrapper(str, 40, "%c", localtime(t)) > 0)
          printf(str);
          printf(str);
-  else 
+  else
          printf("Cannot calculate human readable time, sorry");
 }
 
          printf("Cannot calculate human readable time, sorry");
 }
 
@@ -316,7 +319,7 @@ void print_statfs(char *pformat, char m, char *filename, void *data, SECURITY_ID
     int rv;
     unsigned int sbuflen = sizeof(sbuf);
 #endif
     int rv;
     unsigned int sbuflen = sizeof(sbuf);
 #endif
-    
+
     switch(m) {
        case 'n':
            strcat(pformat, "s");
     switch(m) {
        case 'n':
            strcat(pformat, "s");
index a07fc12..c5fa3b4 100644 (file)
@@ -31,6 +31,7 @@
 #define S_MAGIC_REISERFS        0x52654973
 #define S_MAGIC_CRAMFS          0x28cd3d45
 #define S_MAGIC_ROMFS           0x7275
 #define S_MAGIC_REISERFS        0x52654973
 #define S_MAGIC_CRAMFS          0x28cd3d45
 #define S_MAGIC_ROMFS           0x7275
+#define S_MAGIC_LUSTRE          0x0BD00BD0
 #elif defined (__GNU__)
 #include <hurd/hurd_types.h>
 #endif
 #elif defined (__GNU__)
 #include <hurd/hurd_types.h>
 #endif
index adb957d..791b523 100644 (file)
@@ -39,6 +39,7 @@ init_test_env() {
     export LMC=${LMC:-"lmc"}
     export LCTL=${LCTL:-"$LUSTRE/utils/lctl"}
     export CHECKSTAT="${CHECKSTAT:-checkstat} "
     export LMC=${LMC:-"lmc"}
     export LCTL=${LCTL:-"$LUSTRE/utils/lctl"}
     export CHECKSTAT="${CHECKSTAT:-checkstat} "
+    export FSYTPE=${FSTYPE:-"ext3"}
 
     # Paths on remote nodes, if different 
     export RLUSTRE=${RLUSTRE:-$LUSTRE}
 
     # Paths on remote nodes, if different 
     export RLUSTRE=${RLUSTRE:-$LUSTRE}
@@ -297,14 +298,14 @@ add_mds() {
     shift
     rm -f ${facet}active
     add_facet $facet
     shift
     rm -f ${facet}active
     add_facet $facet
-    do_lmc --add mds --node ${facet}_facet --mds ${facet}_svc $*
+    do_lmc --add mds --node ${facet}_facet --mds ${facet}_svc --fstype $FSTYPE $*
 }
 
 add_mdsfailover() {
     facet=$1
     shift
     add_facet ${facet}failover  --lustre_upcall $UPCALL
 }
 
 add_mdsfailover() {
     facet=$1
     shift
     add_facet ${facet}failover  --lustre_upcall $UPCALL
-    do_lmc --add mds  --node ${facet}failover_facet --mds ${facet}_svc $*
+    do_lmc --add mds  --node ${facet}failover_facet --mds ${facet}_svc --fstype $FSTYPE $*
 }
 
 add_ost() {
 }
 
 add_ost() {
@@ -312,14 +313,14 @@ add_ost() {
     shift
     rm -f ${facet}active
     add_facet $facet
     shift
     rm -f ${facet}active
     add_facet $facet
-    do_lmc --add ost --node ${facet}_facet --ost ${facet}_svc $*
+    do_lmc --add ost --node ${facet}_facet --ost ${facet}_svc --fstype $FSTYPE $*
 }
 
 add_ostfailover() {
     facet=$1
     shift
     add_facet ${facet}failover
 }
 
 add_ostfailover() {
     facet=$1
     shift
     add_facet ${facet}failover
-    do_lmc --add ost --failover --node ${facet}failover_facet --ost ${facet}_svc $*
+    do_lmc --add ost --failover --node ${facet}failover_facet --ost ${facet}_svc --fstype $FSTYPE $*
 }
 
 add_lov() {
 }
 
 add_lov() {
index a8c9e6e..3ac52de 100644 (file)
@@ -70,7 +70,7 @@ update_mtab_entry(char *spec, char *node, char *type, char *opts,
 int
 init_options(struct lustre_mount_data *lmd)
 {
 int
 init_options(struct lustre_mount_data *lmd)
 {
-        memset(lmd, 0, sizeof(lmd));
+        memset(lmd, 0, sizeof(*lmd));
         lmd->lmd_magic = LMD_MAGIC;
         lmd->lmd_server_nid = PTL_NID_ANY;
         lmd->lmd_local_nid = PTL_NID_ANY;
         lmd->lmd_magic = LMD_MAGIC;
         lmd->lmd_server_nid = PTL_NID_ANY;
         lmd->lmd_local_nid = PTL_NID_ANY;
index e1ca25e..f4c576e 100644 (file)
@@ -36,7 +36,7 @@ do {                                                            \
 
 #define CHECK_MEMBER_OFFSET(s,m)                                \
 do {                                                            \
 
 #define CHECK_MEMBER_OFFSET(s,m)                                \
 do {                                                            \
-        CHECK_VALUE(offsetof(struct s, m));                     \
+        CHECK_VALUE((int)offsetof(struct s, m));                \
 } while(0)
 
 #define CHECK_MEMBER_SIZEOF(s,m)                                \
 } while(0)
 
 #define CHECK_MEMBER_SIZEOF(s,m)                                \