linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: dsterba@suse.cz, kreijack@inwind.it,
	linux-btrfs <linux-btrfs@vger.kernel.org>,
	jshubin@redhat.com
Subject: Re: PATCH V3] mkfs.btrfs: allow UUID specification at mkfs time
Date: Thu, 15 May 2014 12:53:52 -0500	[thread overview]
Message-ID: <5374FF30.5080708@redhat.com> (raw)
In-Reply-To: <20140515173940.GS6917@twin.jikos.cz>

On 5/15/14, 12:39 PM, David Sterba wrote:
> On Wed, May 14, 2014 at 05:07:04PM -0500, Eric Sandeen wrote:
>>>> @@ -125,7 +154,20 @@ int make_btrfs(int fd, const char *device, const char *label,
>>>>  	memset(&super, 0, sizeof(super));
>>>>  
>>>>  	num_bytes = (num_bytes / sectorsize) * sectorsize;
>>>> -	uuid_generate(super.fsid);
>>>> +	if (fs_uuid) {
>>>> +		if (uuid_parse(fs_uuid, super.fsid) != 0) {
>>>> +			fprintf(stderr, "could not parse UUID: %s\n", fs_uuid);
>>>> +			ret = -EINVAL;
>>>> +			goto out;
>>>> +		}
>>>> +		if (!test_uuid_unique(fs_uuid)) {
>>>> +			fprintf(stderr, "non-unique UUID: %s\n", fs_uuid);
>>>> +			ret = -EBUSY;
>>>> +			goto out;
>>>> +		}
>>>
>>> Why a second call to test_uuid_unique(fs_uuid) ?
>>
>> Because kdave said he thought it was worth being paranoid in an earlier email,
>> if I understood him correctly.
> 
> I'm thinking about it again. My original idea was not to easily allow
> to create a duplicate uuid to a regular user. But, if one uses --uuid
> already, that's something I can count as a willful action and any
> mistakes can be blamed on the user.
> 
> If we end up with a warning, then the documentation should say how
> spectacularly it can blow up the system.
> 

So, in my testing, I found that re-mkfsing a device with the same UUID lead
to weird & distant segfaults in other bits of code.  Probably due to the
uuid cache?  </handwave> - I didn't dig into it, because ...

... people didn't want to be able to create duplicate UUIDs, so I figured
the outright rejection of that was a trivial way to solve it ...

And like I mentioned, if you really want to recreate the same UUID, you
can mkfs twice.  It doesn't take long.  ;)

I dunno, maybe that's too lame.  For a feature that upstream development
doesn't really seem to want, I'm not sure how much more effort I should
put into it?

-Eric

  reply	other threads:[~2014-05-15 17:53 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14  1:18 [PATCH] mkfs.btrfs: allow UUID specification at mkfs time Eric Sandeen
2014-05-14  7:31 ` Wang Shilong
2014-05-14 12:25   ` Brendan Hide
2014-05-14 13:34     ` Duncan
2014-05-14 14:42     ` James Shubin
2014-05-14 13:28   ` Eric Sandeen
2014-05-14 13:34   ` David Pottage
2014-05-14 14:39 ` Goffredo Baroncelli
2014-05-14 14:41   ` Eric Sandeen
2014-05-14 15:14     ` Goffredo Baroncelli
2014-05-14 15:27     ` David Sterba
2014-05-14 14:47   ` James Shubin
2014-05-14 15:35 ` [PATCH V2] " Eric Sandeen
2014-05-14 16:01   ` David Sterba
2014-05-14 16:09     ` Eric Sandeen
2014-05-14 16:52     ` Goffredo Baroncelli
2014-05-14 17:39   ` PATCH V3] " Eric Sandeen
2014-05-14 22:04     ` Goffredo Baroncelli
2014-05-14 22:07       ` Eric Sandeen
2014-05-15 17:39         ` David Sterba
2014-05-15 17:53           ` Eric Sandeen [this message]
2014-05-16 17:24             ` 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=5374FF30.5080708@redhat.com \
    --to=sandeen@redhat.com \
    --cc=dsterba@suse.cz \
    --cc=jshubin@redhat.com \
    --cc=kreijack@inwind.it \
    --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).