From: adilger Date: Wed, 9 Jun 2004 02:44:52 +0000 (+0000) Subject: Land b1_2_smallfix onto b1_2 (20040608_1846) X-Git-Tag: v1_8_0_110~486^5~198 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=9f8116e51caf53aefb1f229de3fe238a497b866c;p=fs%2Flustre-release.git Land b1_2_smallfix onto b1_2 (20040608_1846) - clean kiobufs before and after use (b=3485) - strip trailing '/'s before comparing paths with /proc/mounts (b=3486) - remove assertions to work around "in-flight rpcs" recovery bug (b=3063) - change init script to fail more clearly if not run as root (b=1528) - fix ns_lock/i_sem lock ordering deadlock for kms update (b=3477) - don't do DNS lookups on NIDs too small for IP addresses (b=3442) - servers can dump a log evicting a client - lustre.dump_on_timeout=1 --- diff --git a/lnet/libcfs/debug.c b/lnet/libcfs/debug.c index a9c1adc..04a7496 100644 --- a/lnet/libcfs/debug.c +++ b/lnet/libcfs/debug.c @@ -1067,8 +1067,15 @@ char *portals_debug_dumpstack(void) } #endif /* __arch_um__ */ +struct task_struct *portals_current(void) +{ + CWARN("current task struct is %p\n", current); + return current; +} + EXPORT_SYMBOL(stack_backtrace_lock); EXPORT_SYMBOL(portals_debug_dumpstack); +EXPORT_SYMBOL(portals_current); #endif /* __KERNEL__ */ EXPORT_SYMBOL(portals_debug_dumplog); diff --git a/lnet/utils/portals.c b/lnet/utils/portals.c index f078099..9760984 100644 --- a/lnet/utils/portals.c +++ b/lnet/utils/portals.c @@ -306,14 +306,20 @@ ptl_parse_nid (ptl_nid_t *nidp, char *str) char * ptl_nid2str (char *buffer, ptl_nid_t nid) { - __u32 addr = htonl((__u32)nid); /* back to NETWORK byte order */ - struct hostent *he = gethostbyaddr ((const char *)&addr, sizeof (addr), AF_INET); + struct hostent *he = NULL; + /* Don't try to resolve NIDs that are e.g. Elan host IDs. Assume + * TCP addresses in the 0.x.x.x subnet are not in use. This can + * happen on routers and slows things down a _lot_. Bug 3442. */ + if (nid & 0xff000000) { + __u32 addr = htonl((__u32)nid); /* back to NETWORK byte order */ + he = gethostbyaddr((const char *)&addr, sizeof(addr), AF_INET); + } if (he != NULL) - strcpy (buffer, he->h_name); + sprintf(buffer, "%#x:%s", (int)(nid >> 32), he->h_name); else - sprintf (buffer, LPX64, nid); - + sprintf(buffer, LPX64, nid); + return (buffer); } diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 846b684..3f1aa28 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -1,3 +1,15 @@ +tbd Cluster File Systems, Inc. + * version 1.2.3 + * bug fixes + - clean kiobufs before and after use (3485) + - strip trailing '/'s before comparing paths with /proc/mounts (3486) + - remove assertions to work around "in-flight rpcs" recovery bug (3063) + - change init script to fail more clearly if not run as root (1528) + - fix ns_lock/i_sem lock ordering deadlock for kms update (3477) + - don't do DNS lookups on NIDs too small for IP addresses (3442) + * miscellania + - servers can dump a log evicting a client - lustre.dump_on_timeout=1 + 2004-05-27 Cluster File Systems, Inc. * version 1.2.2 * bug fixes @@ -46,6 +58,8 @@ - fix compilation for qswnal for 2.6 kernels (3125) - increase maximum number of MDS request buffers for large systems - change liblustreapi to be useful for external progs like lfsck (3098) + - increase local configuration timeout for slow disks (3353) + - allow configuring ldlm AST timeout - lustre.ldlm_timeout= 2004-03-22 Cluster File Systems, Inc. * version 1.2.1 diff --git a/lustre/configure.in b/lustre/configure.in index 5068a99..568708b 100644 --- a/lustre/configure.in +++ b/lustre/configure.in @@ -5,7 +5,7 @@ AC_INIT AC_CANONICAL_SYSTEM -AM_INIT_AUTOMAKE(lustre, 1.2.2) +AM_INIT_AUTOMAKE(lustre, 1.2.2.1ra) # AM_MAINTAINER_MODE # Four main targets: lustre kernel modules, utilities, tests, and liblustre diff --git a/lustre/include/linux/obd_support.h b/lustre/include/linux/obd_support.h index 94ea609..f73e97f 100644 --- a/lustre/include/linux/obd_support.h +++ b/lustre/include/linux/obd_support.h @@ -36,6 +36,7 @@ extern atomic_t obd_memory; extern int obd_memmax; extern unsigned int obd_fail_loc; +extern unsigned int obd_dump_on_timeout; extern unsigned int obd_timeout; extern unsigned int ldlm_timeout; extern char obd_lustre_upcall[128]; diff --git a/lustre/kernel_patches/patches/loop-sync-2.4.21-suse.patch b/lustre/kernel_patches/patches/loop-sync-2.4.21-suse.patch index 73372b9..5d18ad3 100644 --- a/lustre/kernel_patches/patches/loop-sync-2.4.21-suse.patch +++ b/lustre/kernel_patches/patches/loop-sync-2.4.21-suse.patch @@ -1,5 +1,5 @@ ---- drivers/block/loop.c.bu 2004-05-11 16:27:23.000000000 -0700 -+++ drivers/block/loop.c 2004-05-11 16:28:50.000000000 -0700 +--- linux/drivers/block/loop.c.bu 2004-05-11 16:27:23.000000000 -0700 ++++ linux/drivers/block/loop.c 2004-05-11 16:28:50.000000000 -0700 @@ -978,7 +978,7 @@ static int lo_release(struct inode *inod lo = &loop_dev[dev]; diff --git a/lustre/ldlm/ldlm_extent.c b/lustre/ldlm/ldlm_extent.c index 5cabc13..1d87959 100644 --- a/lustre/ldlm/ldlm_extent.c +++ b/lustre/ldlm/ldlm_extent.c @@ -255,6 +255,7 @@ int ldlm_process_extent_lock(struct ldlm_lock *lock, int *flags, int first_enq, /* When a lock is cancelled by a client, the KMS may undergo change if this * is the "highest lock". This function returns the new KMS value. + * Caller must hold ns_lock already. * * NB: A lock on [x,y] protects a KMS of up to y + 1 bytes! */ __u64 ldlm_extent_shift_kms(struct ldlm_lock *lock, __u64 old_kms) @@ -270,7 +271,6 @@ __u64 ldlm_extent_shift_kms(struct ldlm_lock *lock, __u64 old_kms) * calculation of the kms */ lock->l_flags |= LDLM_FL_KMS_IGNORE; - l_lock(&res->lr_namespace->ns_lock); list_for_each(tmp, &res->lr_granted) { lck = list_entry(tmp, struct ldlm_lock, l_res_link); @@ -278,7 +278,7 @@ __u64 ldlm_extent_shift_kms(struct ldlm_lock *lock, __u64 old_kms) continue; if (lck->l_policy_data.l_extent.end >= old_kms) - GOTO(out, kms = old_kms); + RETURN(old_kms); /* This extent _has_ to be smaller than old_kms (checked above) * so kms can only ever be smaller or the same as old_kms. */ @@ -287,8 +287,5 @@ __u64 ldlm_extent_shift_kms(struct ldlm_lock *lock, __u64 old_kms) } LASSERTF(kms <= old_kms, "kms "LPU64" old_kms "LPU64"\n", kms, old_kms); - GOTO(out, kms); - out: - l_unlock(&res->lr_namespace->ns_lock); - return kms; + RETURN(kms); } diff --git a/lustre/liblustre/llite_lib.h b/lustre/liblustre/llite_lib.h index 4217f84..7fffce6 100644 --- a/lustre/liblustre/llite_lib.h +++ b/lustre/liblustre/llite_lib.h @@ -69,7 +69,7 @@ struct llu_inode_info { char *lli_symlink_name; struct semaphore lli_open_sem; __u64 lli_maxbytes; - unsigned long lli_flags; + unsigned long lli_flags; /* for libsysio */ struct file_identifier lli_sysio_fid; @@ -99,7 +99,7 @@ struct llu_inode_info { dev_t lli_st_rdev; loff_t lli_st_size; unsigned int lli_st_blksize; - unsigned int lli_st_blocks; + unsigned long lli_st_blocks; time_t lli_st_atime; time_t lli_st_mtime; time_t lli_st_ctime; @@ -294,11 +294,11 @@ int llu_objects_destroy(struct ptlrpc_request *request, struct inode *dir); int llu_iop_iodone(struct ioctx *ioctxp __IS_UNUSED); struct llu_sysio_callback_args* llu_file_write(struct inode *inode, const struct iovec *iovec, - size_t iovlen, loff_t pos); + size_t iovlen, loff_t pos); struct llu_sysio_callback_args* llu_file_read(struct inode *inode, const struct iovec *iovec, size_t iovlen, loff_t pos); -int llu_glimpse_size(struct inode *inode, struct ost_lvb *lvb); +int llu_glimpse_size(struct inode *inode); int llu_extent_lock(struct ll_file_data *fd, struct inode *inode, struct lov_stripe_md *lsm, int mode, ldlm_policy_data_t *policy, struct lustre_handle *lockh, diff --git a/lustre/liblustre/namei.c b/lustre/liblustre/namei.c index 73827ce..74eddb2 100644 --- a/lustre/liblustre/namei.c +++ b/lustre/liblustre/namei.c @@ -349,12 +349,11 @@ static int lookup_it_finish(struct ptlrpc_request *request, int offset, /* bug 2334: drop MDS lock before acquiring OST lock */ ll_intent_drop_lock(it); - rc = llu_glimpse_size(inode, &lvb); + rc = llu_glimpse_size(inode); if (rc) { I_RELE(inode); RETURN(rc); } - lli->lli_st_size = lvb.lvb_size; } } else { ENTRY; diff --git a/lustre/liblustre/rw.c b/lustre/liblustre/rw.c index c43bb06..b55e91f 100644 --- a/lustre/liblustre/rw.c +++ b/lustre/liblustre/rw.c @@ -110,8 +110,10 @@ static int llu_extent_lock_callback(struct ldlm_lock *lock, lsm = lli->lli_smd; stripe = llu_lock_to_stripe_offset(inode, lock); + l_lock(&lock->l_resource->lr_namespace->ns_lock); kms = ldlm_extent_shift_kms(lock, lsm->lsm_oinfo[stripe].loi_kms); + l_unlock(&lock->l_resource->lr_namespace->ns_lock); if (lsm->lsm_oinfo[stripe].loi_kms != kms) LDLM_DEBUG(lock, "updating kms from "LPU64" to "LPU64, lsm->lsm_oinfo[stripe].loi_kms, kms); @@ -172,11 +174,12 @@ static int llu_glimpse_callback(struct ldlm_lock *lock, void *reqp) } __u64 lov_merge_size(struct lov_stripe_md *lsm, int kms); +__u64 lov_merge_blocks(struct lov_stripe_md *lsm); __u64 lov_merge_mtime(struct lov_stripe_md *lsm, __u64 current_time); /* NB: lov_merge_size will prefer locally cached writes if they extend the * file (because it prefers KMS over RSS when larger) */ -int llu_glimpse_size(struct inode *inode, struct ost_lvb *lvb) +int llu_glimpse_size(struct inode *inode) { struct llu_inode_info *lli = llu_i2info(inode); struct llu_sb_info *sbi = llu_i2sbi(inode); @@ -194,10 +197,13 @@ int llu_glimpse_size(struct inode *inode, struct ost_lvb *lvb) if (rc > 0) RETURN(-EIO); - lvb->lvb_size = lov_merge_size(lli->lli_smd, 0); - //inode->i_mtime = lov_merge_mtime(lli->lli_smd, inode->i_mtime); + lli->lli_st_size = lov_merge_size(lli->lli_smd, 0); + lli->lli_st_blocks = lov_merge_blocks(lli->lli_smd); + //lli->lli_st_mtime = lov_merge_mtime(lli->lli_smd, lli->lli_st_mtime); + + CDEBUG(D_DLMTRACE, "glimpse: size: %llu, blocks: %lu\n", + lli->lli_st_size, lli->lli_st_blocks); - CDEBUG(D_DLMTRACE, "glimpse: size: "LPU64"\n", lvb->lvb_size); obd_cancel(sbi->ll_osc_exp, lli->lli_smd, LCK_PR, &lockh); @@ -837,12 +843,10 @@ llu_file_read(struct inode *inode, const struct iovec *iovec, /* A glimpse is necessary to determine whether we * return a short read or some zeroes at the end of * the buffer */ - struct ost_lvb lvb; - if (llu_glimpse_size(inode, &lvb)) { - llu_extent_unlock(fd, inode, lsm, LCK_PR, &lockh); + if (llu_glimpse_size(inode)) { + llu_extent_unlock(fd, inode, lsm,LCK_PR,&lockh); GOTO(err_out, err = -ENOLCK); } - lli->lli_st_size = lvb.lvb_size; } else { lli->lli_st_size = kms; } diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c index 8321956..57d6389 100644 --- a/lustre/liblustre/super.c +++ b/lustre/liblustre/super.c @@ -435,14 +435,7 @@ static int llu_inode_revalidate(struct inode *inode) /* ll_glimpse_size will prefer locally cached writes if they extend * the file */ - { - struct ost_lvb lvb; - ldlm_error_t err; - - err = llu_glimpse_size(inode, &lvb); - lli->lli_st_size = lvb.lvb_size; - } - RETURN(0); + RETURN(llu_glimpse_size(inode)); } static void copy_stat_buf(struct inode *ino, struct intnl_stat *b) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index c4b0d97..ae8034a 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -472,15 +472,17 @@ static int ll_extent_lock_callback(struct ldlm_lock *lock, stripe = ll_lock_to_stripe_offset(inode, lock); ll_pgcache_remove_extent(inode, lsm, lock, stripe); + l_lock(&lock->l_resource->lr_namespace->ns_lock); down(&inode->i_sem); kms = ldlm_extent_shift_kms(lock, lsm->lsm_oinfo[stripe].loi_kms); - + if (lsm->lsm_oinfo[stripe].loi_kms != kms) LDLM_DEBUG(lock, "updating kms from "LPU64" to "LPU64, lsm->lsm_oinfo[stripe].loi_kms, kms); lsm->lsm_oinfo[stripe].loi_kms = kms; up(&inode->i_sem); + l_unlock(&lock->l_resource->lr_namespace->ns_lock); //ll_try_done_writing(inode); iput: iput(inode); @@ -524,6 +526,7 @@ int ll_async_completion_ast(struct ldlm_lock *lock, int flags, void *data) lvb = lock->l_lvb_data; lsm->lsm_oinfo[stripe].loi_rss = lvb->lvb_size; + l_lock(&lock->l_resource->lr_namespace->ns_lock); down(&inode->i_sem); kms = MAX(lsm->lsm_oinfo[stripe].loi_kms, lvb->lvb_size); kms = ldlm_extent_shift_kms(NULL, kms); @@ -532,6 +535,7 @@ int ll_async_completion_ast(struct ldlm_lock *lock, int flags, void *data) lsm->lsm_oinfo[stripe].loi_kms, kms); lsm->lsm_oinfo[stripe].loi_kms = kms; up(&inode->i_sem); + l_unlock(&lock->l_resource->lr_namespace->ns_lock); } iput(inode); @@ -595,7 +599,7 @@ __u64 lov_merge_mtime(struct lov_stripe_md *lsm, __u64 current_time); /* NB: lov_merge_size will prefer locally cached writes if they extend the * file (because it prefers KMS over RSS when larger) */ -int ll_glimpse_size(struct inode *inode, struct ost_lvb *lvb) +int ll_glimpse_size(struct inode *inode) { struct ll_inode_info *lli = ll_i2info(inode); struct ll_sb_info *sbi = ll_i2sbi(inode); @@ -609,18 +613,18 @@ int ll_glimpse_size(struct inode *inode, struct ost_lvb *lvb) rc = obd_enqueue(sbi->ll_osc_exp, lli->lli_smd, LDLM_EXTENT, &policy, LCK_PR, &flags, ll_extent_lock_callback, ldlm_completion_ast, ll_glimpse_callback, inode, - sizeof(*lvb), lustre_swab_ost_lvb, &lockh); + sizeof(struct ost_lvb), lustre_swab_ost_lvb, &lockh); if (rc != 0) { CERROR("obd_enqueue returned rc %d, returning -EIO\n", rc); RETURN(rc > 0 ? -EIO : rc); } - lvb->lvb_size = lov_merge_size(lli->lli_smd, 0); + inode->i_size = lov_merge_size(lli->lli_smd, 0); inode->i_blocks = lov_merge_blocks(lli->lli_smd); //inode->i_mtime = lov_merge_mtime(lli->lli_smd, inode->i_mtime); - CDEBUG(D_DLMTRACE, "glimpse: size: "LPU64", blocks: "LPU64"\n", - lvb->lvb_size, lvb->lvb_blocks); + CDEBUG(D_DLMTRACE, "glimpse: size: %llu, blocks: %lu\n", + inode->i_size, inode->i_blocks); obd_cancel(sbi->ll_osc_exp, lli->lli_smd, LCK_PR, &lockh); @@ -718,11 +722,9 @@ static ssize_t ll_file_read(struct file *filp, char *buf, size_t count, if (*ppos + count - 1 > kms) { /* A glimpse is necessary to determine whether we return a short * read or some zeroes at the end of the buffer */ - struct ost_lvb lvb; - retval = ll_glimpse_size(inode, &lvb); + retval = ll_glimpse_size(inode); if (retval) goto out; - inode->i_size = lvb.lvb_size; } else { inode->i_size = kms; } @@ -1297,12 +1299,7 @@ int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it) /* ll_glimpse_size will prefer locally cached writes if they extend * the file */ - { - struct ost_lvb lvb; - - rc = ll_glimpse_size(inode, &lvb); - inode->i_size = lvb.lvb_size; - } + rc = ll_glimpse_size(inode); RETURN(rc); } diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index fb678a3..2ef66ad 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -168,7 +168,7 @@ int ll_extent_unlock(struct ll_file_data *, struct inode *, int ll_file_open(struct inode *inode, struct file *file); int ll_file_release(struct inode *inode, struct file *file); int ll_lsm_getattr(struct obd_export *, struct lov_stripe_md *, struct obdo *); -int ll_glimpse_size(struct inode *inode, struct ost_lvb *lvb); +int ll_glimpse_size(struct inode *inode); int ll_local_open(struct file *file, struct lookup_intent *it); int ll_mdc_close(struct obd_export *mdc_exp, struct inode *inode, struct file *file); diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 932e258..a779866 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -297,7 +297,6 @@ static int lookup_it_finish(struct ptlrpc_request *request, int offset, if (it->it_op == IT_GETATTR && S_ISREG(inode->i_mode) && ll_i2info(inode)->lli_smd != NULL) { struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd; - struct ost_lvb lvb; ldlm_error_t rc; LASSERT(lsm->lsm_object_id != 0); @@ -305,12 +304,11 @@ static int lookup_it_finish(struct ptlrpc_request *request, int offset, /* bug 2334: drop MDS lock before acquiring OST lock */ ll_intent_drop_lock(it); - rc = ll_glimpse_size(inode, &lvb); + rc = ll_glimpse_size(inode); if (rc) { iput(inode); RETURN(rc); } - inode->i_size = lvb.lvb_size; } dentry = *de = ll_find_alias(inode, dentry); diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 87376fb..9470466 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -2655,7 +2655,7 @@ static int lov_set_info(struct obd_export *exp, obd_count keylen, * Even when merging RSS, we will take the KMS value if it's larger. * This prevents getattr from stomping on dirty cached pages which * extend the file size. */ -__u64 lov_merge_size(struct lov_stripe_md *lsm, int kms) +__u64 lov_merge_size(struct lov_stripe_md *lsm, int kms_only) { struct lov_oinfo *loi; __u64 size = 0; @@ -2665,8 +2665,10 @@ __u64 lov_merge_size(struct lov_stripe_md *lsm, int kms) i++, loi++) { obd_size lov_size, tmpsize; + CDEBUG(D_DLMTRACE, "stripe %u ost %u kms "LPU64" rss "LPU64"\n", + i, loi->loi_ost_idx, loi->loi_kms, loi->loi_rss); tmpsize = loi->loi_kms; - if (kms == 0 && loi->loi_rss > tmpsize) + if (kms_only == 0 && loi->loi_rss > tmpsize) tmpsize = loi->loi_rss; lov_size = lov_stripe_size(lsm, tmpsize, i); diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index e76317f..ee096ac 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -87,6 +87,7 @@ int proc_version; /* The following are visible and mutable through /proc/sys/lustre/. */ unsigned int obd_fail_loc; +unsigned int obd_dump_on_timeout; unsigned int obd_timeout = 100; unsigned int ldlm_timeout = 6; char obd_lustre_upcall[128] = "DEFAULT"; /* or NONE or /full/path/to/upcall */ @@ -383,6 +384,7 @@ EXPORT_SYMBOL(obd_dev); EXPORT_SYMBOL(obdo_cachep); EXPORT_SYMBOL(obd_fail_loc); EXPORT_SYMBOL(obd_race_waitq); +EXPORT_SYMBOL(obd_dump_on_timeout); EXPORT_SYMBOL(obd_timeout); EXPORT_SYMBOL(ldlm_timeout); EXPORT_SYMBOL(obd_lustre_upcall); diff --git a/lustre/obdclass/sysctl.c b/lustre/obdclass/sysctl.c index 9937ccc..f07cc45 100644 --- a/lustre/obdclass/sysctl.c +++ b/lustre/obdclass/sysctl.c @@ -50,6 +50,7 @@ struct ctl_table_header *obd_table_header = NULL; enum { OBD_FAIL_LOC = 1, /* control test failures instrumentation */ OBD_TIMEOUT, /* RPC timeout before recovery/intr */ + OBD_DUMP_ON_TIMEOUT, /* dump kernel debug log upon eviction */ OBD_UPCALL, /* path to recovery upcall */ OBD_SYNCFILTER, /* XXX temporary, as we play with sync osts.. */ OBD_LDLM_TIMEOUT, /* LDLM timeout for ASTs before client eviction */ @@ -63,13 +64,15 @@ static ctl_table obd_table[] = { &proc_dointvec}, {OBD_TIMEOUT, "timeout", &obd_timeout, sizeof(int), 0644, NULL, &proc_fail_loc}, + {OBD_DUMP_ON_TIMEOUT, "dump_on_timeout", &obd_dump_on_timeout, + sizeof(int), 0644, NULL, &proc_dointvec}, /* 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_SYNCFILTER, "filter_sync_on_commit", &obd_sync_filter, sizeof(int), 0644, NULL, &proc_dointvec}, - {OBD_TIMEOUT, "ldlm_timeout", &ldlm_timeout, sizeof(int), 0644, NULL, - &proc_dointvec}, + {OBD_LDLM_TIMEOUT, "ldlm_timeout", &ldlm_timeout, sizeof(int), 0644, + NULL, &proc_dointvec}, { 0 } }; diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index acd507e..cf4797b 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -1100,8 +1100,7 @@ static int filter_intent_policy(struct ldlm_namespace *ns, down(&res->lr_lvb_sem); res_lvb = res->lr_lvb_data; LASSERT(res_lvb != NULL); - reply_lvb->lvb_size = res_lvb->lvb_size; - reply_lvb->lvb_blocks = res_lvb->lvb_blocks; + memcpy(reply_lvb, res_lvb, sizeof(*reply_lvb)); up(&res->lr_lvb_sem); list_for_each(tmp, &res->lr_granted) { @@ -1204,7 +1203,6 @@ int filter_common_setup(struct obd_device *obd, obd_count len, void *buf, if (rc) GOTO(err_mntput, rc); - filter->fo_destroy_in_progress = 0; sema_init(&filter->fo_create_lock, 1); diff --git a/lustre/obdfilter/filter_io_24.c b/lustre/obdfilter/filter_io_24.c index a3464f3..4181c55 100644 --- a/lustre/obdfilter/filter_io_24.c +++ b/lustre/obdfilter/filter_io_24.c @@ -221,6 +221,21 @@ static int filter_range_is_mapped(struct inode *inode, obd_size offset, int len) return 1; } +/* some kernels require alloc_kiovec callers to zero members through the use of + * map_user_kiobuf and unmap_.. we don't use those, so we have a little helper + * that makes sure we don't break the rules. */ +static void clear_kiobuf(struct kiobuf *iobuf) +{ + int i; + + for (i = 0; i < iobuf->array_len; i++) + iobuf->maplist[i] = NULL; + + iobuf->nr_pages = 0; + iobuf->offset = 0; + iobuf->length = 0; +} + int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, int objcount, struct obd_ioobj *obj, int niocount, struct niobuf_local *res, struct obd_trans_info *oti, @@ -256,9 +271,7 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, int objcount, if (rc) GOTO(cleanup, rc); - iobuf->offset = 0; - iobuf->length = 0; - iobuf->nr_pages = 0; + clear_kiobuf(iobuf); cleanup_phase = 1; fso.fso_dentry = res->dentry; @@ -329,6 +342,7 @@ cleanup: pop_ctxt(&saved, &obd->obd_ctxt, NULL); LASSERT(current->journal_info == NULL); case 1: + clear_kiobuf(iobuf); free_kiovec(1, &iobuf); case 0: for (i = 0, lnb = res; i < obj->ioo_bufcnt; i++, lnb++) { diff --git a/lustre/obdfilter/filter_io_26.c b/lustre/obdfilter/filter_io_26.c index c90d371..9787aaa 100644 --- a/lustre/obdfilter/filter_io_26.c +++ b/lustre/obdfilter/filter_io_26.c @@ -142,6 +142,8 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, push_ctxt(&saved, &obd->obd_ctxt, NULL); cleanup_phase = 2; + generic_osync_inode(inode, inode->i_mapping, OSYNC_DATA|OSYNC_METADATA); + oti->oti_handle = fsfilt_brw_start(obd, objcount, &fso, niocount, res, oti); @@ -181,7 +183,7 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, offs = k * inode->i_sb->s_blocksize; if (!bio || !can_be_merged(bio, sector) || - !bio_add_page(bio, lnb->page, lnb->len, offs)) { + !bio_add_page(bio, lnb->page, PAGE_SIZE, offs)) { if (bio) { atomic_inc(&dreq->numreqs); submit_bio(WRITE, bio); @@ -194,7 +196,8 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, bio->bi_end_io = dio_complete_routine; bio->bi_private = dreq; - if (!bio_add_page(bio, lnb->page, lnb->len, 0)) + if (!bio_add_page(bio, lnb->page, PAGE_SIZE, + offs)) LBUG(); } } @@ -206,7 +209,6 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, iattr.ia_size = this_size; } -#warning This probably needs filemap_fdatasync() like filter_io_24 (bug 2366) if (bio) { atomic_inc(&dreq->numreqs); submit_bio(WRITE, bio); diff --git a/lustre/portals/libcfs/debug.c b/lustre/portals/libcfs/debug.c index a9c1adc..04a7496 100644 --- a/lustre/portals/libcfs/debug.c +++ b/lustre/portals/libcfs/debug.c @@ -1067,8 +1067,15 @@ char *portals_debug_dumpstack(void) } #endif /* __arch_um__ */ +struct task_struct *portals_current(void) +{ + CWARN("current task struct is %p\n", current); + return current; +} + EXPORT_SYMBOL(stack_backtrace_lock); EXPORT_SYMBOL(portals_debug_dumpstack); +EXPORT_SYMBOL(portals_current); #endif /* __KERNEL__ */ EXPORT_SYMBOL(portals_debug_dumplog); diff --git a/lustre/portals/utils/portals.c b/lustre/portals/utils/portals.c index f078099..9760984 100644 --- a/lustre/portals/utils/portals.c +++ b/lustre/portals/utils/portals.c @@ -306,14 +306,20 @@ ptl_parse_nid (ptl_nid_t *nidp, char *str) char * ptl_nid2str (char *buffer, ptl_nid_t nid) { - __u32 addr = htonl((__u32)nid); /* back to NETWORK byte order */ - struct hostent *he = gethostbyaddr ((const char *)&addr, sizeof (addr), AF_INET); + struct hostent *he = NULL; + /* Don't try to resolve NIDs that are e.g. Elan host IDs. Assume + * TCP addresses in the 0.x.x.x subnet are not in use. This can + * happen on routers and slows things down a _lot_. Bug 3442. */ + if (nid & 0xff000000) { + __u32 addr = htonl((__u32)nid); /* back to NETWORK byte order */ + he = gethostbyaddr((const char *)&addr, sizeof(addr), AF_INET); + } if (he != NULL) - strcpy (buffer, he->h_name); + sprintf(buffer, "%#x:%s", (int)(nid >> 32), he->h_name); else - sprintf (buffer, LPX64, nid); - + sprintf(buffer, LPX64, nid); + return (buffer); } diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 5dc783d..489100e 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -668,13 +668,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; @@ -708,6 +704,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 " diff --git a/lustre/ptlrpc/recover.c b/lustre/ptlrpc/recover.c index 18bc6f4..ece3a47 100644 --- a/lustre/ptlrpc/recover.c +++ b/lustre/ptlrpc/recover.c @@ -388,6 +388,9 @@ void ptlrpc_fail_export(struct obd_export *exp) CDEBUG(D_HA, "disconnecting export %p/%s\n", exp, exp->exp_client_uuid.uuid); + if (obd_dump_on_timeout) + portals_debug_dumplog(); + /* Most callers into obd_disconnect are removing their own reference * (request, for example) in addition to the one from the hash table. * We don't have such a reference here, so make one. */ diff --git a/lustre/scripts/lustre b/lustre/scripts/lustre index 95c1d06..017f3d5 100755 --- a/lustre/scripts/lustre +++ b/lustre/scripts/lustre @@ -44,6 +44,11 @@ STATUS=${STATUS_DIR}/sysStatus start() { echo -n "Starting $SERVICE: " + if [ $UID -ne 0 ]; then + echo "Lustre should be started as root" + RETVAL=1 + return + fi ${LCONF} ${LCONF_START_ARGS} RETVAL=$? echo $SERVICE @@ -57,6 +62,11 @@ start() { stop() { echo -n "Shutting down $SERVICE: " + if [ $UID -ne 0 ]; then + echo "Lustre should be stopped as root" + RETVAL=1 + return + fi ${LCONF} ${LCONF_STOP_ARGS} RETVAL=$? echo $SERVICE diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index a16ce2a..7960b5f 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -20,6 +20,7 @@ SRCDIR=`dirname $0` export PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH TMP=${TMP:-/tmp} +FSTYPE=${FSTYPE:-ext3} CHECKSTAT=${CHECKSTAT:-"checkstat -v"} CREATETEST=${CREATETEST:-createtest} @@ -56,7 +57,7 @@ clean() { sh llmountcleanup.sh > /dev/null || exit 20 I_MOUNTED=no } -CLEAN=${CLEAN:-clean} +CLEAN=${CLEAN:-:} start() { echo -n "mnt.." @@ -64,7 +65,7 @@ start() { I_MOUNTED=yes echo "done" } -START=${START:-start} +START=${START:-:} log() { echo "$*" @@ -192,11 +193,7 @@ build_test_filter echo preparing for tests involving mounts EXT2_DEV=${EXT2_DEV:-/tmp/SANITY.LOOP} touch $EXT2_DEV -mke2fs -F $EXT2_DEV 1000 > /dev/null - -EXT3_DEV=${EXT3_DEV:-/tmp/SANITY_EXT3_DEV.LOOP} -touch $EXT3_DEV -mkfs.ext3 -F $EXT3_DEV 10000 > /dev/null +mke2fs -j -F $EXT2_DEV 8000 > /dev/null test_0() { touch $DIR/f @@ -887,7 +884,7 @@ test_31c() { multiop $DIR/f31c Ouc usleep 500 kill -USR1 $MULTIPID - wait $MUTLIPID + wait $MULTIPID } run_test 31c "open-unlink file with multiple links =============" @@ -1567,8 +1564,8 @@ test_48b() { # bug 2399 cd . && error "'cd .' worked after removing cwd" mkdir . && error "'mkdir .' worked after removing cwd" rmdir . && error "'rmdir .' worked after removing cwd" - ln -s . foo && error "'ln -s .' worked after removing cwd" || true - cd .. || error "'cd ..' failed after removing cwd" + ln -s . foo && error "'ln -s .' worked after removing cwd" + cd .. || echo "'cd ..' failed after removing cwd `pwd`" #bug 3517 } run_test 48b "Access removed working dir (should return errors)=" @@ -1578,7 +1575,7 @@ test_48c() { # bug 2350 #set -vx mkdir -p $DIR/d48c/dir cd $DIR/d48c/dir - rmdir $DIR/d48c/dir || error "remove cwd $DIR/d48c/dir failed" + $TRACE rmdir $DIR/d48c/dir || error "remove cwd $DIR/d48c/dir failed" $TRACE touch foo && error "'touch foo' worked after removing cwd" $TRACE mkdir foo && error "'mkdir foo' worked after removing cwd" $TRACE ls . && error "'ls .' worked after removing cwd" @@ -1586,8 +1583,8 @@ test_48c() { # bug 2350 $TRACE cd . && error "'cd .' worked after removing cwd" $TRACE mkdir . && error "'mkdir .' worked after removing cwd" $TRACE rmdir . && error "'rmdir .' worked after removing cwd" - $TRACE ln -s . foo && error "'ln -s .' worked after removing cwd" ||true - $TRACE cd .. || true #bug 3415 error "'cd ..' failed after removing cwd" + $TRACE ln -s . foo && error "'ln -s .' worked after removing cwd" + $TRACE cd .. || echo "'cd ..' failed after removing cwd `pwd`" #bug 3415 } run_test 48c "Access removed working subdir (should return errors)" @@ -1597,16 +1594,17 @@ test_48d() { # bug 2350 #set -vx mkdir -p $DIR/d48d/dir cd $DIR/d48d/dir - rm -r $DIR/d48d || error "remove cwd and parent $DIR/d48d failed" - $TRACE touch foo && error "'touch foo' worked after removing cwd" - $TRACE mkdir foo && error "'mkdir foo' worked after removing cwd" - $TRACE ls . && error "'ls .' worked after removing cwd" - $TRACE ls .. #bug 3415 && error "'ls ..' worked after removing cwd" - $TRACE cd . && error "'cd .' worked after recreate cwd" - $TRACE mkdir . && error "'mkdir .' worked after removing cwd" - $TRACE rmdir . && error "'rmdir .' worked after removing cwd" - $TRACE ln -s . foo && error "'ln -s .' worked after removing cwd" ||true - $TRACE cd .. && error "'cd ..' worked after recreate cwd" || true + $TRACE rmdir $DIR/d48d/dir || error "remove cwd $DIR/d48d/dir failed" + $TRACE rmdir $DIR/d48d || error "remove parent $DIR/d48d failed" + $TRACE touch foo && error "'touch foo' worked after removing parent" + $TRACE mkdir foo && error "'mkdir foo' worked after removing parent" + $TRACE ls . && error "'ls .' worked after removing parent" + $TRACE ls .. && error "'ls ..' worked after removing parent" + $TRACE cd . && error "'cd .' worked after recreate parent" + $TRACE mkdir . && error "'mkdir .' worked after removing parent" + $TRACE rmdir . && error "'rmdir .' worked after removing parent" + $TRACE ln -s . foo && error "'ln -s .' worked after removing parent" + $TRACE cd .. && error "'cd ..' worked after recreate parent" || true } run_test 48d "Access removed parent subdir (should return errors)" @@ -1734,14 +1732,24 @@ test_54d() { } run_test 54d "fifo device works in lustre ======================" +check_fstype() { + grep -q $FSTYPE /proc/filesystems && return 0 + modprobe $FSTYPE + grep -q $FSTYPE /proc/filesystems && return 0 + insmod ../$FSTYPE/$FSTYPE.o + grep -q $FSTYPE /proc/filesystems && return 0 + return 1 +} + test_55() { rm -rf $DIR/d55 mkdir $DIR/d55 - mount -t ext3 -o loop,iopen $EXT3_DEV $DIR/d55 || error "mounting" + check_fstype && echo "can't find fs $FSTYPE, skipping test 55" && return + mount -t $FSTYPE -o loop,iopen $EXT2_DEV $DIR/d55 || error "mounting" touch $DIR/d55/foo $IOPENTEST1 $DIR/d55/foo $DIR/d55 || error "running $IOPENTEST1" $IOPENTEST2 $DIR/d55 || error "running $IOPENTEST2" - echo "check for $EXT3_DEV. Please wait..." + echo "check for $EXT2_DEV. Please wait..." rm -rf $DIR/d55/* umount $DIR/d55 || error "unmounting" } diff --git a/lustre/tests/uml.sh b/lustre/tests/uml.sh index 9195e59..342883b 100644 --- a/lustre/tests/uml.sh +++ b/lustre/tests/uml.sh @@ -15,6 +15,7 @@ OSTDEVBASE=$TMP/ost #etc OSTSIZE=${OSTSIZE:-100000} STRIPECNT=${STRIPECNT:-1} +STRIPESZ=${STRIPESZ:-$((1024 * 1024))} OSDTYPE=${OSDTYPE:-obdfilter} OSTFAILOVER=${OSTFAILOVER:-} @@ -87,7 +88,7 @@ echo; echo "adding MDS on: $MDSNODE" ${LMC} -m $config --add mds --format --node $MDSNODE --mds mds1 --fstype $FSTYPE --dev $MDSDEV --size $MDSSIZE ||exit 10 # configure ost -${LMC} -m $config --add lov --lov lov1 --mds mds1 --stripe_sz 65536 --stripe_cnt $STRIPECNT --stripe_pattern 0 || exit 20 +${LMC} -m $config --add lov --lov lov1 --mds mds1 --stripe_sz $STRIPESZ --stripe_cnt $STRIPECNT --stripe_pattern 0 || exit 20 COUNT=1 echo -n "adding OST on:" for NODE in $OSTNODES; do diff --git a/lustre/utils/lconf b/lustre/utils/lconf index 7fd6c6b..a24f263 100755 --- a/lustre/utils/lconf +++ b/lustre/utils/lconf @@ -1867,10 +1867,29 @@ def generate_client_uuid(name): return client_uuid[:36] +def my_rstrip(s, chars): + """my_rstrip(s, chars) -> strips any instances of the characters + found in chars from the right side of string s""" + # XXX required because python versions pre 2.2.3 don't allow + #string.rstrip() to take alternate char lists + import string + ns=s + try: + ns = string.rstrip(s, '/') + except TypeError, e: + for i in range(len(s) - 1, 0, -1): + if s[i] in chars: + continue + else: + ns = s[0:i+1] + break + return ns + + class Mountpoint(Module): def __init__(self,db): Module.__init__(self, 'MTPT', db) - self.path = self.db.get_val('path') + self.path = my_rstrip(self.db.get_val('path'), '/') self.fs_uuid = self.db.get_first_ref('filesystem') fs = self.db.lookup(self.fs_uuid) self.mds_uuid = fs.get_first_ref('mds') @@ -2416,8 +2435,8 @@ def sys_optimize_elan (): "/proc/qsnet/elan3/config/eventint_punt_loops", "/proc/qsnet/elan4/config/elan4_mainint_punt_loops"] for p in procfiles: - if os.access(p, os.R_OK): - run ("echo 0 > " + p) + if os.access(p, os.W_OK): + run ("echo 1 > " + p) def sys_set_ptldebug(ptldebug): if config.ptldebug: diff --git a/lustre/utils/llmount.c b/lustre/utils/llmount.c index 8e75f5c..a434021 100644 --- a/lustre/utils/llmount.c +++ b/lustre/utils/llmount.c @@ -132,7 +132,7 @@ print_options(struct lustre_mount_data *lmd) printf("port: %d\n", lmd->lmd_port); for (i = 0; i < route_index; i++) - printf("route: 0x%llx : 0x%llx - 0x%llx\n", + printf("route: "LPX64" : "LPX64" - "LPX64"\n", routes[i].gw, routes[i].lo, routes[i].hi); return 0; @@ -487,9 +487,9 @@ static int set_routes(struct lustre_mount_data *lmd) { rc = l_ioctl(PORTALS_DEV_ID, IOC_PORTAL_NAL_CMD, &data); if (rc != 0) { fprintf(stderr, "%s: Unable to add route " - "0x%llx : 0x%llx - 0x%llx\n[%d] %s\n", - progname, routes[i].gw, routes[i].lo, - routes[i].hi, errno, strerror(errno)); + LPX64" : "LPX64" - "LPX64"\n[%d] %s\n", + progname, routes[i].gw, routes[i].lo, + routes[i].hi, errno, strerror(errno)); err = -1; break; }