From: "Guilherme G. Piccoli" <gpiccoli@igalia.com>
To: Anand Jain <anand.jain@oracle.com>, linux-btrfs@vger.kernel.org
Cc: clm@fb.com, josef@toxicpanda.com, dsterba@suse.com,
dsterba@suse.cz, linux-fsdevel@vger.kernel.org,
kernel@gpiccoli.net, kernel-dev@igalia.com, david@fromorbit.com,
kreijack@libero.it, johns@valvesoftware.com,
ludovico.denittis@collabora.com, quwenruo.btrfs@gmx.com,
wqu@suse.com, vivek@collabora.com
Subject: Re: [PATCH v4 2/2] btrfs: Introduce the temp-fsid feature
Date: Wed, 20 Sep 2023 09:03:49 -0300 [thread overview]
Message-ID: <b71f8c4b-1e70-605c-8903-ab1d16c1ef73@igalia.com> (raw)
In-Reply-To: <f976c005-29fe-4f7e-e1d2-5262d638761a@oracle.com>
On 19/09/2023 08:06, Anand Jain wrote:
> [...]
>> + while (dup_fsid) {
>> + dup_fsid = false;
>> + generate_random_uuid(vfsid);
>> +
>> + list_for_each_entry(fs_devices, &fs_uuids, fs_list) {
>> + if (!memcmp(vfsid, fs_devices->fsid, BTRFS_FSID_SIZE) ||
>> + !memcmp(vfsid, fs_devices->metadata_uuid,
>> + BTRFS_FSID_SIZE))
>> + dup_fsid = true;
>> + }
>
>
> I've noticed this section of the code a few times, but I don't believe
> I've mentioned it before. We've been using generate_random_guid() and
> generate_random_uuid() without checking for UUID clashes. Why extra
> uuid clash check here?
>
Hi Anand, what would happen if the UUID clashes here? Imagine we have
another device with the same uuid (incredibly small chance, but...), I
guess this would break in the subsequent path of fs_devices addition,
hence I added this check, which is really cheap. We need to generate a
really unique uuid here as the temp one.
Do you see any con in having this check? I'd say we should maybe even
check in the other places the code is generating a random uuid but not
checking for duplicity currently...
next prev parent reply other threads:[~2023-09-20 12:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-13 22:36 [PATCH v4 0/2] Supporting same fsid mounting through the temp-fsid feature Guilherme G. Piccoli
2023-09-13 22:36 ` [PATCH v4 1/2] btrfs-progs: Add the temp-fsid feature (to both mkfs/tune) Guilherme G. Piccoli
2023-09-13 22:36 ` [PATCH v4 2/2] btrfs: Introduce the temp-fsid feature Guilherme G. Piccoli
2023-09-18 21:52 ` David Sterba
2023-09-18 22:21 ` Guilherme G. Piccoli
2023-09-19 5:01 ` Anand Jain
2023-09-20 12:16 ` Guilherme G. Piccoli
2023-09-20 18:37 ` David Sterba
2023-09-21 0:21 ` Anand Jain
2023-09-21 22:36 ` Guilherme G. Piccoli
2023-09-19 11:06 ` Anand Jain
2023-09-20 12:03 ` Guilherme G. Piccoli [this message]
2023-09-20 18:23 ` David Sterba
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=b71f8c4b-1e70-605c-8903-ab1d16c1ef73@igalia.com \
--to=gpiccoli@igalia.com \
--cc=anand.jain@oracle.com \
--cc=clm@fb.com \
--cc=david@fromorbit.com \
--cc=dsterba@suse.com \
--cc=dsterba@suse.cz \
--cc=johns@valvesoftware.com \
--cc=josef@toxicpanda.com \
--cc=kernel-dev@igalia.com \
--cc=kernel@gpiccoli.net \
--cc=kreijack@libero.it \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=ludovico.denittis@collabora.com \
--cc=quwenruo.btrfs@gmx.com \
--cc=vivek@collabora.com \
--cc=wqu@suse.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).