Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH 0/2] btrfs-progs: read device fsid from the sysfs
@ 2021-10-19  0:23 Anand Jain
  2021-10-19  0:23 ` [PATCH 1/2] btrfs-progs: prepare helper device_is_seed Anand Jain
                   ` (4 more replies)
  0 siblings, 5 replies; 19+ messages in thread
From: Anand Jain @ 2021-10-19  0:23 UTC (permalink / raw)
  To: linux-btrfs

The following test case fails as it trying to read the fsid from the sb
for a missing device.

   $ mkfs.btrfs -f -draid1 -mraid1 $DEV1 $DEV2 
   $ btrfstune -S 1 $DEV1 
   $ wipefs -a $DEV2 
   $ btrfs dev scan --forget 
   $ mount -o degraded $DEV1 /btrfs 
   $ btrfs device add $DEV3 /btrfs -f 

   $ btrfs fi us /btrfs 
     ERROR: unexpected number of devices: 1 >= 1 
     ERROR: if seed device is used, try running this command as root
 
The kernel patch [1] in the mailing list provided a sysfs interface
to read the fsid of the device, so use it instead.

 [1]  btrfs: sysfs add devinfo/fsid to retrieve fsid from the device

This patch also retains the old method that is to read the SB for
backward compatibility purposes.

Anand Jain (2):
  btrfs-progs: prepare helper device_is_seed
  btrfs-progs: read fsid from the sysfs in device_is_seed

 cmds/filesystem-usage.c | 47 ++++++++++++++++++++++++++++++++++++-----
 1 file changed, 42 insertions(+), 5 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 19+ messages in thread
* [PATCH v2 0/2] btrfs-progs: read device fsid from the sysfs
@ 2023-02-13  9:37 Anand Jain
  2023-02-13  9:37 ` [PATCH 2/2] btrfs-progs: read fsid from the sysfs in device_is_seed Anand Jain
  0 siblings, 1 reply; 19+ messages in thread
From: Anand Jain @ 2023-02-13  9:37 UTC (permalink / raw)
  To: linux-btrfs; +Cc: wqu

v2:
 Almost a resend; no code was altered, except for the change log.

The following test scenario (as in fstests btrfs/249) shows an issue
where the "usage" subcommand fails to retrieve the fsid from the
superblock for a missing device.

Create a raid1 seed device while one of its device missing.
   $ mkfs.btrfs -f -draid1 -mraid1 $DEV1 $DEV2
   $ btrfstune -S 1 $DEV1
   $ wipefs -a $DEV2

Mount the seed device
   $ btrfs device scan --forget
   $ mount -o degraded $DEV1 /btrfs

Add a sprout device
   $ btrfs device add $DEV3 /btrfs -f

The usage subommand fails because we try to read superblock for the missing
device
   $ btrfs filesystem usage /btrfs
     ERROR: unexpected number of devices: 1 >= 1
     ERROR: if seed device is used, try running this command as root

The commit a26d60dedf9a ("btrfs: sysfs: add devinfo/fsid to retrieve
actual fsid from the device") introduced a sysfs interface for
retrieving the fsid of a device. This change allows for the reading of the
device fsid through the sysfs interface in the kernel, while retaining the
old method of reading the superblock from the disk for backward
compatibility during normal, non-missing device conditions.

Anand Jain (2):
  btrfs-progs: prepare helper device_is_seed
  btrfs-progs: read fsid from the sysfs in device_is_seed

 cmds/filesystem-usage.c | 47 ++++++++++++++++++++++++++++++++++++-----
 1 file changed, 42 insertions(+), 5 deletions(-)

--
2.39.1

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2023-02-21 23:23 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-19  0:23 [PATCH 0/2] btrfs-progs: read device fsid from the sysfs Anand Jain
2021-10-19  0:23 ` [PATCH 1/2] btrfs-progs: prepare helper device_is_seed Anand Jain
2021-10-19  0:23 ` [PATCH 2/2] btrfs-progs: read fsid from the sysfs in device_is_seed Anand Jain
2021-10-19 14:03   ` Josef Bacik
2021-10-20  2:40     ` Anand Jain
2021-10-20 13:47       ` Josef Bacik
2021-10-19 14:04 ` [PATCH 0/2] btrfs-progs: read device fsid from the sysfs Josef Bacik
2021-10-20  2:41   ` Anand Jain
2022-01-06  0:04 ` Anand Jain
2022-01-11 15:19   ` Nikolay Borisov
2022-01-21  9:29     ` Anand Jain
2022-08-26  0:14       ` Wang Yugui
2022-08-26 10:18         ` Anand Jain
2022-08-27  0:52           ` Wang Yugui
2022-08-10 10:18 ` Qu Wenruo
2022-08-10 11:18   ` Anand Jain
2022-08-10 11:43     ` Qu Wenruo
  -- strict thread matches above, loose matches on Subject: below --
2023-02-13  9:37 [PATCH v2 " Anand Jain
2023-02-13  9:37 ` [PATCH 2/2] btrfs-progs: read fsid from the sysfs in device_is_seed Anand Jain
2023-02-21 23:17   ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox