]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
common/rc: _fs_sysfs_dname fetch fsid using btrfs tool
authorAnand Jain <anand.jain@oracle.com>
Thu, 2 Nov 2023 11:28:18 +0000 (19:28 +0800)
committerZorro Lang <zlang@kernel.org>
Thu, 16 Nov 2023 02:42:39 +0000 (10:42 +0800)
Currently _fs_sysfs_dname gets fsid from the findmnt command however
this command provides the metadata_uuid if the device is mounted with
temp-fsid. So instead, use btrfs filesystem show command to know the fsid.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/rc

index 259a1ffb09b9dd6e18992ad8fade678e0c5e9dec..7f14c19ca89e5841203da0a98ab009b404e566d5 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -4721,6 +4721,7 @@ _require_statx()
 _fs_sysfs_dname()
 {
        local dev=$1
+       local fsid
 
        if [ ! -b "$dev" ]; then
                _fail "Usage: _fs_sysfs_dname <mounted_device>"
@@ -4728,7 +4729,9 @@ _fs_sysfs_dname()
 
        case "$FSTYP" in
        btrfs)
-               findmnt -n -o UUID ${dev} ;;
+               fsid=$($BTRFS_UTIL_PROG filesystem show ${dev} | grep uuid: | \
+                                                       $AWK_PROG '{print $NF}')
+               echo $fsid ;;
        *)
                _short_dev $dev ;;
        esac