From: Christian Brauner <brauner@kernel.org>
To: Jan Kara <jack@suse.cz>
Cc: Alexander Larsson <alexl@redhat.com>, Ian Kent <ikent@redhat.com>,
Matthew Wilcox <willy@infradead.org>,
Lucas Karpinski <lkarpins@redhat.com>,
viro@zeniv.linux.org.uk, raven@themaw.net,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Eric Chanudet <echanude@redhat.com>
Subject: Re: [RFC v3 1/1] fs/namespace: remove RCU sync for MNT_DETACH umount
Date: Mon, 1 Jul 2024 14:13:47 +0200 [thread overview]
Message-ID: <20240701-vortrag-riesig-bbedb130d443@brauner> (raw)
In-Reply-To: <20240701101536.jb452t25xds6x7f3@quack3>
On Mon, Jul 01, 2024 at 12:15:36PM GMT, Jan Kara wrote:
> On Mon 01-07-24 10:41:40, Alexander Larsson wrote:
> > On Mon, Jul 1, 2024 at 7:50 AM Christian Brauner <brauner@kernel.org> wrote:
> > >
> > > > I always thought the rcu delay was to ensure concurrent path walks "see" the
> > > >
> > > > umount not to ensure correct operation of the following mntput()(s).
> > > >
> > > >
> > > > Isn't the sequence of operations roughly, resolve path, lock, deatch,
> > > > release
> > > >
> > > > lock, rcu wait, mntput() subordinate mounts, put path.
> > >
> > > The crucial bit is really that synchronize_rcu_expedited() ensures that
> > > the final mntput() won't happen until path walk leaves RCU mode.
> > >
> > > This allows caller's like legitimize_mnt() which are called with only
> > > the RCU read-lock during lazy path walk to simple check for
> > > MNT_SYNC_UMOUNT and see that the mnt is about to be killed. If they see
> > > that this mount is MNT_SYNC_UMOUNT then they know that the mount won't
> > > be freed until an RCU grace period is up and so they know that they can
> > > simply put the reference count they took _without having to actually
> > > call mntput()_.
> > >
> > > Because if they did have to call mntput() they might end up shutting the
> > > filesystem down instead of umount() and that will cause said EBUSY
> > > errors I mentioned in my earlier mails.
> >
> > But such behaviour could be kept even without an expedited RCU sync.
> > Such as in my alternative patch for this:
> > https://www.spinics.net/lists/linux-fsdevel/msg270117.html
> >
> > I.e. we would still guarantee the final mput is called, but not block
> > the return of the unmount call.
>
> So FWIW the approach of handing off the remainder of namespace_unlock()
> into rcu callback for lazy unmount looks workable to me. Just as Al Viro
> pointed out you cannot do all the stuff right from the RCU callback as the
> context doesn't allow all the work to happen there, so you just need to
> queue work from RCU callback and then do the real work from there (but OTOH
> you can avoid the task work in mnput_noexpire() in that case - will need a
> bit of refactoring).
Yes, but that wasn't what this patch did. As I said I'm not opposed to
trying a _working_ version of this but I suspect we'll slightly change
MNT_DETACH and cause user visible changes (But then we may end up adding
MNT_ASYNC or something which I wouldn't consider the worst idea ever.).
next prev parent reply other threads:[~2024-07-01 12:14 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-26 20:07 [RFC v3 0/1] fs/namespace: defer RCU sync for MNT_DETACH umount Lucas Karpinski
2024-06-26 20:07 ` [RFC v3 1/1] fs/namespace: remove " Lucas Karpinski
2024-06-26 20:47 ` Matthew Wilcox
2024-06-27 1:11 ` Ian Kent
2024-06-27 11:54 ` Jan Kara
2024-06-27 15:16 ` Christian Brauner
2024-06-28 3:17 ` Ian Kent
2024-06-28 12:54 ` Christian Brauner
2024-06-28 15:13 ` Alexander Larsson
2024-07-01 0:58 ` Ian Kent
2024-07-01 5:50 ` Christian Brauner
2024-07-01 8:03 ` Ian Kent
2024-07-01 8:41 ` Alexander Larsson
2024-07-01 10:15 ` Jan Kara
2024-07-01 12:13 ` Christian Brauner [this message]
2024-07-01 12:10 ` Christian Brauner
2024-07-03 9:22 ` Christian Brauner
2024-07-04 1:23 ` Ian Kent
2024-07-02 1:29 ` Ian Kent
2024-07-02 4:50 ` Christian Brauner
2024-06-28 2:58 ` Ian Kent
2024-06-28 11:13 ` Jan Kara
2024-07-01 1:08 ` Ian Kent
2024-07-02 4:58 ` Christian Brauner
2024-07-02 7:01 ` Ian Kent
2024-07-02 10:01 ` Jan Kara
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=20240701-vortrag-riesig-bbedb130d443@brauner \
--to=brauner@kernel.org \
--cc=alexl@redhat.com \
--cc=echanude@redhat.com \
--cc=ikent@redhat.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkarpins@redhat.com \
--cc=raven@themaw.net \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.