diff mbox

[3/3,RFC] btrfs: show_devname should not consider seed disk

Message ID 1394207319-13252-3-git-send-email-Anand.Jain@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Anand Jain March 7, 2014, 3:48 p.m. UTC
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(-)
diff mbox

Patch

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index f3c0247..c023ffa 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -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) {