public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Klara Modin <klarasmodin@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [RFC][PATCH] btrfs_get_tree_subvol(): switch from fc_mount() to vfs_create_mount()
Date: Tue, 6 May 2025 20:48:49 +0100	[thread overview]
Message-ID: <20250506194849.GT2023217@ZenIV> (raw)
In-Reply-To: <ukytl7lwaprjovct6qvkgdqaou6kt3pxpjdocv5r45r6unpjbx@qjq6ffj4x3x7>

On Tue, May 06, 2025 at 09:20:47PM +0200, Klara Modin wrote:

> I then get:
> 
> [    0.881616] absolute root
> [    0.881618] our namespace, at that

OK, so that's a combination of braino (times 2) in that patch
with quiet regression in clone_private_mount() from back in
January.

Reposted with fixes folded in and yes, you are absolutely
correct about the second 'fc' instead of 'dup_fc' in there.

As for the clone_private_mount() issues...  Christian has
taught it to allow roots of anon namespaces in addition to
mounts in our namespace, but did the tests in wrong order.

It's not a rare pattern - "do something to mount in our namespace
or the root of anon one" and for things like move_mount()
we absolutely do *not* want to allow it for root of our namespace,
so there this logics is fine - first split on whether it has
a parent, then for parented ones require the namespace to be
ours and for roots - require it to be anon.

In case of clone_private_mount(), though, there's nothing wrong
with "clone me a subtree of absolute root", so it has to be
done other way round - check if it's ours first, then in "not
ours" case check that it's a root of anon namespace.

Failing btrfs mount has ended up with upper layer pathname
pointing to initramfs directory where btrfs would've been
mounted, which had walked into that corner case.  In your
case the problem has already happened by that point, but on
a setup a-la X Terminal it would cause trouble...

  reply	other threads:[~2025-05-06 19:48 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-05  3:03 [RFC][PATCH] btrfs_get_tree_subvol(): switch from fc_mount() to vfs_create_mount() Al Viro
2025-05-05 17:58 ` David Sterba
2025-05-05 19:21   ` Al Viro
2025-05-06 13:36 ` Klara Modin
2025-05-06 16:43   ` Al Viro
2025-05-06 16:48     ` Klara Modin
2025-05-06 17:25   ` Al Viro
2025-05-06 17:47     ` Klara Modin
2025-05-06 17:51       ` Al Viro
2025-05-06 17:54         ` Klara Modin
2025-05-06 18:16           ` Al Viro
2025-05-06 18:34             ` Klara Modin
2025-05-06 19:05               ` Al Viro
2025-05-06 19:20                 ` Klara Modin
2025-05-06 19:48                   ` Al Viro [this message]
2025-05-06 18:58             ` Klara Modin
2025-05-06 19:33               ` Al Viro
2025-05-06 19:44                 ` Klara Modin
2025-05-06 19:34 ` [PATCH v2] " Al Viro
2025-05-06 19:52   ` Klara Modin
2025-05-06 20:00     ` Al Viro
2025-05-06 19:58   ` [PATCH v3] " Al Viro
2025-05-08  9:29     ` Qu Wenruo
2025-06-03  7:59       ` David Sterba
2025-06-03  9:23         ` Qu Wenruo
2025-06-03 19:38           ` 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=20250506194849.GT2023217@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=klarasmodin@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@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