aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnand Jain <anand.jain@oracle.com>2023-11-02 19:28:18 +0800
committerZorro Lang <zlang@kernel.org>2023-11-16 10:42:39 +0800
commit22bca8d9a6d9fba0ac240ed95a42f44110e31910 (patch)
treea0203b0d1f36d4f48c58883425f9f51ef8fd04e2
parent88334112f9cb7ec5733f5e41017a4c07b3d37636 (diff)
downloadxfstests-dev-22bca8d9a6d9fba0ac240ed95a42f44110e31910.tar.gz
common/rc: _fs_sysfs_dname fetch fsid using btrfs tool
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>
-rw-r--r--common/rc5
1 files changed, 4 insertions, 1 deletions
diff --git a/common/rc b/common/rc
index 259a1ffb09..7f14c19ca8 100644
--- 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