From bc1e9a6998086557e1006918eb0326b77d0aa0dc Mon Sep 17 00:00:00 2001 From: yury Date: Thu, 12 May 2005 14:35:27 +0000 Subject: [PATCH] - fixed sys_umount() code path. It did not release intent what caused memory leaks in sanity-gns.sh, as it uses umount for cleanups while testing GNS. - do not free intent in GNS case if it is not lookup_it, only drop lock. - added test_3a which checks disabling GNS mount point using chmod u-s --- ...-intent_release_umount-vanilla-2.6.10-fc3.patch | 10 ++++ lustre/kernel_patches/series/2.6-fc3-uml.series | 2 +- lustre/kernel_patches/series/2.6-fc3.series | 2 +- lustre/llite/dcache.c | 11 ----- lustre/llite/namei.c | 4 +- lustre/mds/mds_open.c | 2 +- lustre/tests/sanity-gns.sh | 57 ++++++++++++++++++++++ 7 files changed, 71 insertions(+), 17 deletions(-) create mode 100644 lustre/kernel_patches/patches/vfs-intent_release_umount-vanilla-2.6.10-fc3.patch diff --git a/lustre/kernel_patches/patches/vfs-intent_release_umount-vanilla-2.6.10-fc3.patch b/lustre/kernel_patches/patches/vfs-intent_release_umount-vanilla-2.6.10-fc3.patch new file mode 100644 index 0000000..df85b6b --- /dev/null +++ b/lustre/kernel_patches/patches/vfs-intent_release_umount-vanilla-2.6.10-fc3.patch @@ -0,0 +1,10 @@ +--- linux-2.6.10.orig/fs/namei.c 2005-05-12 17:14:20.000000000 +0300 ++++ linux-2.6.10/fs/namei.c 2005-05-12 17:19:41.000000000 +0300 +@@ -343,6 +343,7 @@ void path_release(struct nameidata *nd) + */ + void path_release_on_umount(struct nameidata *nd) + { ++ intent_release(&nd->intent.open); + dput(nd->dentry); + _mntput(nd->mnt); + } diff --git a/lustre/kernel_patches/series/2.6-fc3-uml.series b/lustre/kernel_patches/series/2.6-fc3-uml.series index ea0859d..295c4a8 100644 --- a/lustre/kernel_patches/series/2.6-fc3-uml.series +++ b/lustre/kernel_patches/series/2.6-fc3-uml.series @@ -22,4 +22,4 @@ vfs_gns-2.6.10-fc3.patch vfs_lookup_in_file-2.6.patch jbd-2.6.10-jcberr.patch hostfs_readdir_large.patch - +vfs-intent_release_umount-vanilla-2.6.10-fc3.patch diff --git a/lustre/kernel_patches/series/2.6-fc3.series b/lustre/kernel_patches/series/2.6-fc3.series index 6d97e05..3e2783e 100644 --- a/lustre/kernel_patches/series/2.6-fc3.series +++ b/lustre/kernel_patches/series/2.6-fc3.series @@ -24,4 +24,4 @@ jbd-2.6.10-jcberr.patch hostfs_readdir_large.patch linux-2.6.10-fc3-left.patch linux-2.6.10-fc3-lkcd.patch - +vfs-intent_release_umount-vanilla-2.6.10-fc3.patch diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index 87a828d..427c07a 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -491,22 +491,11 @@ out: * they never should be passed to lookup() */ if (!ll_special_name(de)) { - /* XXX umka: if req not NULL we might need free - * the req we already obtianed? - */ LASSERT(req == NULL); - if (it == &lookup_it) { ll_intent_release(it); } else { - /* - * dropping lock and freeing intent allocated in - * ll_frob_intent(). Do not release it (that is - * do not put it->magic to 0), as it will be - * used later by ll_lookup_it(). --umka - */ ll_intent_drop_lock(it); - ll_intent_free(it); } ll_unhash_aliases(de->d_inode); RETURN (0); diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 0c63cc9..e322639 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -399,10 +399,8 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, ((flags & LOOKUP_CONTINUE) || (gns_it & (IT_CHDIR | IT_OPEN)))) { rc = ll_gns_mount_object(dentry, nd->mnt); - if (rc == -ERESTARTSYS) { - /* causing syscall restart */ + if (rc == -ERESTARTSYS) GOTO(out, retval = ERR_PTR(-ERESTARTSYS)); - } if (rc) { /* diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index 37d21bf..4396fe5 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -1039,7 +1039,7 @@ got_child: mds_pack_dentry2body(obd, body, dchild, 1); intent_set_disposition(rep, DISP_LOOKUP_POS); intent_set_disposition(rep, DISP_LOOKUP_EXECD); - + #ifdef S_PDIROPS if (parent_lockh[1].cookie != 0) ldlm_lock_decref(parent_lockh + 1, update_mode); diff --git a/lustre/tests/sanity-gns.sh b/lustre/tests/sanity-gns.sh index 59e08f5..e03b0df 100644 --- a/lustre/tests/sanity-gns.sh +++ b/lustre/tests/sanity-gns.sh @@ -1084,6 +1084,63 @@ $TIMOUT $TICK GENERIC BG OPEN || { run_test 2h " odd conditions (mounting in background) ===================" +test_3a() { + local LOOP_DEV=$(find_free_loop 2>/dev/null) + local LOOP_FILE="$TMP/gns_loop_3a" + local OBJECT=".mntinfo" + local TIMOUT=5 + local TICK=1 + + test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV || + error "can't find free loop device" + + echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..." + cleanup_loop $LOOP_DEV $LOOP_FILE + setup_loop $LOOP_DEV $LOOP_FILE || error + + echo "setting up GNS timeouts and mount object..." + setup_gns $OBJECT $TIMOUT $TICK || error + + disable_gns + + echo "preparing mount object at $DIR/gns_test_3a/$OBJECT..." + setup_object $DIR/gns_test_3a $OBJECT "-t ext2 $LOOP_DEV" || error + + enable_gns + + echo "" + echo "testing GNS with GENERIC upcall in GENERIC mode" + + check_gns GENERIC $DIR/gns_test_3a $DIR/gns_test_3a \ +$TIMOUT $TICK GENERIC FG OPEN || { + disable_gns + cleanup_object $DIR/gns_test_3a + cleanup_loop $LOOP_DEV $LOOP_FILE + error + } + + chmod u-s $DIR/gns_test_3a || { + disable_gns + cleanup_object $DIR/gns_test_3a + cleanup_loop $LOOP_DEV $LOOP_FILE + error "can't chmod u-s $DIR/gns_test_3a" + } + + check_mnt $DIR/gns_test_3a && { + disable_gns + cleanup_object $DIR/gns_test_3a + cleanup_loop $LOOP_DEV $LOOP_FILE + error "chmod u-s $DIR/gns_test_3a caused mounting" + } + + disable_gns + cleanup_object $DIR/gns_test_3a + cleanup_loop $LOOP_DEV $LOOP_FILE + return 0 +} + +run_test 3a " removing mnt by chmod u-s =================================" + TMPDIR=$OLDTMPDIR TMP=$OLDTMP HOME=$OLDHOME -- 1.8.3.1