From 7fa44f5ecdb41dbf7bf07d898a82626212200964 Mon Sep 17 00:00:00 2001 From: adilger Date: Tue, 21 Dec 2004 09:43:56 +0000 Subject: [PATCH] Land b1_4_smallfix onto b1_4 (20041221_0116) - fix 2.6 build problems - fix mount usage message, return errors per mount(8) - change grep [] to grep "[]" in tests so they work in more UMLs --- lustre/ChangeLog | 43 +++---- lustre/autoconf/lustre-core.m4 | 29 +++++ lustre/autoconf/lustre-version.ac | 2 +- lustre/configure.in | 235 -------------------------------------- lustre/llite/llite_internal.h | 13 ++- lustre/llite/llite_lib.c | 31 ++++- lustre/llite/rw.c | 8 -- lustre/llite/super.c | 21 ++-- lustre/llite/super25.c | 15 ++- lustre/mds/mds_internal.h | 32 +++--- lustre/osc/osc_request.c | 6 +- lustre/tests/oos.sh | 2 +- lustre/tests/oos2.sh | 2 +- lustre/tests/sanity.sh | 4 +- lustre/tests/sanityN.sh | 2 +- lustre/utils/lconf | 43 +++---- lustre/utils/llmount.c | 29 +++-- 17 files changed, 174 insertions(+), 343 deletions(-) delete mode 100644 lustre/configure.in diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 5030968..1e298b6 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -1,28 +1,31 @@ tbd Cluster File Systems, Inc. * version 1.4.1 * bug fixes - - don't keep a lock reference when lock is not granted (4238) - - unsafe list practices (rarely) led to infinite eviction loop (4908) + - don't keep a lock reference when lock is not granted (4238) + - unsafe list practices (rarely) led to infinite eviction loop (4908) - add per-fs limit of Lustre pages in page cache, avoid OOM (4699) - - drop import inflight refcount on signal_completed_replay error (5255) - - unlock page after async write error during send (3677) - - handle missing objects in filter_preprw_read properly (5265) + - drop import inflight refcount on signal_completed_replay error (5255) + - unlock page after async write error during send (3677) + - handle missing objects in filter_preprw_read properly (5265) - no transno return for symlink open, don't save no-trasno open (3440) - don't try to complete elan receive that already failed (4012) - free RPC server reply state on error (5406) + - clean up thread from ptlrpc_start_thread() on error (5160) * miscellania - - service request history (4965) - - put {ll,lov,osc}_async_page structs in a single slab (4699) - - create an "evict_client" /proc entry on OSTs, like the MDS has - - fix ppc64/x86_64 spec to use %{_libdir} instead of /usr/lib (5389) + - service request history (4965) + - put {ll,lov,osc}_async_page structs in a single slab (4699) + - create an "evict_client" /proc entry on OSTs, like the MDS has + - fix mount usage message, return errors per mount(8) + - change grep [] to grep "[]" in tests so they work in more UMLs + - fix ppc64/x86_64 spec to use %{_libdir} instead of /usr/lib (5389) 2004-11-23 Cluster File Systems, Inc. * version 1.4.0 * bug fixes - - send OST transaction number in read/write reply to free req (4966) - - don't ASSERT in ptl_send_rpc() if we run out of memory (5119) - - lock /proc/sys/portals/routes internal state, avoiding oops (4827) - - the watchdog thread now runs as interruptible (5246) + - send OST transaction number in read/write reply to free req (4966) + - don't ASSERT in ptl_send_rpc() if we run out of memory (5119) + - lock /proc/sys/portals/routes internal state, avoiding oops (4827) + - the watchdog thread now runs as interruptible (5246) - flock/lockf fixes (but it's still disabled, pending 5135) - don't use EXT3 constants in llite code (5094) - memory shortage at startup could cause assertion (5176) @@ -586,7 +589,7 @@ tbd Cluster File Systems, Inc. - return 0 from revalidate2 if ll_intent_lock returns -EINTR (912) - fix leak in bulk IO when only partially completed (899, 900, 926) - fix O_DIRECT for ia64 (55) - - (almost) eliminate Lustre-kernel-thread effects on load average (722) + - (almost) eliminate Lustre-kernel-thread effects on load average (722) - C-z after timeout could hang a process forever; fixed (977) * Features - client-side I/O cache (678, 924, 929, 941, 970) @@ -600,7 +603,7 @@ tbd Cluster File Systems, Inc. - Fix ldlm_lock_match on the MDS to avoid matching remote locks (592) - Fix fsfilt_extN_readpage() to read a full page of directory entries, or fake the remainder if PAGE_SIZE != blocksize (500) - - Avoid extra mdc_getattr() in ll_intent_lock when possible (534, 604) + - Avoid extra mdc_getattr() in ll_intent_lock when possible (534, 604) - Fix imbalanced LOV object allocation and out-of-bound access (469) - Most intent operations were removed, in favour of a new RPC mode that does a single RPC to the server and bypasses most of the VFS @@ -734,12 +737,12 @@ tbd Cluster File Systems, Inc. - properly abstracted the echo client - OSC locked 1 byte too many; fixed - rewrote brw callback code: - - fixed recovery bugs related to LOVs (306) - - fixed too-many-pages-in-one-write crash (191) - - fixed (again) crash in sync_io_timeout (214) - - probably fixed callback-related race (385) + - fixed recovery bugs related to LOVs (306) + - fixed too-many-pages-in-one-write crash (191) + - fixed (again) crash in sync_io_timeout (214) + - probably fixed callback-related race (385) * protocol change - - Add capability to MDS protocol + - Add capability to MDS protocol - LDLM cancellations and callbacks on different portals 2002-10-28 Andreas Dilger diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index e034e66..7103634 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -216,6 +216,34 @@ LB_LINUX_TRY_COMPILE([ ]) # +# LC_FUNC_REGISTER_CACHE +# +# if register_cache() is defined by kernel +# +AC_DEFUN([LC_FUNC_REGISTER_CACHE], +[AC_MSG_CHECKING([if kernel defines register_cache()]) +LB_LINUX_TRY_COMPILE([ + #include + #include +],[ + struct cache_definition cache; +],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_REGISTER_CACHE, 1, [register_cache found]) + AC_MSG_CHECKING([if kernel expects return from cache shrink function]) + HAVE_CACHE_RETURN_INT="`grep -c 'int.*shrink' $LINUX/include/linux/cache_def.h`" + if test "$HAVE_CACHE_RETURN_INT" != 0 ; then + AC_DEFINE(HAVE_CACHE_RETURN_INT, 1, [kernel expects return from shrink_cache]) + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi +],[ + AC_MSG_RESULT([no]) +]) +]) + +# # LC_CONFIG_BACKINGFS # # whether to use extN or ldiskfs instead of ext3 @@ -334,6 +362,7 @@ LC_FUNC_PDE LC_FUNC_DIRECT_IO LC_HEADER_MM_INLINE LC_STRUCT_INODE +LC_FUNC_REGISTER_CACHE ]) # diff --git a/lustre/autoconf/lustre-version.ac b/lustre/autoconf/lustre-version.ac index b0d4338..5293560 100644 --- a/lustre/autoconf/lustre-version.ac +++ b/lustre/autoconf/lustre-version.ac @@ -1 +1 @@ -m4_define([LUSTRE_VERSION],[1.4.0.1]) +m4_define([LUSTRE_VERSION],[1.4.0.3]) diff --git a/lustre/configure.in b/lustre/configure.in deleted file mode 100644 index 7d24dea..0000000 --- a/lustre/configure.in +++ /dev/null @@ -1,235 +0,0 @@ -# Copyright (C) 2001-2003 Cluster File Systems, Inc. -# -# This code is issued under the GNU General Public License. -# See the file COPYING in this distribution - -AC_INIT -AC_CANONICAL_SYSTEM -AM_INIT_AUTOMAKE(lustre, 1.4.0.3) -# AM_MAINTAINER_MODE - -# Four main targets: lustre kernel modules, utilities, tests, and liblustre -AC_MSG_CHECKING([whether to build kernel modules]) -AC_ARG_ENABLE([modules], - AC_HELP_STRING([--disable-modules], - [disable building of Lustre kernel modules]), - [],[enable_modules='yes']) -AC_MSG_RESULT([$enable_modules]) -AM_CONDITIONAL(MODULES, test x$enable_modules = xyes) - -AC_MSG_CHECKING([whether to build Lustre library]) -AC_ARG_ENABLE([liblustre], - AC_HELP_STRING([--disable-liblustre], - [disable building of Lustre library]), - [],[enable_liblustre='no']) -AC_MSG_RESULT([$enable_liblustre]) -AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes) - -AC_MSG_CHECKING([whether to build utilities]) -AC_ARG_ENABLE([utils], - AC_HELP_STRING([--disable-utils], - [disable building of Lustre utility programs]), - [],[enable_utils='yes']) -AC_MSG_RESULT([$enable_utils]) - -AC_MSG_CHECKING([whether to build Lustre tests]) -AC_ARG_ENABLE([tests], - AC_HELP_STRING([--disable-tests], - [disable building of Lustre tests]), - [],[enable_tests='yes']) -AC_MSG_RESULT([$enable_tests]) - -# specify wether to build doc or not -AC_MSG_CHECKING([whether to build docs]) -AC_ARG_ENABLE(doc, - AC_HELP_STRING([--disable-doc], - [skip creation of pdf documentation]), - [ - if test x$enable_doc = xyes ; then - ENABLE_DOC=1 - else - ENABLE_DOC=0 - fi - ],[ - ENABLE_DOC=0 - enable_doc='no' - ]) -AC_MSG_RESULT([$enable_doc]) -AM_CONDITIONAL(DOC, test x$ENABLE_DOC = x1) -AC_SUBST(ENABLE_DOC) - -# default backing fs is ext3 -BACKINGFS='ext3' - -# SuSE gets ldiskfs -AC_MSG_CHECKING([whether to enable ldiskfs]) -AC_ARG_ENABLE([ldiskfs], - AC_HELP_STRING([--enable-ldiskfs], - [use ldiskfs for the Lustre backing FS]), - [BACKINGFS='ldiskfs'],[enable_ldiskfs='no']) -AC_MSG_RESULT([$enable_ldiskfs]) - -AC_MSG_CHECKING([which backing filesystem to use]) -AC_MSG_RESULT([$BACKINGFS]) -AC_SUBST(BACKINGFS) - -# the pinger is temporary, until we have the recovery node in place -AC_MSG_CHECKING([whether to enable pinger support]) -AC_ARG_ENABLE([pinger], - AC_HELP_STRING([--disable-pinger], - [disable recovery pinger support]), - [],[enable_pinger='yes']) -AC_MSG_RESULT([$enable_pinger]) -if test x$enable_pinger != xno ; then - AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger) -fi - -AC_MSG_CHECKING([maximum OBD ioctl size]) -AC_ARG_WITH([obd-buffer-size], - AC_HELP_STRING([--with-obd-buffer-size=[size]], - [set lctl ioctl maximum bytes (default=8192)]), - [ - OBD_BUFFER_SIZE=$with_obd_buffer_size - ],[ - OBD_BUFFER_SIZE=8192 - ]) -AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes]) -AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size]) - -# specify location of libsysio tree -AC_MSG_CHECKING([location of libsysio]) -AC_ARG_WITH([sysio], - AC_HELP_STRING([--with-sysio=[path]], - [set path to libsysio source (default=../libsysio)]), - [ - SYSIO=$with_sysio - SYSIO_PATH=$SYSIO - ],[ - SYSIO='$(top_srcdir)/../libsysio' - SYSIO_PATH='../libsysio' - ]) -AC_MSG_RESULT([$SYSIO_PATH]) - -AC_CHECK_FILE([$SYSIO_PATH/src/libsysio.a],[], - [ - if test x$enable_liblustre = xyes ; then - AC_MSG_ERROR([A built libsysio tree is required for building liblustre.]) - fi - ]) -AC_SUBST(SYSIO) - -#build mpi-tests -AC_MSG_CHECKING([whether to build mpitests]) -AC_ARG_ENABLE([mpitests], - AC_HELP_STRING([--enable-mpitests], - [build liblustre mpi tests]), - [],[enable_mpitests=no]) -AC_MSG_RESULT([$enable_mpitests]) -AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests) - -sinclude(portals/build.m4) -sinclude(portals/archdep.m4) - -AM_CONDITIONAL(LDISKFS, test x$enable_ldiskfs = xyes) - -if test x$enable_inkernel = xyes ; then - find . -name Makefile.mk | sed 's/.mk$//' | xargs -n 1 \ - sh -e -x -c '(cp -f $0.mk $0.in)' -fi - -# we need to pass a full path here for kernel makefiles -INCLUDE_RULES="include $PWD/Rules" -AC_SUBST(INCLUDE_RULES) - -# ptlrpc kernel build requires this -LUSTRE="$PWD" -AC_SUBST(LUSTRE) - -# cray portals turns these off -AM_CONDITIONAL(UTILS, test x$enable_utils = xyes) -AM_CONDITIONAL(TESTS, test x$enable_tests = xyes) - -AM_CONFIG_HEADER(include/config.h) - -AC_OUTPUT([ -Makefile -Rules -autoMakefile -conf/Makefile -doc/Makefile -include/Makefile -include/linux/Makefile -include/lustre/Makefile -kernel_patches/targets/2.6-suse.target -kernel_patches/targets/2.6-vanilla.target -kernel_patches/targets/hp_pnnl-2.4.target -kernel_patches/targets/rh-2.4.target -kernel_patches/targets/rhel-2.4.target -kernel_patches/targets/suse-2.4.21-2.target -ldiskfs/Makefile -ldiskfs/autoMakefile -ldlm/Makefile -liblustre/Makefile -liblustre/tests/Makefile -llite/Makefile -llite/autoMakefile -lov/Makefile -lov/autoMakefile -lvfs/Makefile -lvfs/autoMakefile -mdc/Makefile -mdc/autoMakefile -mds/Makefile -mds/autoMakefile -obdclass/Makefile -obdclass/autoMakefile -obdecho/Makefile -obdecho/autoMakefile -obdfilter/Makefile -obdfilter/autoMakefile -osc/Makefile -osc/autoMakefile -ost/Makefile -ost/autoMakefile -portals/Kernelenv -portals/Makefile -portals/autoMakefile -portals/doc/Makefile -portals/include/Makefile -portals/include/linux/Makefile -portals/include/portals/Makefile -portals/knals/Makefile -portals/knals/autoMakefile -portals/knals/gmnal/Makefile -portals/knals/gmnal/autoMakefile -portals/knals/iibnal/Makefile -portals/knals/iibnal/autoMakefile -portals/knals/openibnal/Makefile -portals/knals/openibnal/autoMakefile -portals/knals/qswnal/Makefile -portals/knals/qswnal/autoMakefile -portals/knals/socknal/Makefile -portals/knals/socknal/autoMakefile -portals/knals/lonal/Makefile -portals/knals/lonal/autoMakefile -portals/knals/ranal/Makefile -portals/knals/ranal/autoMakefile -portals/libcfs/Makefile -portals/libcfs/autoMakefile -portals/portals/Makefile -portals/portals/autoMakefile -portals/router/Makefile -portals/router/autoMakefile -portals/tests/Makefile -portals/tests/autoMakefile -portals/unals/Makefile -portals/utils/Makefile -ptlrpc/Makefile -ptlrpc/autoMakefile -scripts/Makefile -scripts/lustre.spec -scripts/version_tag.pl -tests/Makefile -utils/Lustre/Makefile -utils/Makefile -]) diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 5a2e4e8..468923d 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -7,9 +7,6 @@ #include -extern struct list_head ll_super_blocks; -extern spinlock_t ll_sb_lock; - /* default to about 40meg of readahead on a given system. That much tied * up in 512k readahead requests serviced at 40ms each is about 1GB/s. */ #define SBI_DEFAULT_READAHEAD_MAX (40UL << (20 - PAGE_CACHE_SHIFT)) @@ -153,6 +150,14 @@ enum { }; extern char *llap_origins[]; +#ifdef HAVE_REGISTER_CACHE +#define ll_register_cache(cache) register_cache(cache) +#define ll_unregister_cache(cache) unregister_cache(cache) +#else +#define ll_register_cache(cache) do {} while (0) +#define ll_unregister_cache(cache) do {} while (0) +#endif + /* llite/lproc_llite.c */ int lprocfs_register_mountpoint(struct proc_dir_entry *parent, struct super_block *sb, char *osc, char *mdc); @@ -182,7 +187,7 @@ int ll_writepage(struct page *page); void ll_inode_fill_obdo(struct inode *inode, int cmd, struct obdo *oa); void ll_ap_completion(void *data, int cmd, struct obdo *oa, int rc); int llap_shrink_cache(struct ll_sb_info *sbi, int shrink_fraction); -void ll_shrink_cache(int priority, unsigned int gfp_mask); +extern struct cache_definition ll_cache_definition; void ll_removepage(struct page *page); int ll_readpage(struct file *file, struct page *page); struct ll_async_page *llap_from_cookie(void *cookie); diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index af4bca4..24d307c 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -36,6 +36,9 @@ kmem_cache_t *ll_file_data_slab; +LIST_HEAD(ll_super_blocks); +spinlock_t ll_sb_lock = SPIN_LOCK_UNLOCKED; + extern struct address_space_operations ll_aops; extern struct address_space_operations ll_dir_aops; @@ -248,6 +251,7 @@ void lustre_dump_inode(struct inode *inode) { struct list_head *tmp; int dentry_count = 0; + BDEVNAME_DECLARE_STORAGE(buf); LASSERT(inode != NULL); @@ -255,7 +259,7 @@ void lustre_dump_inode(struct inode *inode) dentry_count++; CERROR("inode %p dump: dev=%s:%lu, mode=%o, count=%u, %d dentries\n", - inode, kdevname(inode->i_sb->s_dev), inode->i_ino, + inode, ll_bdevname(inode->i_sb, buf), inode->i_ino, inode->i_mode, atomic_read(&inode->i_count), dentry_count); } @@ -783,6 +787,31 @@ void lustre_put_super(struct super_block *sb) EXIT; } /* lustre_put_super */ +#ifdef HAVE_REGISTER_CACHE +#include +#ifdef HAVE_CACHE_RETURN_INT +static int +#else +static void +#endif +ll_shrink_cache(int priority, unsigned int gfp_mask) +{ + struct ll_sb_info *sbi; + int count = 0; + + list_for_each_entry(sbi, &ll_super_blocks, ll_list) + count += llap_shrink_cache(sbi, priority); + +#ifdef HAVE_CACHE_RETURN_INT + return count; +#endif +} + +struct cache_definition ll_cache_definition = { + .name = "llap_cache", + .shrink = ll_shrink_cache +}; +#endif /* HAVE_REGISTER_CACHE */ struct inode *ll_inode_from_lock(struct ldlm_lock *lock) { diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 05303eb..bd4ec72 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -459,14 +459,6 @@ int llap_shrink_cache(struct ll_sb_info *sbi, int shrink_fraction) return count; } -void ll_shrink_cache(int priority, unsigned int gfp_mask) -{ - struct ll_sb_info *sbi; - - list_for_each_entry(sbi, &ll_super_blocks, ll_list) - llap_shrink_cache(sbi, priority); -} - struct ll_async_page *llap_from_page(struct page *page, unsigned origin) { struct ll_async_page *llap; diff --git a/lustre/llite/super.c b/lustre/llite/super.c index 3cccf42..dc8f15c 100644 --- a/lustre/llite/super.c +++ b/lustre/llite/super.c @@ -40,14 +40,6 @@ extern struct address_space_operations ll_aops; extern struct address_space_operations ll_dir_aops; -LIST_HEAD(ll_super_blocks); -spinlock_t ll_sb_lock = SPIN_LOCK_UNLOCKED; - -static struct cache_definition llap_cache_definition = { - "llap_cache", - ll_shrink_cache -}; - static struct super_block *ll_read_super(struct super_block *sb, void *data, int silent) { @@ -109,15 +101,20 @@ static int __init init_lustre_lite(void) if (ll_file_data_slab == NULL) return -ENOMEM; - proc_lustre_fs_root = proc_lustre_root ? proc_mkdir("llite", proc_lustre_root) : NULL; + proc_lustre_fs_root = proc_lustre_root ? + proc_mkdir("llite", proc_lustre_root) : NULL; - register_cache(&llap_cache_definition); + ll_register_cache(&ll_cache_definition); rc = register_filesystem(&lustre_lite_fs_type); if (rc == 0) rc = register_filesystem(&lustre_fs_type); - if (rc) + if (rc) { + /* This is safe even if lustre_lite_fs_type isn't registered */ unregister_filesystem(&lustre_lite_fs_type); + ll_unregister_cache(&ll_cache_definition); + } + return rc; } @@ -126,7 +123,7 @@ static void __exit exit_lustre_lite(void) unregister_filesystem(&lustre_lite_fs_type); unregister_filesystem(&lustre_fs_type); - unregister_cache(&llap_cache_definition); + ll_unregister_cache(&ll_cache_definition); LASSERTF(kmem_cache_destroy(ll_file_data_slab) == 0, "couldn't destroy ll_file_data slab\n"); diff --git a/lustre/llite/super25.c b/lustre/llite/super25.c index bc34d5f..aeb5b12 100644 --- a/lustre/llite/super25.c +++ b/lustre/llite/super25.c @@ -144,12 +144,18 @@ static int __init init_lustre_lite(void) proc_lustre_fs_root = proc_lustre_root ? proc_mkdir("llite", proc_lustre_root) : NULL; + ll_register_cache(&ll_cache_definition); + rc = register_filesystem(&lustre_lite_fs_type); - if (!rc) { + if (rc == 0) rc = register_filesystem(&lustre_fs_type); - if (rc) - unregister_filesystem(&lustre_fs_type); + if (rc) { + /* This is safe even if lustre_lite_fs_type isn't registered */ + unregister_filesystem(&lustre_lite_fs_type); + ll_unregister_cache(&ll_cache_definition); } + + return rc; } @@ -157,6 +163,9 @@ static void __exit exit_lustre_lite(void) { unregister_filesystem(&lustre_fs_type); unregister_filesystem(&lustre_lite_fs_type); + + ll_unregister_cache(&ll_cache_definition); + ll_destroy_inodecache(); LASSERTF(kmem_cache_destroy(ll_file_data_slab) == 0, "couldn't destroy ll_file_data slab\n"); diff --git a/lustre/mds/mds_internal.h b/lustre/mds/mds_internal.h index 139f621..8d4c65d 100644 --- a/lustre/mds/mds_internal.h +++ b/lustre/mds/mds_internal.h @@ -49,10 +49,10 @@ static inline int mds_orphan_open_dec_test(struct inode *inode) } #define mds_inode_is_orphan(inode) ((inode)->i_flags & 0x4000000) -#define mds_inode_set_orphan(inode) \ -do { \ - (inode)->i_flags |= 0x4000000; \ - CDEBUG(D_VFSTRACE, "setting orphan flag on inode %p\n", inode); \ +#define mds_inode_set_orphan(inode) \ +do { \ + (inode)->i_flags |= 0x4000000; \ + CDEBUG(D_VFSTRACE, "setting orphan flag on inode %p\n", inode); \ } while (0) #define mds_inode_unset_orphan(inode) \ do { \ @@ -61,18 +61,18 @@ do { \ } while (0) #endif /* __KERNEL__ */ -#define MDS_CHECK_RESENT(req, reconstruct) \ -{ \ - if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT) { \ - struct mds_client_data *mcd = \ - req->rq_export->exp_mds_data.med_mcd; \ - if (mcd->mcd_last_xid == req->rq_xid) { \ - reconstruct; \ - RETURN(req->rq_repmsg->status); \ - } \ - DEBUG_REQ(D_HA, req, "no reply for RESENT req (have "LPD64")", \ - mcd->mcd_last_xid); \ - } \ +#define MDS_CHECK_RESENT(req, reconstruct) \ +{ \ + if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT) { \ + struct mds_client_data *mcd = \ + req->rq_export->exp_mds_data.med_mcd; \ + if (mcd->mcd_last_xid == req->rq_xid) { \ + reconstruct; \ + RETURN(req->rq_repmsg->status); \ + } \ + DEBUG_REQ(D_HA, req, "no reply for RESENT req (have "LPD64")",\ + mcd->mcd_last_xid); \ + } \ } /* mds/mds_reint.c */ diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index adfa52d..c98ff3a 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -708,10 +708,10 @@ static obd_count cksum_blocks(int nob, obd_count page_count, off += CHECKSUM_CHUNK; count -= CHECKSUM_CHUNK; } - nob -= pga->count; - page_count--; kunmap(pga->pg); + nob -= pga->count; + page_count--; pga++; } @@ -906,7 +906,7 @@ static int osc_brw_fini_request(struct ptlrpc_request *req, struct obdo *oa, if ((cksum_missed & (-cksum_missed)) == cksum_missed) CERROR("Request checksum %u from "LPX64", no reply\n", cksum_missed, - req->rq_import->imp_connection->c_peer.peer_nid); + req->rq_import->imp_connection->c_peer.peer_id.nid); } #endif RETURN(0); diff --git a/lustre/tests/oos.sh b/lustre/tests/oos.sh index 1263b40..375f959 100755 --- a/lustre/tests/oos.sh +++ b/lustre/tests/oos.sh @@ -60,7 +60,7 @@ done if [ -z "$OSCFULL" ]; then echo "no OSTs are close to full" - grep [0-9] /proc/fs/lustre/osc/OSC*MNT*/{kbytesavail,cur*} + grep "[0-9]" /proc/fs/lustre/osc/OSC*MNT*/{kbytesavail,cur*} SUCCESS=0 fi diff --git a/lustre/tests/oos2.sh b/lustre/tests/oos2.sh index 504aa28..1b6d34d 100644 --- a/lustre/tests/oos2.sh +++ b/lustre/tests/oos2.sh @@ -61,7 +61,7 @@ for OSC in /proc/fs/lustre/osc/OSC*MNT*; do done if [ -z "$OSCFULL" ]; then echo "no OSTs are close to full" - grep [0-9] /proc/fs/lustre/osc/OSC*MNT*/{kbytesavail,cur*} |tee -a $LOG + grep "[0-9]" /proc/fs/lustre/osc/OSC*MNT*/{kbytesavail,cur*} |tee -a $LOG SUCCESS=0 fi diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index f484a77..295de48 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -927,7 +927,7 @@ cancel_lru_locks() { for d in /proc/fs/lustre/ldlm/namespaces/$1*; do echo clear > $d/lru_size done - grep [0-9] /proc/fs/lustre/ldlm/namespaces/$1*/lock_unused_count /dev/null + grep "[0-9]" /proc/fs/lustre/ldlm/namespaces/$1*/lock_unused_count /dev/null } test_29() { @@ -1451,7 +1451,7 @@ test_42a() { stop_writeback sync; sleep 1; sync # just to be safe BEFOREWRITES=`count_ost_writes` - grep [0-9] /proc/fs/lustre/osc/OSC*MNT*/cur_grant_bytes + grep "[0-9]" /proc/fs/lustre/osc/OSC*MNT*/cur_grant_bytes dd if=/dev/zero of=$DIR/f42a bs=1024 count=100 AFTERWRITES=`count_ost_writes` [ $BEFOREWRITES -eq $AFTERWRITES ] || \ diff --git a/lustre/tests/sanityN.sh b/lustre/tests/sanityN.sh index 7df1454..321d2f0 100644 --- a/lustre/tests/sanityN.sh +++ b/lustre/tests/sanityN.sh @@ -354,7 +354,7 @@ cancel_lru_locks() { for d in /proc/fs/lustre/ldlm/namespaces/$1*; do echo clear > $d/lru_size done - grep [0-9] /proc/fs/lustre/ldlm/namespaces/$1*/lock_unused_count /dev/null + grep "[0-9]" /proc/fs/lustre/ldlm/namespaces/$1*/lock_unused_count /dev/null } test_17() { # bug 3513, 3667 diff --git a/lustre/utils/lconf b/lustre/utils/lconf index 6f3ee01..06319fc 100755 --- a/lustre/utils/lconf +++ b/lustre/utils/lconf @@ -783,7 +783,7 @@ def mkfs(dev, devsize, fstype, jsize, isize, mkfsoptions, isblock=1): else: # sfdisk -s will fail for too large block device, # then, read the size of partition from /proc/partitions - + # get the realpath of the device # it may be the real device, such as /dev/hda7 # or the hardlink created via mknod for a device @@ -801,14 +801,14 @@ def mkfs(dev, devsize, fstype, jsize, isize, mkfsoptions, isblock=1): real_dev = os.path.join(os.path.dirname(real_dev), dev_link) if link_count > 19: panic("Entountered too many symbolic links resolving block device:", dev) - + # get the major and minor number of the realpath via ls # it seems python(os.stat) does not return # the st_rdev member of the stat structure ret, out = runcmd("ls -l %s" %real_dev) major = string.split(string.split(out[0])[4], ",")[0] minor = string.split(out[0])[5] - + # get the devsize from /proc/partitions with the major and minor number ret, out = runcmd("cat /proc/partitions") for line in out: @@ -1098,18 +1098,17 @@ class kmod: continue log ('loading module:', mod, 'srcdir', src_dir, 'devdir', dev_dir) if src_dir: - module = find_module(src_dir, dev_dir, mod) + module = find_module(src_dir, dev_dir, mod) if not module: panic('module not found:', mod) - (rc, out) = run('/sbin/insmod', module) + (rc, out) = run('/sbin/insmod', module) if rc and not mod_loaded(mod): raise CommandError('insmod', out, rc) else: - (rc, out) = run('/sbin/modprobe', mod) + (rc, out) = run('/sbin/modprobe', mod) if rc and not mod_loaded(mod): raise CommandError('modprobe', out, rc) - def cleanup_module(self): """Unload the modules in the list in reverse order.""" rev = self.kmodule_list @@ -1474,7 +1473,7 @@ class MDSDEV(Module): self.fstype = self.db.get_val('fstype', '') self.nspath = self.db.get_val('nspath', '') self.mkfsoptions = self.db.get_val('mkfsoptions', '') - self.mountfsoptions = self.db.get_val('mountfsoptions', '') + self.mountfsoptions = self.db.get_val('mountfsoptions', '') # overwrite the orignal MDSDEV name and uuid with the MDS name and uuid target_uuid = self.db.get_first_ref('target') mds = self.db.lookup(target_uuid) @@ -1559,7 +1558,7 @@ class MDSDEV(Module): if not is_prepared('MDT'): lctl.newdev("mdt", 'MDT', 'MDT_UUID', setup ="") try: - mountfsoptions = def_mount_options(self.fstype, 'mds') + mountfsoptions = def_mount_options(self.fstype, 'mds') if config.mountfsoptions: if mountfsoptions: @@ -1575,7 +1574,7 @@ class MDSDEV(Module): else: mountfsoptions = self.mountfsoptions - print 'MDS mount options: ' + mountfsoptions + print 'MDS mount options: ' + mountfsoptions lctl.newdev("mds", self.name, self.uuid, setup ="%s %s %s %s" %(blkdev, self.fstype, self.name, mountfsoptions)) @@ -1663,7 +1662,7 @@ class MDSDEV(Module): if ret: # In this case, although 0-conf mount works but 0-conf umount # doesn't work. As a boring result, the user is forced to - # cleanup client service manually again and again. So I prefer + # cleanup client service manually again and again. So I prefer # deleting these two llogs together and let the user write_conf. lctl.clear_log(self.name, client_name) lctl.clear_log(self.name, client_name + '-clean') @@ -1682,7 +1681,7 @@ class MDSDEV(Module): cleanup_error(e.rc) Module.cleanup(self) clean_loop(self.devpath) - + def msd_remaining(self): out = lctl.device_list() for s in out: @@ -1728,7 +1727,7 @@ class OSD(Module): self.journal_size = self.db.get_val_int('journalsize', 0) self.inode_size = self.db.get_val_int('inodesize', 0) self.mkfsoptions = self.db.get_val('mkfsoptions', '') - self.mountfsoptions = self.db.get_val('mountfsoptions', '') + self.mountfsoptions = self.db.get_val('mountfsoptions', '') self.fstype = self.db.get_val('fstype', '') self.nspath = self.db.get_val('nspath', '') target_uuid = self.db.get_first_ref('target') @@ -1784,7 +1783,7 @@ class OSD(Module): config.reformat, self.format, self.journal_size, self.inode_size, self.mkfsoptions) - mountfsoptions = def_mount_options(self.fstype, 'ost') + mountfsoptions = def_mount_options(self.fstype, 'ost') if config.mountfsoptions: if mountfsoptions: @@ -1799,8 +1798,8 @@ class OSD(Module): mountfsoptions = mountfsoptions + ',' + self.mountfsoptions else: mountfsoptions = self.mountfsoptions - - print 'OST mount options: ' + mountfsoptions + + print 'OST mount options: ' + mountfsoptions lctl.newdev(self.osdtype, self.name, self.uuid, setup ="%s %s %s %s" %(blkdev, self.fstype, @@ -1865,7 +1864,7 @@ class Client(Module): self.tgt_dev_uuid = get_active_target(tgtdb) if not self.tgt_dev_uuid: panic("No target device found for target:", self.target_name) - + self.kmod = kmod(config.lustre, config.portals) self._server = None self._connected = 0 @@ -1915,6 +1914,7 @@ class Client(Module): except CommandError, e: if not ignore_connect_failure: raise e + if srv: if self.target_uuid in config.inactive and self.permits_inactive(): debug("%s inactive" % self.target_uuid) @@ -2069,7 +2069,7 @@ class Mountpoint(Module): def __init__(self,db): Module.__init__(self, 'MTPT', db) self.path = my_rstrip(self.db.get_val('path'), '/') - self.clientoptions = self.db.get_val('clientoptions', '') + self.clientoptions = self.db.get_val('clientoptions', '') self.fs_uuid = self.db.get_first_ref('filesystem') fs = self.db.lookup(self.fs_uuid) self.mds_uuid = fs.get_first_ref('mds') @@ -2104,7 +2104,7 @@ class Mountpoint(Module): lctl.mount_option(local_node_name, self.vosc.get_name(), mdc_name) return - if config.clientoptions: + if config.clientoptions: if self.clientoptions: self.clientoptions = self.clientoptions + ',' + config.clientoptions else: @@ -2115,7 +2115,7 @@ class Mountpoint(Module): # so replace it with Lustre async self.clientoptions = string.replace(self.clientoptions, "async", "lasync") - cmd = "mount -t lustre_lite -o osc=%s,mdc=%s%s %s %s" % \ + cmd = "mount -t lustre_lite -o osc=%s,mdc=%s%s %s %s" % \ (self.vosc.get_name(), mdc_name, self.clientoptions, config.config, self.path) run("mkdir", self.path) ret, val = run(cmd) @@ -2477,6 +2477,9 @@ def doHost(lustreDB, hosts): doRecovery(lustreDB, lctl, config.tgt_uuid, config.client_uuid, config.conn_uuid) elif config.cleanup: + if not mod_loaded('portals'): + return + if config.force: # the command line can override this value timeout = 5 diff --git a/lustre/utils/llmount.c b/lustre/utils/llmount.c index bea7f5c..1a08c19 100644 --- a/lustre/utils/llmount.c +++ b/lustre/utils/llmount.c @@ -115,21 +115,20 @@ update_mtab_entry(char *spec, char *mtpt, char *type, char *opts, mnt.mnt_freq = freq; mnt.mnt_passno = pass; - if (!nomtab) { - fp = setmntent(MOUNTED, "a+"); - if (fp == NULL) { - fprintf(stderr, "%s: setmntent(%s): %s:", - progname, MOUNTED, strerror (errno)); + fp = setmntent(MOUNTED, "a+"); + if (fp == NULL) { + fprintf(stderr, "%s: setmntent(%s): %s:", + progname, MOUNTED, strerror (errno)); + rc = 16; + } else { + if ((addmntent(fp, &mnt)) == 1) { + fprintf(stderr, "%s: addmntent: %s:", + progname, strerror (errno)); rc = 16; - } else { - if ((addmntent(fp, &mnt)) == 1) { - fprintf(stderr, "%s: addmntent: %s:", - progname, strerror (errno)); - rc = 16; - } - endmntent(fp); } + endmntent(fp); } + return rc; } @@ -578,7 +577,7 @@ int main(int argc, char *const argv[]) progname = strrchr(argv[0], '/'); progname = progname ? progname + 1 : argv[0]; - while ((opt = getopt_long(argc, argv, "fno:v", long_opt, NULL)) != EOF){ + while ((opt = getopt_long(argc, argv, "fhno:v" ,long_opt,NULL)) != EOF){ switch (opt) { case 1: ++force; @@ -629,7 +628,7 @@ int main(int argc, char *const argv[]) printf("source = %s, target = %s\n", source, target); } - if (check_mtab_entry(source, target, "lustre")) + if (!force && check_mtab_entry(source, target, "lustre")) exit(32); init_options(&lmd); @@ -661,7 +660,7 @@ int main(int argc, char *const argv[]) fprintf(stderr, "Are the lustre modules loaded?\n" "Check /etc/modules.conf and /proc/filesystems\n"); rc = 32; - } else { + } else if (!nomtab) { rc = update_mtab_entry(source, target, "lustre", options,0,0,0); } return rc; -- 1.8.3.1