On Fri, Jul 10, 2020 at 02:37:38PM +0800, Anand Jain wrote: > ->show_devname currently shows the lowest devid in the list. As the seed > devices have the lowest devid in the sprouted filesystem, the userland > tool such as findmnt end up seeing seed device instead of the device from > the read-writable sprouted filesystem. As shown below. > > mount /dev/sda /btrfs > mount: /btrfs: WARNING: device write-protected, mounted read-only. > > findmnt --output SOURCE,TARGET,UUID /btrfs > SOURCE TARGET UUID > /dev/sda /btrfs 899f7027-3e46-4626-93e7-7d4c9ad19111 > > btrfs dev add -f /dev/sdb /btrfs > > umount /btrfs > mount /dev/sdb /btrfs > > findmnt --output SOURCE,TARGET,UUID /btrfs > SOURCE TARGET UUID > /dev/sda /btrfs 899f7027-3e46-4626-93e7-7d4c9ad19111 > > > All sprouts from a single seed will show the same seed device and the > same fsid. That's messy. > This is causing problems in our prototype as there isn't any reference > to the sprout file-system(s) which is being used for actual read and > write. > > This was added in the patch which implemented the show_devname in btrfs > commit 9c5085c14798 (Btrfs: implement ->show_devname). > I tried to look for any particular reason that we need to show the seed > device, there isn't any. > > So instead, do not traverse through the seed devices, just show the > lowest devid in the sprouted fsid. > > After the patch: > > mount /dev/sda /btrfs > mount: /btrfs: WARNING: device write-protected, mounted read-only. > > findmnt --output SOURCE,TARGET,UUID /btrfs > SOURCE TARGET UUID > /dev/sda /btrfs 899f7027-3e46-4626-93e7-7d4c9ad19111 > > btrfs dev add -f /dev/sdb /btrfs > mount -o rw,remount /dev/sdb /btrfs > > findmnt --output SOURCE,TARGET,UUID /btrfs > SOURCE TARGET UUID > /dev/sdb /btrfs 595ca0e6-b82e-46b5-b9e2-c72a6928be48 > > mount /dev/sda /btrfs1 > mount: /btrfs1: WARNING: device write-protected, mounted read-only. > > btrfs dev add -f /dev/sdc /btrfs1 > > findmnt --output SOURCE,TARGET,UUID /btrfs1 > SOURCE TARGET UUID > /dev/sdc /btrfs1 ca1dbb7a-8446-4f95-853c-a20f3f82bdbb > > cat /proc/self/mounts | grep btrfs > /dev/sdb /btrfs btrfs rw,relatime,noacl,space_cache,subvolid=5,subvol=/ 0 0 > /dev/sdc /btrfs1 btrfs ro,relatime,noacl,space_cache,subvolid=5,subvol=/ 0 0 > > Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx> Added to misc-next, thanks.
