From: Al Viro <viro@zeniv.linux.org.uk>
To: Ian Kent <raven@themaw.net>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Howells <dhowells@redhat.com>,
Miklos Szeredi <miklos@szeredi.hu>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] vfs: add propagate_mount_tree_busy() helper
Date: Wed, 20 Jul 2022 03:39:06 +0100 [thread overview]
Message-ID: <YtdqyjqrUaIivGUT@ZenIV> (raw)
In-Reply-To: <41252c7e-674b-c110-962b-c20204dc7424@themaw.net>
On Wed, Jul 20, 2022 at 10:31:26AM +0800, Ian Kent wrote:
>
> On 20/7/22 09:54, Al Viro wrote:
> > On Mon, Jul 11, 2022 at 11:37:46AM +0800, Ian Kent wrote:
> >
> > > +static int do_mount_in_use_check(struct mount *mnt, int cnt)
> > > +{
> > > + struct mount *topper;
> > > +
> > > + /* Is there exactly one mount on the child that covers
> > > + * it completely?
> > > + */
> > > + topper = find_topper(mnt);
> > > + if (topper) {
> > > + int topper_cnt = topper->mnt_mounts_cnt + 1;
> > > +
> > > + /* Open file or pwd within singular mount? */
> > > + if (do_refcount_check(topper, topper_cnt))
> > > + return 1;
> > Whatever the hell for? umount(2) will be able to slide the
> > underlying mount from under the topper, whatever the
> > refcount of topper might have been.
>
> My thinking was that a process could have set a working
>
> directory (or opened a descriptor) and some later change
>
> to an autofs map resulted in it being mounted on. It's
>
> irrelevant now with your suggested simpler approach, ;)
No, I mean why bother checking refcount of overmount in the first
place? umount(2) will *not* consider it as -EBUSY. On propagation
under the full overmount it will quietly remove the thing it's
overmounting.
If you have
overmount
victim
mountpoint
stacked like that, with overmount sitting directly on the root
subtree covered by the victim, the only things checked will be
* victim itself is not busy
* victim has nothing mounted deeper in it.
In that case it'll collapse to
overmount
mountpoint
and proceed to take the (now detached) victim out.
next prev parent reply other threads:[~2022-07-20 2:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-11 3:37 [PATCH 0/3] autofs: fix may_umount_tree() Ian Kent
2022-07-11 3:37 ` [PATCH 1/3] vfs: track count of child mounts Ian Kent
2022-07-20 1:50 ` Al Viro
2022-07-20 2:17 ` Ian Kent
2022-07-20 7:26 ` Ian Kent
2022-07-26 5:11 ` Ian Kent
2022-07-26 7:10 ` Ian Kent
2022-07-11 3:37 ` [PATCH 2/3] vfs: add propagate_mount_tree_busy() helper Ian Kent
2022-07-20 1:54 ` Al Viro
2022-07-20 2:31 ` Ian Kent
2022-07-20 2:39 ` Al Viro [this message]
2022-07-11 3:37 ` [PATCH 3/3] vfs: make may_umount_tree() mount namespace aware Ian Kent
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=YtdqyjqrUaIivGUT@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=raven@themaw.net \
/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