From: Anand Jain <Anand.Jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 3/3 RFC] btrfs: show_devname should not consider seed disk
Date: Fri, 7 Mar 2014 23:48:39 +0800 [thread overview]
Message-ID: <1394207319-13252-3-git-send-email-Anand.Jain@oracle.com> (raw)
In-Reply-To: <1394207319-13252-1-git-send-email-Anand.Jain@oracle.com>
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 --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) {
--
1.8.5.3
next prev parent reply other threads:[~2014-03-07 15:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-07 15:48 [PATCH 1/3 v2 RFC] btrfs: total_devices vs num_devices Anand Jain
2014-03-07 15:48 ` [PATCH 2/3 RFC] btrfs: total_devices should count replacing devices Anand Jain
2014-05-13 9:17 ` Wang Shilong
2014-05-14 8:30 ` Anand Jain
2014-05-16 14:11 ` Anand Jain
2014-03-07 15:48 ` Anand Jain [this message]
2014-03-10 1:58 ` [PATCH 1/3 v2 RFC] btrfs: total_devices vs num_devices Anand Jain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1394207319-13252-3-git-send-email-Anand.Jain@oracle.com \
--to=anand.jain@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).