[PATCH v4 1/5] common/rc: _fs_sysfs_dname fetch fsid using btrfs tool

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



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@xxxxxxxxxx>
Reviewed-by: Filipe Manana <fdmanana@xxxxxxxx>
---
v3: add local variable fsid

 common/rc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/common/rc b/common/rc
index 259a1ffb09b9..7f14c19ca89e 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
-- 
2.31.1





[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux