@@ -1892,15 +1892,12 @@ static int btrfs_show_devname(struct seq_file *m, struct dentry *root)
mutex_lock(&fs_info->fs_devices->device_list_mutex);
cur_devices = fs_info->fs_devices;
- while (cur_devices) {
- head = &cur_devices->devices;
- list_for_each_entry(dev, head, dev_list) {
- if (dev->missing)
- continue;
- if (!first_dev || dev->devid < first_dev->devid)
- first_dev = dev;
- }
- cur_devices = cur_devices->seed;
+ head = &cur_devices->devices;
+ list_for_each_entry(dev, head, dev_list) {
+ if (dev->missing)
+ continue;
+ if (!first_dev || dev->devid < first_dev->devid)
+ first_dev = dev;
}
if (first_dev) {
most of the user level scripts uses /proc/self/mounts for the disk-path to mount-point to fsid mapping. But when seed disk is present which generally has lowest devid, the /proc/self/mounts would show the seed disk, but seed disk has different fsid from the actual fsid that's mounted. Due to this miss match these scripts fails to work. One such example is btrfs-porgs check_mounted_where(). The solution here is not to loop into the seed disks, but still return the lowest devid under the given mount point. Signed-off-by: Anand Jain <Anand.Jain@oracle.com> --- fs/btrfs/super.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)