All of lore.kernel.org
 help / color / mirror / Atom feed
* xfstests - SCRATCH_DIR mounted/unmounted twice when testing nfs
@ 2011-05-18 12:41 Boris Ranto
  2011-05-19  0:02 ` Dave Chinner
  0 siblings, 1 reply; 4+ messages in thread
From: Boris Ranto @ 2011-05-18 12:41 UTC (permalink / raw)
  To: xfs

Tests 124, 127 and 128 unmount their SCRATCH_DEV manually while using _cleanup_testdir in trapped cleanup function.
This can lead to test fails due to double unmount on nfs where _cleanup_testdir unmounts SCRATCH_DEV.

Tests 129 and 130 use _setup_testdir and _scratch_mount that can lead to double mount on nfs where _setup_testdir mounts SCRATCH_DEV.

The least invasive patch (only nfs shall be affected by this patch) I could come up with that fixed this issue used conditional umounts in _cleanup_testdir and conditional mount/remount in _scratch_mount (remount was used so that mount flags do not get lost).

Alternatively, _setup_testdir could stop mounting SCRATCH_DEV but that would be probably too invasive.

Signed-off-by: Boris Ranto <branto@redhat.com>

diff --git a/common.rc b/common.rc
index e634fbb..6a701a6 100644
--- a/common.rc
+++ b/common.rc
@@ -227,6 +227,10 @@ _scratch_mount_options()
 
 _scratch_mount()
 {
+    if [ "$FSTYP" = "nfs" -a -n "$(_mount | grep $SCRATCH_DEV |grep
$SCRATCH_MNT)" ]
+    then
+       _scratch_unmount
+    fi
     _mount -t $FSTYP `_scratch_mount_options $*`
 }
 
@@ -1379,7 +1383,10 @@ _cleanup_testdir()
        ;;
     nfs*)
        # umount testdir as it is $SCRATCH_MNT which could be used by
xfs next
-       [ -n "$testdir" ] && $UMOUNT_PROG $testdir
+       if _mount | grep $SCRATCH_DEV |grep -q $testdir
+       then
+          [ -n "$testdir" ] && $UMOUNT_PROG $testdir
+       fi
        ;;
     *)
        # do nothing, testdir is $TEST_DIR

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-23 12:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-18 12:41 xfstests - SCRATCH_DIR mounted/unmounted twice when testing nfs Boris Ranto
2011-05-19  0:02 ` Dave Chinner
2011-05-19 11:49   ` Boris Ranto
2011-05-23 12:51     ` Boris Ranto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.