diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-suse.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-suse.series index 65e8dcdfa2b5969610649412ab8e78c4b433a10b..cff99dd4218917f2e0de667d7672fb688d9ae052 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-suse.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-suse.series @@ -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 @@ -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-xattr-header-move-2.6.suse.patch diff --git a/lnet/include/linux/kp30.h b/lnet/include/linux/kp30.h index 4ca40473b91cb370ddfea364be2486eebdda3d0d..0aa183e48dd3dd22c6b4db74b9d1ab5faf31bcba 100644 --- a/lnet/include/linux/kp30.h +++ b/lnet/include/linux/kp30.h @@ -8,7 +8,7 @@ #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)) @@ -647,7 +647,7 @@ enum { 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) diff --git a/lnet/include/linux/libcfs.h b/lnet/include/linux/libcfs.h index 99d3877059f0caeaf08fdb34c67bb9f788b8b382..5b1b8a5f628c75513f76ace1920b989f94a0d732 100644 --- a/lnet/include/linux/libcfs.h +++ b/lnet/include/linux/libcfs.h @@ -6,6 +6,8 @@ #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__) @@ -13,7 +15,18 @@ # 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> @@ -29,7 +42,7 @@ typedef u_int64_t __u64; #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)) diff --git a/lnet/include/linux/portals_compat25.h b/lnet/include/linux/portals_compat25.h index 34c263bcefc9f852d687e643b51d5d5fc249a3fe..9ab4020706df65a5c07ea658a6e8a685527c6a81 100644 --- a/lnet/include/linux/portals_compat25.h +++ b/lnet/include/linux/portals_compat25.h @@ -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)) -# 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)) -# 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 -# 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 diff --git a/lnet/include/lnet/lnetctl.h b/lnet/include/lnet/lnetctl.h index f3fdaafedcfe0f0f59c140bd66011b8e1e3f8a52..2af336ec63ede943fb9591ec221456534313c391 100644 --- a/lnet/include/lnet/lnetctl.h +++ b/lnet/include/lnet/lnetctl.h @@ -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 */ -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); -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); +extern char *dump_filename; +int dump(int dev_id, unsigned int opc, void *buf); #endif diff --git a/lnet/include/lnet/ptlctl.h b/lnet/include/lnet/ptlctl.h index f3fdaafedcfe0f0f59c140bd66011b8e1e3f8a52..2af336ec63ede943fb9591ec221456534313c391 100644 --- a/lnet/include/lnet/ptlctl.h +++ b/lnet/include/lnet/ptlctl.h @@ -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 */ -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); -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); +extern char *dump_filename; +int dump(int dev_id, unsigned int opc, void *buf); #endif diff --git a/lnet/libcfs/debug.c b/lnet/libcfs/debug.c index 519db0e7dceb7a84018fb2319cf006496075dc21..3a6508eeed71895f7cb828fa3ca2c880799e1f82 100644 --- a/lnet/libcfs/debug.c +++ b/lnet/libcfs/debug.c @@ -968,18 +968,21 @@ char *portals_nid2str(int nal, ptl_nid_t nid, char *str) 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: - snprintf(str, PTL_NALFMT_SIZE-1, LPD64, nid); + snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u", + (__u32)(nid >> 32), (__u32)nid); 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; } diff --git a/lnet/libcfs/proc.c b/lnet/libcfs/proc.c index c1b2aecb15bba6d28ccc2162d704c01e378ca176..c850f690fda5ef4c410498acd7d184f6927ab56c 100644 --- a/lnet/libcfs/proc.c +++ b/lnet/libcfs/proc.c @@ -62,16 +62,18 @@ extern char debug_daemon_file_path[1024]; 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, @@ -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_MEMUSED, "memused", (int *)&portal_kmemory.counter, + sizeof(int), 0644, NULL, &proc_dointvec}, {0} }; diff --git a/lnet/utils/debug.c b/lnet/utils/debug.c index d2aad31193a1137eba758c6a60cd5312291d82fe..ae2da55f905728bf1e15beb1f20ddc76bfb2e3c0 100644 --- a/lnet/utils/debug.c +++ b/lnet/utils/debug.c @@ -183,9 +183,6 @@ static int applymask(char* procpath, int value) 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) { diff --git a/lnet/utils/l_ioctl.c b/lnet/utils/l_ioctl.c index 1adcc8eb88d2aee269fdbf4eb71640bf3517bbf1..0671c241a31648b45a3ba0a4aea2dca0e5d476ac 100644 --- a/lnet/utils/l_ioctl.c +++ b/lnet/utils/l_ioctl.c @@ -56,7 +56,7 @@ static struct ioc_dev ioc_dev_list[10]; struct dump_hdr { int magic; int dev_id; - int opc; + unsigned int opc; }; char *dump_filename; @@ -101,7 +101,7 @@ open_ioc_dev(int dev_id) static int -do_ioctl(int dev_id, int opc, void *buf) +do_ioctl(int dev_id, unsigned int opc, void *buf) { 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 -dump(int dev_id, int opc, void *buf) +dump(int dev_id, unsigned int opc, void *buf) { FILE *fp; struct dump_hdr dump_hdr; @@ -212,7 +212,7 @@ set_ioctl_dump(char * file) } 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); } @@ -226,7 +226,7 @@ l_ioctl(int dev_id, int opc, void *buf) * 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; diff --git a/lnet/utils/portals.c b/lnet/utils/portals.c index 859c5deb1f7c224d536f2d928140ee424df731cc..86b2da896c4e00c4130a6094d69e91ac9957a5f6 100644 --- a/lnet/utils/portals.c +++ b/lnet/utils/portals.c @@ -373,7 +373,7 @@ __u64 ptl_nid2u64(ptl_nid_t nid) 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); @@ -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); - 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, diff --git a/lnet/utils/wirecheck.c b/lnet/utils/wirecheck.c index a73a521763a356c1c119a5dcfaa585b5577fb0d9..631629075a4fda204525e2f59219b214eafab2a8 100644 --- a/lnet/utils/wirecheck.c +++ b/lnet/utils/wirecheck.c @@ -34,7 +34,7 @@ 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) \ diff --git a/lustre/ChangeLog b/lustre/ChangeLog index e1fbe08119313396bbfed7b72e23e57ef04cda33..1ae5fd4f78d848b1834e37ff4bb76154597d2dc7 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -2,6 +2,8 @@ tbd Cluster File Systems, Inc. <info@clusterfs.com> * 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 @@ -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) + - 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) + - increase maximum number of MDS request buffers for large systems 2004-03-22 Cluster File Systems, Inc. <info@clusterfs.com> * version 1.2.1 diff --git a/lustre/include/linux/lustre_net.h b/lustre/include/linux/lustre_net.h index aae0442482b4915977f7e70161474880280e6acf..84062e299ed23304425a6ce8f8a9363c2dab84f7 100644 --- a/lustre/include/linux/lustre_net.h +++ b/lustre/include/linux/lustre_net.h @@ -109,7 +109,7 @@ #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 @@ -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, - 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; @@ -511,6 +511,7 @@ struct ptlrpc_service { 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)); } diff --git a/lustre/include/linux/obd_class.h b/lustre/include/linux/obd_class.h index 386c39392e410b191316f2cf0c54d9acf773f831..941d9b5b34850ad0c1d2d9eabba8d36af3e161b3 100644 --- a/lustre/include/linux/obd_class.h +++ b/lustre/include/linux/obd_class.h @@ -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 +/* @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) { @@ -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); - 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); diff --git a/lustre/kernel_patches/patches/ext3-htree-2.4.19-pre1.patch b/lustre/kernel_patches/patches/ext3-htree-2.4.19-pre1.patch index 711e1f2f45d32f38aac81a74eae65287d89c128e..7865c63c644d7e6cc39fef51830eb123a852340b 100644 --- a/lustre/kernel_patches/patches/ext3-htree-2.4.19-pre1.patch +++ b/lustre/kernel_patches/patches/ext3-htree-2.4.19-pre1.patch @@ -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 */ -+ 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; diff --git a/lustre/kernel_patches/patches/ext3-htree-2.4.21-chaos.patch b/lustre/kernel_patches/patches/ext3-htree-2.4.21-chaos.patch index 36d6b5eb24cd98f79b2d42fe5cd58fec476e10a6..3a9719b9c929de71fdb3f5c5f0c4fdabddfc3664 100644 --- a/lustre/kernel_patches/patches/ext3-htree-2.4.21-chaos.patch +++ b/lustre/kernel_patches/patches/ext3-htree-2.4.21-chaos.patch @@ -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 */ -+ 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; diff --git a/lustre/kernel_patches/patches/ext3-htree-2.4.22-rh.patch b/lustre/kernel_patches/patches/ext3-htree-2.4.22-rh.patch index 3230853da3220019b88d2f066d473cfaf2b0b58f..436bd34cdc567d9f52eb25fa22f9d57c32605035 100644 --- a/lustre/kernel_patches/patches/ext3-htree-2.4.22-rh.patch +++ b/lustre/kernel_patches/patches/ext3-htree-2.4.22-rh.patch @@ -1657,8 +1657,8 @@ + 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; diff --git a/lustre/kernel_patches/patches/ext3-htree-suse.patch b/lustre/kernel_patches/patches/ext3-htree-suse.patch index ea55ad1c8d13ddb77d063b2fddeb6ca07ac3e01c..a6e96f02be5d15324fdaa618de34ac584637a690 100644 --- a/lustre/kernel_patches/patches/ext3-htree-suse.patch +++ b/lustre/kernel_patches/patches/ext3-htree-suse.patch @@ -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 */ -+ 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; diff --git a/lustre/kernel_patches/patches/ext3-htree.patch b/lustre/kernel_patches/patches/ext3-htree.patch index 1c1c1ad2a4db7da260df9f2f6c64dd324c08c197..903118b8a5e1d84f2be09a4027064ea3468f53fb 100644 --- a/lustre/kernel_patches/patches/ext3-htree.patch +++ b/lustre/kernel_patches/patches/ext3-htree.patch @@ -1657,8 +1657,8 @@ + 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; diff --git a/lustre/kernel_patches/patches/htree-ext3-2.4.18.patch b/lustre/kernel_patches/patches/htree-ext3-2.4.18.patch index 2bfd0b99bfedd8cdbf111cbe22ba7653ce1e49d2..a8bce7cc155db4baa042eda665604cf2e23eee84 100644 --- a/lustre/kernel_patches/patches/htree-ext3-2.4.18.patch +++ b/lustre/kernel_patches/patches/htree-ext3-2.4.18.patch @@ -1006,8 +1006,8 @@ + 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; diff --git a/lustre/kernel_patches/series/ldiskfs-2.6-suse.series b/lustre/kernel_patches/series/ldiskfs-2.6-suse.series index 65e8dcdfa2b5969610649412ab8e78c4b433a10b..cff99dd4218917f2e0de667d7672fb688d9ae052 100644 --- a/lustre/kernel_patches/series/ldiskfs-2.6-suse.series +++ b/lustre/kernel_patches/series/ldiskfs-2.6-suse.series @@ -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 @@ -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-xattr-header-move-2.6.suse.patch diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 2dce8a46a348ce784909d11d38be3635e7dc13f0..d17e850ad34df69eb22213a30ac19d33a88cbb0c 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -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; - init_timer(&obd->obd_recovery_timer); spin_unlock_bh(&obd->obd_processing_task_lock); reset_recovery_timer(obd); diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 5ddba662c484b3f45592ea8d29848a637eddee67..2a09a2e2193d87f2429e89c1f85858f38c23c618 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -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]; - 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); } @@ -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_peer *peer = &req->rq_import->imp_connection->c_peer; 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, - ptlrpc_peernid2str(&req->rq_peer, str)); + ptlrpc_peernid2str(peer, str)); 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", - 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 " - "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); diff --git a/lustre/liblustre/llite_lib.c b/lustre/liblustre/llite_lib.c index 0b549c068bc809bdbff7e93906e67919102b6990..bd000bb16229057505dce516d342050a92bc0154 100644 --- a/lustre/liblustre/llite_lib.c +++ b/lustre/liblustre/llite_lib.c @@ -81,23 +81,26 @@ char *portals_nid2str(int nal, ptl_nid_t nid, char *str) 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: - sprintf(str, "%u:%u", (__u32)(nid >> 32), (__u32)nid); + snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u", + (__u32)(nid >> 32), (__u32)nid); break; default: - return NULL; + snprintf(str, PTL_NALFMT_SIZE - 1, "?%d? %llx", + nal, (long long)nid); + break; } return str; } void init_current(char *comm) -{ +{ 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); -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; @@ -165,7 +168,7 @@ int lib_ioctl_nalcmd(int dev_id, int opc, void * ptr) 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; diff --git a/lustre/liblustre/tests/echo_test.c b/lustre/liblustre/tests/echo_test.c index ca2caaaf9daf9c6f8daedc2b3053ce1ce2a6e11b..139a10a3865250423d3e107b3c5f67dd59aafb9c 100644 --- a/lustre/liblustre/tests/echo_test.c +++ b/lustre/liblustre/tests/echo_test.c @@ -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> @@ -20,7 +23,7 @@ struct obd_import; 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")) @@ -42,17 +45,20 @@ char *portals_nid2str(int nal, ptl_nid_t nid, char *str) 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: - sprintf(str, "%u:%u", (__u32)(nid >> 32), (__u32)nid); + snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u", + (__u32)(nid >> 32), (__u32)nid); break; default: - return NULL; + snprintf(str, PTL_NALFMT_SIZE - 1, "?%d? %llx", + nal, (long long)nid); + break; } return str; } @@ -101,7 +107,7 @@ int init_lib_portals() 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; diff --git a/lustre/llite/.cvsignore b/lustre/llite/.cvsignore index 63b271ffccfc2460318a21b1b4dc752ce52cbbd9..d749c615266bdd5efd46cd9ba139983f3ff73153 100644 --- a/lustre/llite/.cvsignore +++ b/lustre/llite/.cvsignore @@ -12,3 +12,4 @@ autoMakefile .*.cmd .*.flags .tmp_versions +.depend diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 5ae049ddf1308718430524965bd5dfffa538174b..bf8fb4c449e5ab3066fc852032357bc533e6e615 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -529,7 +529,7 @@ int lustre_fill_super(struct super_block *sb, void *data, int silent) 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); } diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index ff272686d48e94d8765c6448926c7dd14aa477f6..dfecb74ec32cb1ad303613a72a6c2d4b32d6e2e2 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -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; - 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) { @@ -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; + obd_off start, end; 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; + 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) { @@ -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; + obd_off start, end; 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; + 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; diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 30e4fc13f124669106b30b4db2bf0952e99bbbaf..afa8ec04cd526bc4216ff7ce20e10112b8501064 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -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); - 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 " diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 2d9735700ac1687a20efbcd224ee8a2c1b19a8da..6ebbcad018244787a56747a02e812343d1de2f3c 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -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, - MDT_NUM_THREADS, "ll_mdt_attr"); + MDT_NUM_THREADS, "ll_mdt_attr"); if (rc) GOTO(err_thread2, rc); diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c index 295f24f9b8ddf155d007bd06e4833bc150de5998..2dfc6c613c79ff18cc605be02b9df2505819ed3d 100644 --- a/lustre/mds/mds_reint.c +++ b/lustre/mds/mds_reint.c @@ -1183,6 +1183,7 @@ static int mds_reint_unlink(struct mds_update_record *rec, int offset, 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", @@ -1242,13 +1243,6 @@ static int mds_reint_unlink(struct mds_update_record *rec, int offset, 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: @@ -1319,6 +1313,14 @@ static int mds_reint_unlink(struct mds_update_record *rec, int offset, 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) @@ -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); + l_dput(dchild); l_dput(dparent); case 0: break; diff --git a/lustre/mds/mds_unlink_open.c b/lustre/mds/mds_unlink_open.c index 87e9a2731b4bc3fd65e1d5ab4c31668b846765ac..a79e44cf690d1a4a57f18162e0aa4834c8a50c38 100644 --- a/lustre/mds/mds_unlink_open.c +++ b/lustre/mds/mds_unlink_open.c @@ -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; + unsigned mode; 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); } - *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) - 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); + + /* 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: diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index 7d22ba276f105770622bcf918c5fc49cda28e668..b303f718ea1383ed98b61124584b56c255eee2d1 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -124,6 +124,7 @@ int class_attach(struct lustre_cfg *lcfg) /* 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); diff --git a/lustre/obdclass/sysctl.c b/lustre/obdclass/sysctl.c index 8c93a481863bf7df1b3824672728460922521c86..158a2deaf6a4f5e123386022d56a32e44a521f08 100644 --- a/lustre/obdclass/sysctl.c +++ b/lustre/obdclass/sysctl.c @@ -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_MEMUSED, /* bytes currently OBD_ALLOCated */ 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 }, + {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 } diff --git a/lustre/obdecho/.cvsignore b/lustre/obdecho/.cvsignore index e31a39b01a829b9048227996d0609b76f48fd6af..5d26f004c3ff3840392e34cb4aaed5287963f9a1 100644 --- a/lustre/obdecho/.cvsignore +++ b/lustre/obdecho/.cvsignore @@ -12,3 +12,4 @@ autoMakefile *.mod.c .*.flags .tmp_versions +.depend diff --git a/lustre/obdfilter/filter_io.c b/lustre/obdfilter/filter_io.c index 3900ad15bc8b668f92f4490b98c97d30b1393099..b9b7ab304570266efa00d9dc6081e832ba264a2f 100644 --- a/lustre/obdfilter/filter_io.c +++ b/lustre/obdfilter/filter_io.c @@ -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; + static unsigned long last_msg; + static int last_count; + int mask = D_CACHE; 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; + /* 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. */ - 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); diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 71582746cbfe959ea9d3afee0a507c85d782f42c..80cbedb183f6741a0dc6fc9acbe8d7d8ccf4f75c 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -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, - "ll_ost_create"); + "ll_ost_creat"); if (rc) GOTO(out_create, rc = -EINVAL); diff --git a/lustre/portals/include/linux/kp30.h b/lustre/portals/include/linux/kp30.h index 4ca40473b91cb370ddfea364be2486eebdda3d0d..0aa183e48dd3dd22c6b4db74b9d1ab5faf31bcba 100644 --- a/lustre/portals/include/linux/kp30.h +++ b/lustre/portals/include/linux/kp30.h @@ -8,7 +8,7 @@ #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)) @@ -647,7 +647,7 @@ enum { 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) diff --git a/lustre/portals/include/linux/libcfs.h b/lustre/portals/include/linux/libcfs.h index 99d3877059f0caeaf08fdb34c67bb9f788b8b382..5b1b8a5f628c75513f76ace1920b989f94a0d732 100644 --- a/lustre/portals/include/linux/libcfs.h +++ b/lustre/portals/include/linux/libcfs.h @@ -6,6 +6,8 @@ #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__) @@ -13,7 +15,18 @@ # 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> @@ -29,7 +42,7 @@ typedef u_int64_t __u64; #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)) diff --git a/lustre/portals/include/linux/portals_compat25.h b/lustre/portals/include/linux/portals_compat25.h index 34c263bcefc9f852d687e643b51d5d5fc249a3fe..9ab4020706df65a5c07ea658a6e8a685527c6a81 100644 --- a/lustre/portals/include/linux/portals_compat25.h +++ b/lustre/portals/include/linux/portals_compat25.h @@ -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)) -# 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)) -# 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 -# 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 diff --git a/lustre/portals/include/portals/ptlctl.h b/lustre/portals/include/portals/ptlctl.h index f3fdaafedcfe0f0f59c140bd66011b8e1e3f8a52..2af336ec63ede943fb9591ec221456534313c391 100644 --- a/lustre/portals/include/portals/ptlctl.h +++ b/lustre/portals/include/portals/ptlctl.h @@ -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 */ -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); -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); +extern char *dump_filename; +int dump(int dev_id, unsigned int opc, void *buf); #endif diff --git a/lustre/portals/libcfs/debug.c b/lustre/portals/libcfs/debug.c index 519db0e7dceb7a84018fb2319cf006496075dc21..3a6508eeed71895f7cb828fa3ca2c880799e1f82 100644 --- a/lustre/portals/libcfs/debug.c +++ b/lustre/portals/libcfs/debug.c @@ -968,18 +968,21 @@ char *portals_nid2str(int nal, ptl_nid_t nid, char *str) 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: - snprintf(str, PTL_NALFMT_SIZE-1, LPD64, nid); + snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u", + (__u32)(nid >> 32), (__u32)nid); 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; } diff --git a/lustre/portals/libcfs/proc.c b/lustre/portals/libcfs/proc.c index c1b2aecb15bba6d28ccc2162d704c01e378ca176..c850f690fda5ef4c410498acd7d184f6927ab56c 100644 --- a/lustre/portals/libcfs/proc.c +++ b/lustre/portals/libcfs/proc.c @@ -62,16 +62,18 @@ extern char debug_daemon_file_path[1024]; 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, @@ -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_MEMUSED, "memused", (int *)&portal_kmemory.counter, + sizeof(int), 0644, NULL, &proc_dointvec}, {0} }; diff --git a/lustre/portals/utils/debug.c b/lustre/portals/utils/debug.c index d2aad31193a1137eba758c6a60cd5312291d82fe..ae2da55f905728bf1e15beb1f20ddc76bfb2e3c0 100644 --- a/lustre/portals/utils/debug.c +++ b/lustre/portals/utils/debug.c @@ -183,9 +183,6 @@ static int applymask(char* procpath, int value) 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) { diff --git a/lustre/portals/utils/l_ioctl.c b/lustre/portals/utils/l_ioctl.c index 1adcc8eb88d2aee269fdbf4eb71640bf3517bbf1..0671c241a31648b45a3ba0a4aea2dca0e5d476ac 100644 --- a/lustre/portals/utils/l_ioctl.c +++ b/lustre/portals/utils/l_ioctl.c @@ -56,7 +56,7 @@ static struct ioc_dev ioc_dev_list[10]; struct dump_hdr { int magic; int dev_id; - int opc; + unsigned int opc; }; char *dump_filename; @@ -101,7 +101,7 @@ open_ioc_dev(int dev_id) static int -do_ioctl(int dev_id, int opc, void *buf) +do_ioctl(int dev_id, unsigned int opc, void *buf) { 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 -dump(int dev_id, int opc, void *buf) +dump(int dev_id, unsigned int opc, void *buf) { FILE *fp; struct dump_hdr dump_hdr; @@ -212,7 +212,7 @@ set_ioctl_dump(char * file) } 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); } @@ -226,7 +226,7 @@ l_ioctl(int dev_id, int opc, void *buf) * 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; diff --git a/lustre/portals/utils/portals.c b/lustre/portals/utils/portals.c index 859c5deb1f7c224d536f2d928140ee424df731cc..86b2da896c4e00c4130a6094d69e91ac9957a5f6 100644 --- a/lustre/portals/utils/portals.c +++ b/lustre/portals/utils/portals.c @@ -373,7 +373,7 @@ __u64 ptl_nid2u64(ptl_nid_t nid) 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); @@ -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); - 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, diff --git a/lustre/portals/utils/wirecheck.c b/lustre/portals/utils/wirecheck.c index a73a521763a356c1c119a5dcfaa585b5577fb0d9..631629075a4fda204525e2f59219b214eafab2a8 100644 --- a/lustre/portals/utils/wirecheck.c +++ b/lustre/portals/utils/wirecheck.c @@ -34,7 +34,7 @@ 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) \ diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 0cbcff24c383875907772a8a2366f423a8c2a294..d17540c070851f885a7b1e7332b7cdcd6858953f 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -400,6 +400,13 @@ static int ptlrpc_check_reply(struct ptlrpc_request *req) 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:"); @@ -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); - req->rq_timeout = 1; + req->rq_net_err = 1; 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_net_err && !req->rq_timedout) + ptlrpc_expire_one_request(req); + 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; - LASSERT (!ptlrpc_client_receiving_reply(req)); - LASSERT (req->rq_bulk == NULL || - !ptlrpc_bulk_active(req->rq_bulk)); - 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; @@ -691,6 +697,8 @@ int ptlrpc_check_set(struct ptlrpc_request_set *set) 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 " @@ -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; - req->rq_timeout = 0; + req->rq_net_err = 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; + req->rq_net_err = 0; req->rq_timedout = 0; if (req->rq_bulk) { __u64 old_xid = req->rq_xid; diff --git a/lustre/ptlrpc/events.c b/lustre/ptlrpc/events.c index cd35bd3807ead118243d3b8870fc59db6e20db7b..a5ec4f1331ae78d2d22a3f0190bb70539fdb33f8 100644 --- a/lustre/ptlrpc/events.c +++ b/lustre/ptlrpc/events.c @@ -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); - req->rq_timeout = 0; + req->rq_net_err = 1; spin_unlock_irqrestore(&req->rq_lock, flags); ptlrpc_wake_client_req(req); diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index 55d8e9c83b6688f37e8efec5d77337bfaa4e8b65..b6282164d298fce6572259ebb8020827db5c0906 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -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_net_err = 0; request->rq_resend = 0; request->rq_restart = 0; spin_unlock_irqrestore (&request->rq_lock, flags); diff --git a/lustre/ptlrpc/pinger.c b/lustre/ptlrpc/pinger.c index 5641f63d15181f6f71fa6ca3f6b102408866d069..c6d5c841eea1810918c26b9fbbc31a3d06c84b84 100644 --- a/lustre/ptlrpc/pinger.c +++ b/lustre/ptlrpc/pinger.c @@ -80,7 +80,9 @@ static int ptlrpc_pinger_main(void *arg) 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 */ diff --git a/lustre/ptlrpc/recov_thread.c b/lustre/ptlrpc/recov_thread.c index 3d66eaea829f04e32873fcd59ab4e16d363e1b6d..490dc361d187a911174122935db114426443860f 100644 --- a/lustre/ptlrpc/recov_thread.c +++ b/lustre/ptlrpc/recov_thread.c @@ -232,8 +232,8 @@ static int log_commit_thread(void *arg) 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(); diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 11238214b66c5eea013086355eab37ce783daacf..bd0bb456d8ca28b93590f92cfb186cf84614b377 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -667,7 +667,9 @@ static int ptlrpc_main(void *arg) 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 */ @@ -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); - + 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)) { - 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); @@ -769,6 +771,7 @@ void ptlrpc_stop_all_threads(struct ptlrpc_service *svc) 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) { diff --git a/lustre/tests/.cvsignore b/lustre/tests/.cvsignore index 275e52fdc2bc0908f92d9705bce8e40f1b60c8f9..4df0fc194219fbd1da8288153ae1b90d09bb6b13 100644 --- a/lustre/tests/.cvsignore +++ b/lustre/tests/.cvsignore @@ -62,3 +62,4 @@ XMLCONFIG logs ostactive ll_dirstripe_verify +openfilleddirunlink diff --git a/lustre/tests/Makefile.am b/lustre/tests/Makefile.am index f313234edc7bfae9de602ca593e156eb7c37e4f0..97cbeee2399f26fa8e28619a9535dec135f5fda2 100644 --- a/lustre/tests/Makefile.am +++ b/lustre/tests/Makefile.am @@ -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 += 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 @@ -56,6 +56,7 @@ wantedi_SOURCES = wantedi.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 diff --git a/lustre/tests/acceptance-small.sh b/lustre/tests/acceptance-small.sh index abe38c8a41d2b6953589024c96d6c19fbaf76395..f10da1d585fda18ab308da5098999b5b5686238f 100755 --- a/lustre/tests/acceptance-small.sh +++ b/lustre/tests/acceptance-small.sh @@ -164,3 +164,7 @@ 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 index eaed7e33169f32e662484c4b803b216ef25db76f..0000000000000000000000000000000000000000 --- a/lustre/tests/mount2.sh +++ /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 index 1840d197c337864698df63c916ec0372851551d7..0000000000000000000000000000000000000000 --- a/lustre/tests/mount2lov.sh +++ /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 diff --git a/lustre/tests/multiop.c b/lustre/tests/multiop.c index 0402affeae8f8da963999abd4a7b1ebe520bd6c6..c8ac3946ee043acefe23d8bb9a22d293302ba1e3 100755 --- a/lustre/tests/multiop.c +++ b/lustre/tests/multiop.c @@ -204,12 +204,22 @@ int main(int argc, char **argv) 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); } + /* 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; + } 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 index 0000000000000000000000000000000000000000..6c7707fa9a7a6cfc38649ba667e6d12091558ebb --- /dev/null +++ b/lustre/tests/openfilleddirunlink.c @@ -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; +} diff --git a/lustre/tests/recovery-small.sh b/lustre/tests/recovery-small.sh index bb41aaa4567056d90681f2712794b08a329cc13e..d0dd6f05e2264da412fa67bfafbe6132c83fa214 100755 --- a/lustre/tests/recovery-small.sh +++ b/lustre/tests/recovery-small.sh @@ -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 + # 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)" @@ -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 - set -vx 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)" diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index e9b34ea25dd31569bfcd8226589c42a27a4a0b99..fbf8d1986b7f172c10619a840fc3c4fdcd73a950 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -379,6 +379,7 @@ test_18() { sleep 1 rm -f $DIR/$tfile touch $DIR/$tfile-2 || return 1 + echo "pid: $pid will close" 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 - $CHECKSTAT -t file $DIR/$tfile-* && return 1 || true + $CHECKSTAT -t file $DIR/$tfile-* && return 2 || true } run_test 42 "recovery after ost failure" @@ -866,6 +867,30 @@ test_44() { } 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 diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index b5cc8beaa37e81c066f3ad2e4dc47924007021d8..6b1510791259d8e1c82aa0efa912f3ae3cb8baf1 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -869,6 +869,11 @@ test_31d() { } 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 diff --git a/lustre/tests/stat.c b/lustre/tests/stat.c index 4d9977162462920e8694085a750d30e359d4b7b7..f27957d0a1d65e08335f46df5914ea4a3af9b78a 100644 --- a/lustre/tests/stat.c +++ b/lustre/tests/stat.c @@ -145,6 +145,9 @@ void print_human_fstype(struct statfs *statfsbuf) case S_MAGIC_ROMFS: type = strdup("romfs"); break; + case S_MAGIC_LUSTRE: + type = strdup("lustre"); + break; #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, - struct tm *tm) { + struct tm *tm) { 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); - else + else 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 - + switch(m) { case 'n': strcat(pformat, "s"); diff --git a/lustre/tests/stat_fs.h b/lustre/tests/stat_fs.h index a07fc123b73ccf9b7280225809143fa7df3417b0..c5fa3b4d261a777b17f3fbd6eb01de003d77504d 100644 --- a/lustre/tests/stat_fs.h +++ b/lustre/tests/stat_fs.h @@ -31,6 +31,7 @@ #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 diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index adb957d8b244e5b69b6dd9d0905b0e81e0c9799f..791b523a2a39fc3d6fce70b2f0fafddb37d82afe 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -39,6 +39,7 @@ init_test_env() { 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} @@ -297,14 +298,14 @@ add_mds() { 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 - 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() { @@ -312,14 +313,14 @@ add_ost() { 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 - 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() { diff --git a/lustre/utils/llmount.c b/lustre/utils/llmount.c index a8c9e6e4d8696823572c3d66f231298b1dd33110..3ac52de87255cee326c295a1b99daafc93d78366 100644 --- a/lustre/utils/llmount.c +++ b/lustre/utils/llmount.c @@ -70,7 +70,7 @@ update_mtab_entry(char *spec, char *node, char *type, char *opts, 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; diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index e1ca25eb6ec2816cc3f346739882b6fad0c07667..f4c576ef767f38b3a269d38f642c4d4cb764a9ef 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -36,7 +36,7 @@ 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) \