From: Anand Jain <Anand.Jain@oracle.com>
To: Chris Murphy <lists@colorremedies.com>,
Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Cc: Miao Xie <miaox@cn.fujitsu.com>,
Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Subject: Re: bug adding device to seed device, btrfs fi show fails
Date: Thu, 14 Aug 2014 12:37:21 +0800 [thread overview]
Message-ID: <53EC3D01.1030502@oracle.com> (raw)
In-Reply-To: <91408049-2586-446C-BD11-D3E33A5ECD27@colorremedies.com>
Chris,
For the seed replace issues. you have to try this patch set.
Thanks.
https://patchwork.kernel.org/patch/4716371/
Next, for the failing 'btrfs fi show' issue the following diff
is the latest. The last attempt was ..
[PATCH] btrfs: ioctl BTRFS_IOC_FS_INFO and BTRFS_IOC_DEV_INFO
miss-matched with slots
However as Wang mentioned we would need to show both seed and
sprout together, to make sense to the user.
So I have the following fix. which will soon be sent out
when tests are completed.
kernel:
-------------
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index da73ab3..05dd88b 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2725,7 +2725,7 @@ static long btrfs_ioctl_fs_info(struct btrfs_root
*root, void __user *arg)
return -ENOMEM;
mutex_lock(&fs_devices->device_list_mutex);
- fi_args->num_devices = fs_devices->num_devices;
+ fi_args->num_devices = fs_devices->total_devices;
memcpy(&fi_args->fsid, root->fs_info->fsid, sizeof(fi_args->fsid));
list_for_each_entry_safe(device, next, &fs_devices->devices,
dev_list) {
----------------
btrfs-progs:
----------------
diff --git a/utils.c b/utils.c
index 8bdc2a7..fa837b9 100644
--- a/utils.c
+++ b/utils.c
@@ -1929,12 +1929,29 @@ int get_fs_info(char *path, struct
btrfs_ioctl_fs_info_args *fi_args,
if (!fi_args->num_devices)
goto out;
- di_args = *di_ret = malloc(fi_args->num_devices * sizeof(*di_args));
+ /*
+ * with kernel patch
+ * btrfs: ioctl BTRFS_IOC_FS_INFO and BTRFS_IOC_DEV_INFO
miss-matched with slots
+ * the kernel now returns total_devices which does not include
+ * replacing device if running. There might be a race condition
+ * where replace might have been completed before DEVS are
+ * probed. So we anyway probe the replacing at devid 0
+ * separately which would return -ENODEV if replace has
+ * finished.
+ */
+
+ di_args = *di_ret = malloc((fi_args->num_devices + 1) *
sizeof(*di_args));
if (!di_args) {
ret = -errno;
goto out;
}
+ /* get the replace target device if it is there */
+ ret = get_device_info(fd, i, &di_args[ndevs]);
+ if (!ret) {
+ ndevs++;
+ fi_args->num_devices++;
+ }
+ i++;
+
----------------
Thanks, Anand
next prev parent reply other threads:[~2014-08-14 4:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-11 1:51 bug adding device to seed device, btrfs fi show fails Chris Murphy
2014-05-11 3:38 ` Chris Murphy
2014-05-12 2:00 ` Anand Jain
2014-05-13 9:12 ` Wang Shilong
2014-08-14 4:05 ` Chris Murphy
2014-08-14 4:37 ` Anand Jain [this message]
2014-08-14 4:42 ` Chris Murphy
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=53EC3D01.1030502@oracle.com \
--to=anand.jain@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=lists@colorremedies.com \
--cc=miaox@cn.fujitsu.com \
--cc=wangsl.fnst@cn.fujitsu.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.