xfs_info: limit findmnt to find mounted xfs filesystems
diff mbox series

Message ID 20190617095447.3748-1-amir73il@gmail.com
State New
Headers show
Series
  • xfs_info: limit findmnt to find mounted xfs filesystems
Related show

Commit Message

Amir Goldstein June 17, 2019, 9:54 a.m. UTC
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>
---

Eric,

FYI, I don't *need* to fix xfs_info in order to fix xfstests
and I do plan to send an independent fix to xfstests, but this
seems like a correct fix regardless of the specific xfstests
regression.

Thanks,
Amir.

 spaceman/xfs_info.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Darrick J. Wong June 17, 2019, 6:22 p.m. UTC | #1
On Mon, Jun 17, 2019 at 12:54:47PM +0300, Amir Goldstein wrote:
> 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>

Looks good to me, so long as findmnt /has/ a -t option in, uh, whatever
enterprise distro(s) for which the xfsprogs maintainer might be a
stakeholder. :)

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
> 
> Eric,
> 
> FYI, I don't *need* to fix xfs_info in order to fix xfstests
> and I do plan to send an independent fix to xfstests, but this
> seems like a correct fix regardless of the specific xfstests
> regression.
> 
> Thanks,
> Amir.
> 
>  spaceman/xfs_info.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/spaceman/xfs_info.sh b/spaceman/xfs_info.sh
> index 1bf6d2c3..3b10dc14 100755
> --- a/spaceman/xfs_info.sh
> +++ b/spaceman/xfs_info.sh
> @@ -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
> -- 
> 2.17.1
>
Eric Sandeen June 17, 2019, 6:23 p.m. UTC | #2
On 6/17/19 1:22 PM, Darrick J. Wong wrote:
> On Mon, Jun 17, 2019 at 12:54:47PM +0300, Amir Goldstein wrote:
>> 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>
> 
> Looks good to me, so long as findmnt /has/ a -t option in, uh, whatever
> enterprise distro(s) for which the xfsprogs maintainer might be a
> stakeholder. :)

:D

-t goes way back so this should be no problem.

Thanks, Amir.

-Eric

> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> 
> --D
> 
>> ---
>>
>> Eric,
>>
>> FYI, I don't *need* to fix xfs_info in order to fix xfstests
>> and I do plan to send an independent fix to xfstests, but this
>> seems like a correct fix regardless of the specific xfstests
>> regression.
>>
>> Thanks,
>> Amir.
>>
>>  spaceman/xfs_info.sh | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/spaceman/xfs_info.sh b/spaceman/xfs_info.sh
>> index 1bf6d2c3..3b10dc14 100755
>> --- a/spaceman/xfs_info.sh
>> +++ b/spaceman/xfs_info.sh
>> @@ -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
>> -- 
>> 2.17.1
>>
>
Christoph Hellwig June 25, 2019, 2:30 p.m. UTC | #3
Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

Patch
diff mbox series

diff --git a/spaceman/xfs_info.sh b/spaceman/xfs_info.sh
index 1bf6d2c3..3b10dc14 100755
--- a/spaceman/xfs_info.sh
+++ b/spaceman/xfs_info.sh
@@ -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