From: Anand Jain <anand.jain@oracle.com>
To: Qu Wenruo <quwenruo@cn.fujitsu.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: When devices with same dev uuid occurs, only add the one with largest generation.
Date: Fri, 13 Jun 2014 12:35:56 +0800 [thread overview]
Message-ID: <539A7FAC.60708@oracle.com> (raw)
In-Reply-To: <1402390387-28730-1-git-send-email-quwenruo@cn.fujitsu.com>
Qu,
Kindly note, device->generation is not updated when user scan the
device for the first time.
I have sent out patch:
[PATCH 2/2] btrfs: check generation as replace duplicates devid+uuid
Please feel free to add your Signed-off-by, if you think so.
review comments are appreciated as usual.
Thanks, Anand
On 10/06/2014 16:53, Qu Wenruo wrote:
> Since btrfs currently use dulicated dev uuid when doing device replace,
> the following problem will happen:
>
> 1) mount with device A missing using degraded mode.
> 2) replace device A with device B.
> 3) device A reappears.
> 4) umount btrfs fs.
> 5) mount btrfs fs.
>
> After step 5), btrfs will still use device A even device B has a larger
> generation.
>
> The patch will judge generation when difference device with same dev
> uuid.
> And the patch should be applied after Anand's patch:
> https://patchwork.kernel.org/patch/4309651/
>
> Cc: Anand Jain <Anand.Jain@oracle.com>
> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
> ---
> fs/btrfs/volumes.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 0a5017a..07f0cf7 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -508,7 +508,8 @@ static noinline int device_list_add(const char *path,
>
> ret = 1;
> device->fs_devices = fs_devices;
> - } else if (!device->name || strcmp(device->name->str, path)) {
> + } else if (!device->name || (strcmp(device->name->str, path) &&
> + found_transid > device->generation)) {
> /*
> * When FS is already mounted.
> * 1. If you are here and if the device->name is NULL that means
>
prev parent reply other threads:[~2014-06-13 4:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-10 8:53 [PATCH] btrfs: When devices with same dev uuid occurs, only add the one with largest generation Qu Wenruo
2014-06-13 4:35 ` Anand Jain [this message]
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=539A7FAC.60708@oracle.com \
--to=anand.jain@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=quwenruo@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.