linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Seth Forshee <sforshee@kernel.org>
To: Christian Brauner <brauner@kernel.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2 3/5] fs: fix __lookup_mnt() documentation
Date: Wed, 5 Apr 2023 14:32:00 -0500	[thread overview]
Message-ID: <ZC3MsNqkSCuqa8D1@do-x1extreme> (raw)
In-Reply-To: <20230202-fs-move-mount-replace-v2-3-f53cd31d6392@kernel.org>

On Tue, Mar 28, 2023 at 06:13:08PM +0200, Christian Brauner wrote:
> The comment on top of __lookup_mnt() states that it finds the first
> mount implying that there could be multiple mounts mounted at the same
> dentry with the same parent.
> 
> This was true on old kernels where __lookup_mnt() could encounter a
> stack of child mounts such that each child had the same parent mount and
> was mounted at the same dentry. These were called "shadow mounts" and
> were created during mount propagation. So back then if a mount @m in the
> destination propagation tree already had a child mount @p mounted at
> @mp then any mount @n we propagated to @m at the same @mp would be
> appended after the preexisting mount @p in @mount_hashtable.
> 
> This hasn't been the case for quite a while now and I don't see an
> obvious way how such mount stacks could be created in another way. And
> if that's possible it would invalidate assumptions made in other parts
> of the code.
> 
> So for a long time on all relevant kernels the child-parent relationship
> is unique per dentry. So given a child mount @c mounted at its parent
> mount @p on dentry @mp means that @c is the only child mounted on
> @p at @mp. Should a mount @m be propagated to @p on @mp then @m will be
> mounted on @p at @mp and the preexisting child @c will be remounted on
> top of @m at @m->mnt_root.
> 
> Signed-off-by: Christian Brauner <brauner@kernel.org>

I've been confused by the comment on __lookup_mnt() before, so this is a
helpful update.

Reviewed-by: Seth Forshee (DigitalOcean) <sforshee@kernel.org>

  reply	other threads:[~2023-04-05 19:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28 16:13 [PATCH v2 0/5] fs: allow to mount beneath top mount Christian Brauner
2023-03-28 16:13 ` [PATCH v2 1/5] fs: add path_mounted() Christian Brauner
2023-04-05 19:29   ` Seth Forshee
2023-03-28 16:13 ` [PATCH v2 2/5] pnode: pass mountpoint directly Christian Brauner
2023-04-05 19:30   ` Seth Forshee
2023-04-06 13:01     ` Christian Brauner
2023-03-28 16:13 ` [PATCH v2 3/5] fs: fix __lookup_mnt() documentation Christian Brauner
2023-04-05 19:32   ` Seth Forshee [this message]
2023-03-28 16:13 ` [PATCH v2 4/5] fs: use a for loop when locking a mount Christian Brauner
2023-04-05 19:34   ` Seth Forshee
2023-03-28 16:13 ` [PATCH v2 5/5] fs: allow to mount beneath top mount Christian Brauner
2023-04-05 19:34   ` Seth Forshee
2023-04-06 13:56     ` Christian Brauner

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=ZC3MsNqkSCuqa8D1@do-x1extreme \
    --to=sforshee@kernel.org \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).