mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
fstests: allow overlay SCRATCH_DEV to be a base fs mount point
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> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
committed by
Eryu Guan
parent
4e965d8516
commit
db24846eb3
@@ -1368,12 +1368,14 @@ _check_mounted_on()
|
|||||||
local type=$5
|
local type=$5
|
||||||
|
|
||||||
# Note that we use -F here so grep doesn't try to interpret an NFS over
|
# Note that we use -F here so grep doesn't try to interpret an NFS over
|
||||||
# IPv6 server as a regular expression
|
# IPv6 server as a regular expression. Because of that, we cannot use
|
||||||
local mount_rec=`_mount | grep -F "$dev"`
|
# ^$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
|
[ -n "$mount_rec" ] || return 1 # 1 = not mounted
|
||||||
|
|
||||||
# if it's mounted, make sure its on $mnt
|
# 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
|
then
|
||||||
echo "$devname=$dev is mounted but not on $mntname=$mnt - aborting"
|
echo "$devname=$dev is mounted but not on $mntname=$mnt - aborting"
|
||||||
echo "Already mounted result:"
|
echo "Already mounted result:"
|
||||||
|
|||||||
Reference in New Issue
Block a user