]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
xfs: check that the mountpoint is actually mounted in _supports_xfs_scrub
authorChristoph Hellwig <hch@lst.de>
Fri, 12 Jan 2024 05:08:30 +0000 (06:08 +0100)
committerZorro Lang <zlang@kernel.org>
Sun, 14 Jan 2024 12:39:09 +0000 (20:39 +0800)
Add a sanity check that the passed in mount point is actually mounted
to guard against actually calling _supports_xfs_scrub before
$SCRATCH_MNT is mounted.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/xfs

index f53b33fc54f707a07a6f719ba75f27eb9d71c63a..4e54d75cc7ddd7c58cebf000ec88c8dfb3995a87 100644 (file)
@@ -649,6 +649,9 @@ _supports_xfs_scrub()
        test "$FSTYP" = "xfs" || return 1
        test -x "$XFS_SCRUB_PROG" || return 1
 
+       mountpoint $mountpoint >/dev/null || \
+               _fail "$mountpoint is not mounted"
+
        # Probe for kernel support...
        $XFS_IO_PROG -c 'help scrub' 2>&1 | grep -q 'types are:.*probe' || return 1
        $XFS_IO_PROG -c "scrub probe" "$mountpoint" 2>&1 | grep -q "Inappropriate ioctl" && return 1