From: Eryu Guan <eguan@redhat.com>
To: fstests@vger.kernel.org
Cc: linux-unionfs@vger.kernel.org, Eryu Guan <eguan@redhat.com>
Subject: [PATCH] common/rc: fix detection of already mounted test device
Date: Thu, 15 Dec 2016 15:19:31 +0800 [thread overview]
Message-ID: <20161215071931.31651-1-eguan@redhat.com> (raw)
I saw this failure in overlayfs testing:
+$SCRATCH_DEV=/mnt/ovl/scratch is mounted but not on $SCRATCH_MNT=/mnt/xfstests/mnt2 - aborting
+Already mounted result:
+/dev/sda5 on /mnt/ovl/scratch type xfs (rw,relatime,seclabel,attr2,inode64,logbsize=256k,sunit=512,swidth=1536,noquota)
Because we grep for TEST_DEV and SCRATCH_DEV in mount output to see
if test device is already mounted, and report failure if device is
not mounted at desired mount point, but in the case of overlayfs
testing these "test device"s are directories and may have other real
devices mounted there.
Fix it by checking TEST_DEV and SCRATCH_DEV at the beginning of
mount entries.
Signed-off-by: Eryu Guan <eguan@redhat.com>
---
common/rc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/rc b/common/rc
index 26d715d..6fcab17 100644
--- a/common/rc
+++ b/common/rc
@@ -1363,7 +1363,7 @@ _require_scratch_nocheck()
# mounted?
# Note that we use -F here so grep doesn't try to interpret an NFS over
# IPv6 server as a regular expression.
- mount_rec=`_mount | grep -F $SCRATCH_DEV`
+ mount_rec=`_mount | grep -F "^$SCRATCH_DEV"`
if [ "$mount_rec" ]
then
# if it's mounted, make sure its on $SCRATCH_MNT
@@ -1448,7 +1448,7 @@ _require_test()
# mounted?
# Note that we use -F here so grep doesn't try to interpret an NFS over
# IPv6 server as a regular expression.
- mount_rec=`_mount | grep -F $TEST_DEV`
+ mount_rec=`_mount | grep -F "^$TEST_DEV"`
if [ "$mount_rec" ]
then
# if it's mounted, make sure its on $TEST_DIR
--
2.9.3
next reply other threads:[~2016-12-15 7:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-15 7:19 Eryu Guan [this message]
2016-12-15 7:54 ` [PATCH] common/rc: fix detection of already mounted test device Amir Goldstein
2016-12-15 8:23 ` Eryu Guan
2016-12-15 9:01 ` [PATCH v2] " Eryu Guan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161215071931.31651-1-eguan@redhat.com \
--to=eguan@redhat.com \
--cc=fstests@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox