linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: dsterba@suse.cz, "Guilherme G. Piccoli" <gpiccoli@igalia.com>
Cc: linux-btrfs@vger.kernel.org, clm@fb.com, josef@toxicpanda.com,
	dsterba@suse.com, 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: Thu, 21 Sep 2023 08:21:09 +0800	[thread overview]
Message-ID: <0a4b62d5-27b7-a09c-7112-f8e1ec6070c5@oracle.com> (raw)
In-Reply-To: <20230920183756.GG2268@twin.jikos.cz>



On 21/09/2023 02:37, David Sterba wrote:
> On Wed, Sep 20, 2023 at 09:16:02AM -0300, Guilherme G. Piccoli wrote:
>> On 19/09/2023 02:01, Anand Jain wrote:
>>> [...]
>>> This must successfully pass the remaining Btrfs fstests test cases with
>>> the MKFS_OPTION="-O temp-fsid" configuration option, or it should call
>>> not run for the incompatible feature.
>>
>> I kinda disagree here - this feature is not compatible with anything
>> else, so I don't think it's fair to expect mounting with temp-fsid will
>> just pass all other tests, specially for things like (the real)
>> metadata_uuid or extra devices, like device removal...
> 
> Yeah, fstests are not in general ready for enabling some feature from
> the outside (mkfs, or mount options). Some of them work as long as
> they're orthogonal but some tests need to detect that and skip. In this
> case all multidevice tests would fail.
> 
> For test coverage there should be at lest one test that verifies known
> set of compatible features or usecases we care about in comibnation with
> the temp-fsid.
> 

If this patch had undergone verification using fstests for a single
device, it might have already resolved the data corruption issue I
recently reported. While it could be an isolated bug, having fstests
confirm that 'yes, everything else is verified except for multi-device
support' would be helpful.

The MKFS_OPTION="-O temp_fsid" config would help create temp_fsid in
fstests, it may not be too difficult to verify.

Also, as commented in v3, btrfs-progs needs to support listing single
devices with conflicting fsids while they are unmounted.

Thanks, Anand


>>> I have observed that the following test case is failing with this patch:
>>>
>>>    $ mkfs.btrfs -fq /dev/sdb1 :0
>>>    $ btrfstune --convert-to-temp-fsid /dev/sdb1 :0
>>>    $ mount /dev/sdb1 /btrfs :0
>>>
>>> Mount /dev/sdb1 again at a different mount point and look for the copied
>>> file 'messages':
>>>
>>>    $ cp /var/log/messages /btrfs :0
>>>
>>>    $ mount /dev/sdb1 /btrfs1 :0
>>>    $ ls -l /btrfs1 :0
>>>    total 0   <-- empty
>>>
>>> The copied file is missing because we consider each mount as a new fsid.
>>> This means subvolume mounts are also not working. Some operating systems
>>> mount $HOME as a subvolume, so those won't work either.
>>>
>>> To resolve this, we can use devt to match in the device list and find
>>> the matching fs_devices or NULL.
>>
>> Ugh, this one is ugly. Thanks for noticing that, I think this needs
>> fixing indeed.
>>
>> I've tried here, mounted the same temp-fsid btrfs device in 2 different
>> mount points, and wrote two different files on each. The mount A can
>> only see the file A, mount B can only see file B. Then after unmouting
>> both, I cannot mount anymore with errors in ctree, so it got corrupted.
>>
>> The way I think we could resolve this is by forbidding mounting a
>> temp-fsid twice - after the random uuid generation, we could check for
>> all fs_devices present and if any of it has the same metadata_uuid, we
>> check if it's the same dev_t and bail.
>>
>> The purpose of the feature is for having the same filesystem in
>> different devices able to mount at the same time, but on different mount
>> points. WDYT?
> 
> The subvolume mount is a common use case and I hope it continues to
> work. Currently it does not seem so as said above, for correctness we
> may need to prevent it. We might find more and this should be known or
> fixed before final release.

  reply	other threads:[~2023-09-21  0:21 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 [this message]
2023-09-21 22:36             ` Guilherme G. Piccoli
2023-09-19 11:06   ` Anand Jain
2023-09-20 12:03     ` Guilherme G. Piccoli
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=0a4b62d5-27b7-a09c-7112-f8e1ec6070c5@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=clm@fb.com \
    --cc=david@fromorbit.com \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=gpiccoli@igalia.com \
    --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).