Re: [PATCH v4 2/2] btrfs: Introduce the temp-fsid feature

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 13, 2023 at 07:36:16PM -0300, Guilherme G. Piccoli wrote:
> Btrfs doesn't currently support to mount 2 different devices holding the
> same filesystem - the fsid is exposed as a unique identifier by the
> driver. This case is supported though in some other common filesystems,
> like ext4.
> 
> Supporting the same-fsid mounts has the advantage of allowing btrfs to
> be used in A/B partitioned devices, like mobile phones or the Steam Deck
> for example. Without this support, it's not safe for users to keep the
> same "image version" in both A and B partitions, a setup that is quite
> common for development, for example. Also, as a big bonus, it allows fs
> integrity check based on block devices for RO devices (whereas currently
> it is required that both have different fsid, breaking the block device
> hash comparison).
> 
> Such same-fsid mounting is hereby added through the usage of the
> filesystem feature "temp-fsid" - when such feature is used, btrfs
> generates a random fsid for the filesystem and leverages the long-term
> present metadata_uuid infrastructure to enable the usage of this
> secondary "virtual" fsid, effectively requiring few non-invasive
> changes to the code and no new potential corner cases.
> 
> In order to prevent more code complexity and corner cases, the
> temp-fsid feature is not allowed when the metadata_uuid flag is
> present on the fs, or if the device is on fsid-change state. Device
> removal/replace is also disabled for filesystems presenting the feature.
> 
> Cc: Anand Jain <anand.jain@xxxxxxxxxx>
> Suggested-by: John Schoenick <johns@xxxxxxxxxxxxxxxxx>
> Suggested-by: Qu Wenruo <wqu@xxxxxxxx>
> Signed-off-by: Guilherme G. Piccoli <gpiccoli@xxxxxxxxxx>
> ---
> 
> V4:
> 
> - Rebased against the github misc-next branch (of 2023-09-13); notice
> it already includes the patch: ("btrfs: scan forget for no instance of dev"),
> that was folded into the original commit;
> 
> - Patch ("btrfs: scan but don't register device on single device filesystem")
> was took into account - now we don't need to mess with the function
> btrfs_scan_one_device() here, since it already has the "mounting" argument;
> 
> - Improved the description of the fsid/metadata_uuid relation in volumes.h
> comment (thanks Anand!);
> 
> - Dropped the '\n' in the btrfs_{err/info} prints (also thanks Anand!);
> 
> - Switched the feature name for temp-fsid - seems the "less disliked"
> name, though personally I'd prefer virtual-fsid; also, that could be
> easily changed according the maintainers agreement.

Let's stick to temp-fsid for now, I like that it says the fsid is
temporary, virtual could be potentially stored permanently (like another
metadata_uuid).

I've added the patch to for-next, with some fixups, mostly stylistic.
I'll add the btrfs-progs part soon so we have the support for testing.
The feature seems to be complete regarding the original idea, if you
have any updates please send them separate patches or replies to this
thread. Thanks.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux