From: Amir Goldstein <amir73il@gmail.com>
To: Eryu Guan <eguan@redhat.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>, Xiong Zhou <xzhou@redhat.com>,
linux-unionfs@vger.kernel.org, fstests@vger.kernel.org
Subject: [PATCH v5 05/10] fstests: allow overlay SCRATCH_DEV to be a base fs mount point
Date: Tue, 28 Feb 2017 14:18:32 +0200 [thread overview]
Message-ID: <1488284317-3119-6-git-send-email-amir73il@gmail.com> (raw)
In-Reply-To: <1488284317-3119-1-git-send-email-amir73il@gmail.com>
When configure SCRATCH_DEV to a mount point (and not to a directory therein)
then user will get a false positive error in scratch tests:
$SCRATCH_DEV=/mnt/base/scratch is mounted but not on $SCRATCH_MNT=/mnt/scratch
Already mounted result:
/dev/sda6 on /mnt/base/scratch type xfs (rw,relatime,attr2,inode64,noquota)
This is due to the wrong `grep -F $SCRATCH_DEV` which matches the mount
point instead of the device in that mount.
Fix _check_mounted_on() to grep the pattern "$dev on " and "$dev on $mnt"
instead of just grepping for "$dev" and "$mnt" without the " on " anchor.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
common/rc | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/common/rc b/common/rc
index 4fa211a..fb88ffa 100644
--- a/common/rc
+++ b/common/rc
@@ -1368,12 +1368,14 @@ _check_mounted_on()
local type=$5
# Note that we use -F here so grep doesn't try to interpret an NFS over
- # IPv6 server as a regular expression
- local mount_rec=`_mount | grep -F "$dev"`
+ # IPv6 server as a regular expression. Because of that, we cannot use
+ # ^$dev so we use "$dev on " to avoid matching $dev to mount point field
+ # for overlay case, where $dev is a directory.
+ local mount_rec=`_mount | grep -F "$dev on "`
[ -n "$mount_rec" ] || return 1 # 1 = not mounted
# if it's mounted, make sure its on $mnt
- if ! (echo $mount_rec | grep -q "$mnt")
+ if ! (echo $mount_rec | grep -q "$dev on $mnt")
then
echo "$devname=$dev is mounted but not on $mntname=$mnt - aborting"
echo "Already mounted result:"
--
2.7.4
next prev parent reply other threads:[~2017-02-28 12:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-28 12:18 [PATCH v5 0/10] fstests: new way to run overlay tests Amir Goldstein
2017-02-28 12:18 ` [PATCH v5 01/10] fstests: sanity check that test partitions are not mounted elsewhere Amir Goldstein
2017-02-28 12:18 ` [PATCH v5 02/10] fstests: use _test_mount() consistently Amir Goldstein
2017-02-28 12:18 ` [PATCH v5 03/10] fstests: canonicalize mount points on every config section Amir Goldstein
2017-02-28 12:18 ` [PATCH v5 04/10] fstests: fix test and scratch filters for overlapping DEV/MNT paths Amir Goldstein
2017-02-28 12:18 ` Amir Goldstein [this message]
2017-02-28 12:18 ` [PATCH v5 06/10] generic/064: access SCRATCH_MNT after _scratch_mount Amir Goldstein
2017-02-28 12:18 ` [PATCH v5 07/10] overlay: rename OVERLAY_LOWER/UPPER/WORK_DIR Amir Goldstein
2017-02-28 12:18 ` [PATCH v5 08/10] overlay: configure TEST/SCRATCH vars to base fs Amir Goldstein
2017-02-28 12:18 ` [PATCH v5 09/10] overlay: mount/unmount base fs before/after running tests Amir Goldstein
2017-02-28 12:18 ` [PATCH v5 10/10] overlay: use OVL_BASE_SCRATCH_MNT instead of SCRATCH_DEV Amir Goldstein
2017-03-01 3:47 ` [PATCH v5 0/10] fstests: new way to run overlay tests 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=1488284317-3119-6-git-send-email-amir73il@gmail.com \
--to=amir73il@gmail.com \
--cc=eguan@redhat.com \
--cc=fstests@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=xzhou@redhat.com \
/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