]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_info: limit findmnt to find mounted xfs filesystems
authorAmir Goldstein <amir73il@gmail.com>
Tue, 25 Jun 2019 21:04:42 +0000 (17:04 -0400)
committerEric Sandeen <sandeen@redhat.com>
Tue, 25 Jun 2019 21:04:42 +0000 (17:04 -0400)
When running xfstests with -overlay, the xfs mount point
(a.k.a $OVL_BASE_SCRATCH_MNT) is used as the $SCRATCH_DEV argument
to the overlay mount, like this:

/dev/vdf /vdf xfs rw,relatime,attr2,inode64,noquota 0 0
/vdf /vdf/ovl-mnt overlay rw,lowerdir=/vdf/lower,upperdir=/vdf/upper...

Ever since commit bbb43745, when xfs_info started using findmnt,
when calling the helper `_supports_filetype /vdf` it returns false,
and reports: "/vdf/ovl-mnt: Not on a mounted XFS filesystem".

Fix this ambiguity by preferring to query a mounted XFS filesystem,
if one can be found.

Fixes: bbb43745 ("xfs_info: use findmnt to handle mounted block devices")
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
spaceman/xfs_info.sh

index 1bf6d2c30e1854adbd87fac8fa0733dc046324c1..3b10dc14ad71d60e55754f9ac92452b418e91544 100755 (executable)
@@ -40,7 +40,7 @@ case $# in
 
                # If we find a mountpoint for the device, do a live query;
                # otherwise try reading the fs with xfs_db.
-               if mountpt="$(findmnt -f -n -o TARGET "${arg}" 2> /dev/null)"; then
+               if mountpt="$(findmnt -t xfs -f -n -o TARGET "${arg}" 2> /dev/null)"; then
                        xfs_spaceman -p xfs_info -c "info" $OPTS "${mountpt}"
                        status=$?
                else