Re: [PATCH 1/6 v3] common/rc: _fs_sysfs_dname fetch fsid using btrfs tool

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





On 10/31/23 00:16, Filipe Manana wrote:
On Mon, Oct 30, 2023 at 2:15 PM Anand Jain <anand.jain@xxxxxxxxxx> wrote:

Currently _fs_sysfs_dname gets fsid from the findmnt command however
this command provides the metadata_uuid in the context device is

in -> if

mounted with temp-fsid. So instead, use btrfs filesystem show command to
know the temp-fsid.

Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
---

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..18d2ddcf8e35 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 '{print $NF}')

awk -> $AWK_PROG

Besides that, it looks fine, thanks.

Reviewed-by: Filipe Manana <fdmanana@xxxxxxxx>


Fixed locally. Thx.

Anand

+               echo $fsid ;;
         *)
                 _short_dev $dev ;;
         esac
--
2.39.3





[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