[Top] [All Lists]

[PATCH] xfstests: check if the scratch dev pool is mounted in _require_s

To: <xfs@xxxxxxxxxxx>, <linux-btrfs@xxxxxxxxxxxxxxx>
Subject: [PATCH] xfstests: check if the scratch dev pool is mounted in _require_scratch
From: Josef Bacik <jbacik@xxxxxxxxxxxx>
Date: Wed, 26 Jun 2013 11:49:28 -0400
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fusionio.com; s=default; t=1372261771; bh=S3YPdm4Qt3ctqi8iuP3z37w4kYLA2RFUphasTgT48WA=; h=From:To:Subject:Date; b=R73RDS4lsVytJoMz62CF7t/U9H1Lz1Y7ui9VdTRPQJLenPHP4lK2ERJnM7RYRWNIf Q47+pK5qQuuN23l3HKTH/OQbEbO1vjgFnDBIIZ/HSs1rDlQa0VC4DuciJX1D9/wM5a CZ7lP5rnhSRrUAt216ccXEuxZKXWqdEDz/ExMJic=
If you use the SCRATCH_DEV_POOL for btrfs you will end up with the command line
like this


and btrfs does this thing where it makes the lowest valued device id show up in
/proc/mounts no matter which device you specify at the mount command.  So in
this case mount will show the first device in $SCRATCH_DEV_POOL instead of
$SCRATCH_DEV, so anybody who wants to just use the scratch mnt with the scratch
dev will fail to work because we never unmount the scratch mount.  Fix this by
checking to see if the scratch dev pool is mounted at scratch mnt and unmount it
so we can run our test.  This fixes the issue I was seeing by running

./check btrfs/307 generic/015


Signed-off-by: Josef Bacik <jbacik@xxxxxxxxxxxx>
 common/rc |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/common/rc b/common/rc
index ad7cbc9..7e03400 100644
--- a/common/rc
+++ b/common/rc
@@ -938,6 +938,8 @@ _supported_os()
+    local i
     case "$FSTYP" in
                 echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
@@ -978,6 +980,17 @@ _require_scratch()
             exit 1
+    # we may have a scratch dev pool specified, so make sure it's been 
+    # from the scratch mount
+    for i in $SCRATCH_DEV_POOL; do
+        if _mount | grep $i | grep -q $SCRATCH_MNT; then
+            if ! $UMOUNT_PROG $i; then
+                echo "failed to umount $i - aborting"
+                exit 1
+            fi
+        fi
+    done
 # this test needs a logdev

<Prev in Thread] Current Thread [Next in Thread>