Re: [PATCH] fs: use namespace_{lock,unlock} in dissolve_on_fput()

From: Jan Stancek
Date: Fri Apr 11 2025 - 10:27:58 EST


On Fri, Apr 11, 2025 at 4:09 PM Christian Brauner <brauner@xxxxxxxxxx> wrote:
>
> On Thu, Apr 10, 2025 at 05:05:42PM +0200, Jan Stancek wrote:
> > In commit b73ec10a4587 ("fs: add fastpath for dissolve_on_fput()"),
> > the namespace_{lock,unlock} has been replaced with scoped_guard
> > using the namespace_sem. This however now also skips processing of
> > 'unmounted' list in namespace_unlock(), and mount is not (immediately)
> > cleaned up.
>
> Thank you for spotting and fixing this! My bad.
>
> > diff --git a/fs/namespace.c b/fs/namespace.c
> > index 14935a0500a2..ee1fdb3baee0 100644
> > --- a/fs/namespace.c
> > +++ b/fs/namespace.c
> > @@ -1830,6 +1830,8 @@ static inline void namespace_lock(void)
> > down_write(&namespace_sem);
> > }
> >
> > +DEFINE_GUARD(namespace_locked, struct rw_semaphore *, namespace_lock(), namespace_unlock())
>
> I'll call that namespace_lock instead if you don't mind.

I don't mind - I used "locked" because it's easier to grep for, when
it has distinct name.

Regards,
Jan