All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Austin S. Hemmelgarn" <ahferroin7@gmail.com>
To: Hugo Mills <hugo@carfax.org.uk>,
	Christoph Anton Mitterer <calestyo@scientia.net>,
	linux-btrfs@vger.kernel.org
Subject: Re: Subvolume UUID, data corruption?
Date: Fri, 11 Dec 2015 07:33:49 -0500	[thread overview]
Message-ID: <566AC2AD.1030207@gmail.com> (raw)
In-Reply-To: <20151205120103.GA2376@carfax.org.uk>

On 2015-12-05 07:01, Hugo Mills wrote:
> On Sat, Dec 05, 2015 at 04:28:24AM +0100, Christoph Anton Mitterer wrote:
>> On Fri, 2015-12-04 at 13:07 +0000, Hugo Mills wrote:
>>> I don't think it'll cause problems.
>> Is there any guaranteed behaviour when btrfs encounters two filesystems
>> (i.e. not talking about the subvols now) with the same UUID?
>
>     Nothing guaranteed, but the likelihood is that things will go badly
> wrong, in the sense of corrupt filesystems.
>
>> Given that it's long standing behaviour that people could clone
>> filesystems (dd, etc.) and this just worked™, btrfs should at least
>> handle such case gracefully.
>> For example, when already more than one block device with a btrfs of
>> the same UUID are known, then it should refuse to mount any of them.
>> And if one is already known and another device pops up it should refuse
>> to mount that and continue to normally use the already mounted one.
>
>     Except that that's exactly the mechanism that btrfs uses to handle
> multi-device filesystems, so you've just broken anything with more
> than one device in the FS.
>
>     If you inspect the devid on each device as well, and refuse
> duplicates of those, you've just broken any multipathing
> configurations.
This already potentially breaks multipath configurations, as well as 
dm-cache, some soft raid configurations, and probably other things as well.
>
>     Even if you can handle that, if you have two copies of dev1, and
> two copies of dev2, how do you guarantee that the "right" pair of dev1
> and dev2 is selected? (e.g. if you have them as network devices, and
> the device enumeration order is unstable on each boot).
In some cases it can be done without much effort.  Take dm-cache for 
example.  The hierarchy of devices in a dm-cache device looks like this:
cached-device
+ backing-device
+ cache-pool
   + pool-storage
   + pool-metadata

At a minimum, the cached device and the backing device contain identical 
data (the cached-device just has a writeback or writethrough cache on 
it), and the pool storage device may under some circumstances look like 
a BTRFS filesystem as well.  In this case, it's pretty obvious that the 
only device that BTRFS should be accessing is the cached device, not the 
backing device or the pool storage device.  For this, if we simply 
blacklist all devices that are themselves components in device-mapper 
tables, then we avoid the issue here, and possibly in some other as of 
yet undiscovered cases.

  parent reply	other threads:[~2015-12-11 12:33 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-04 12:05 Subvolume UUID, data corruption? S.J
2015-12-04 13:07 ` Hugo Mills
2015-12-05  3:28   ` Christoph Anton Mitterer
2015-12-05  5:52     ` attacking btrfs filesystems via UUID collisions? (was: Subvolume UUID, data corruption?) Christoph Anton Mitterer
2015-12-05 12:01     ` Subvolume UUID, data corruption? Hugo Mills
2015-12-06  1:51       ` attacking btrfs filesystems via UUID collisions? (was: Subvolume UUID, data corruption?) Christoph Anton Mitterer
2015-12-11 12:33       ` Austin S. Hemmelgarn [this message]
2015-12-05 13:19     ` Subvolume UUID, data corruption? Duncan
2015-12-06  1:51       ` attacking btrfs filesystems via UUID collisions? (was: Subvolume UUID, data corruption?) Christoph Anton Mitterer
2015-12-06  4:06         ` Duncan
2015-12-09  5:07           ` Christoph Anton Mitterer
2015-12-09 11:54             ` Duncan
2015-12-06 14:34         ` attacking btrfs filesystems via UUID collisions? Qu Wenruo
2015-12-06 20:55           ` Chris Murphy
2015-12-09  5:39           ` Christoph Anton Mitterer
2015-12-09 21:48             ` S.J.
2015-12-10 12:08               ` Austin S Hemmelgarn
2015-12-10 12:41                 ` Hugo Mills
2015-12-10 12:57                   ` S.J.
2015-12-10 19:42               ` Chris Murphy
2015-12-11 22:21                 ` Christoph Anton Mitterer
2015-12-11 22:32                   ` Christoph Anton Mitterer
2015-12-11 23:06                   ` Chris Murphy
2015-12-12  1:34                     ` S.J.
2015-12-14  0:28                       ` Christoph Anton Mitterer
2015-12-14  0:27                     ` Christoph Anton Mitterer
2015-12-14 13:23                       ` Austin S. Hemmelgarn
2015-12-14 21:26                         ` Chris Murphy
2015-12-15  0:35                           ` Christoph Anton Mitterer
2015-12-15 13:54                           ` Austin S. Hemmelgarn
2015-12-15 14:18                             ` Hugo Mills
2015-12-15 14:27                               ` Austin S. Hemmelgarn
2015-12-15 14:42                                 ` Hugo Mills
2015-12-15 16:03                                   ` Austin S. Hemmelgarn
2015-12-16 12:14                                     ` Christoph Anton Mitterer
2015-12-16 12:10                                   ` Christoph Anton Mitterer
2015-12-16 12:03                               ` Christoph Anton Mitterer
2015-12-16 14:41                                 ` Chris Mason
2015-12-16 15:04                                   ` Christoph Anton Mitterer
2015-12-17  3:25                                     ` Duncan
2015-12-18  0:56                                       ` Christoph Anton Mitterer
2015-12-22  2:13                                       ` Kai Krakow
2015-12-16 12:03                             ` Christoph Anton Mitterer
2015-12-17  2:43                               ` Duncan
2015-12-15  0:08                         ` Christoph Anton Mitterer
2015-12-15 14:19                           ` Austin S. Hemmelgarn
2015-12-16 12:56                             ` Christoph Anton Mitterer
2015-12-14 20:55                       ` Chris Murphy
2015-12-15  0:22                         ` Christoph Anton Mitterer
2015-12-11 23:14                   ` Eric Sandeen
2015-12-11 22:06               ` Christoph Anton Mitterer

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=566AC2AD.1030207@gmail.com \
    --to=ahferroin7@gmail.com \
    --cc=calestyo@scientia.net \
    --cc=hugo@carfax.org.uk \
    --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 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.