From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
To: Anand Jain <Anand.Jain@oracle.com>, <linux-btrfs@vger.kernel.org>
Cc: <quwenruo@cn.fujitsu.com>
Subject: Re: [PATCH 2/2] btrfs: check generation as replace duplicates devid+uuid
Date: Tue, 1 Jul 2014 15:39:30 +0800 [thread overview]
Message-ID: <53B265B2.100@cn.fujitsu.com> (raw)
In-Reply-To: <1402633581-19265-2-git-send-email-Anand.Jain@oracle.com>
Hi Anand,
On 06/13/2014 12:26 PM, Anand Jain wrote:
>
<..snip..>
> @@ -523,6 +523,16 @@ static noinline int device_list_add(const char *path,
>
> if (fs_devices->opened)
> return -EBUSY;
> + else {
> + /*
> + * That is if the FS is _not_ mounted and if you are here, that
> + * means there is more than one disk with same uuid and devid.
> + * We keep the one with larger generation number or the last-in
> + * if generation are equal.
> + */
> + if (found_transid < device->generation)
> + return -EINVAL;
> + }
I tried this patch it outputed the following message if it encounter two
device with the same uuid and device id:
Scanning for Btrfs filesystems
ERROR: device scan failed '/dev/sdc' - Invalid argument
Same comment as your first patch here.
>
> name = rcu_string_strdup(path, GFP_NOFS);
> if (!name)
> @@ -535,6 +545,15 @@ static noinline int device_list_add(const char *path,
> }
> }
>
> + /*
> + * Unmount does not free the btrfs_device struct but would zero
> + * generation along with most of the other members. So just update
> + * it back. We need it to pick the disk with largest generation
> + * (as above).
> + */
> + if (!fs_devices->opened)
> + device->generation = found_transid;
> +
> if (found_transid > fs_devices->latest_trans) {
> fs_devices->latest_devid = devid;
> fs_devices->latest_trans = found_transid;
next prev parent reply other threads:[~2014-07-01 7:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-13 4:26 [PATCH 1/2 v3 RESEND] Btrfs: device_list_add() should not update list when mounted Anand Jain
2014-06-13 4:26 ` [PATCH 2/2] btrfs: check generation as replace duplicates devid+uuid Anand Jain
2014-07-01 7:39 ` Wang Shilong [this message]
2014-07-01 7:16 ` [PATCH 1/2 v3 RESEND] Btrfs: device_list_add() should not update list when mounted Wang Shilong
2014-07-01 16:31 ` Anand Jain
2014-07-02 2:59 ` Wang Shilong
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=53B265B2.100@cn.fujitsu.com \
--to=wangsl.fnst@cn.fujitsu.com \
--cc=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 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).