From: Karl Mehltretter <kmehltretter@gmail.com>
To: Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>, Alexander Viro <viro@zeniv.linux.org.uk>,
Paulo Alcantara <pc@manguebit.org>,
linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] super: make iterate_supers_type() deletion-safe
Date: Sat, 5 Sep 2026 08:31:32 +0200 [thread overview]
Message-ID: <apu0mCbJ4S0TKIQM@gmail.com> (raw)
In-Reply-To: <20260904-rockkonzert-bergtour-dahin-23c9c5c87d0f@brauner>
On Fri, Sep 04, 2026 at 01:11:53PM +0100, Christian Brauner wrote:
>
> Draft, feel free to grab, Jan or Karl.
>
> ---
> fs/kernfs/mount.c | 4 ++--
> fs/super.c | 39 +++++++++++++++++++--------------------
> 2 files changed, 21 insertions(+), 22 deletions(-)
>
Thanks, I found no issues with your draft.
All the tests I ran on my patch also pass with your draft.
Below is my proposed changelog. If it looks good, I'll send v2 with you as
author. Could you provide your Signed-off-by?
super: make iterate_supers_type() deletion-safe
iterate_supers_type() drops sb_lock while invoking the callback and keeps
only a passive reference to the current superblock. That reference keeps
the object allocated, but does not keep its s_instances node linked.
After the iterator releases s_umount, final teardown can unlink the current
s_instances node. The iterator then advances through a reinitialized node.
With the current hlist it stops without visiting the remaining superblocks.
The unlink moved from generic_shutdown_super() to kill_super_notify(), but
the cursor lifetime has been unsafe since the helper was introduced.
The CIFS DFS lookup can consequently miss a matching superblock and return
-EINVAL.
Move removal from fs_supers to put_super(), alongside removal from
super_blocks, so a passive reference keeps both list nodes linked. Keep
the filesystem module reference until then, since unlinking s_instances
may touch type->fs_supers.
Make sget_fc() skip SB_DEAD superblocks before invoking test(), and set
SB_DEAD under sb_lock to serialize with those callbacks. This allows
kernfs to free its private information after kill_anon_super() returns.
Keep matching SB_DYING superblocks until SB_DEAD is set so concurrent
mounts still wait for teardown before retrying.
Fixes: 43e15cdbefea ("new helper: iterate_supers_type()")
Reported-by: Karl Mehltretter <kmehltretter@gmail.com>
Suggested-by: Jan Kara <jack@suse.cz>
Cc: stable@vger.kernel.org
<your Signed-off-by>
Tested-by: Karl Mehltretter <kmehltretter@gmail.com>
Assisted-by: LLM
<my Signed-off-by>
Thanks,
Karl
next prev parent reply other threads:[~2026-09-05 6:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 1:33 [PATCH] super: make iterate_supers_type() deletion-safe Karl Mehltretter
2026-09-03 10:16 ` Jan Kara
2026-09-04 10:29 ` Christian Brauner
2026-09-04 11:11 ` Christian Brauner
2026-09-05 6:31 ` Karl Mehltretter [this message]
2026-09-09 8:10 ` 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=apu0mCbJ4S0TKIQM@gmail.com \
--to=kmehltretter@gmail.com \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pc@manguebit.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 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.