[PATCH 0/5] fs: don't let a stuck mount take everybody else with it

From: Josef Bacik

Date: Wed Oct 21 2026 - 12:49:19 EST


Hello,

This is the follow up to the stuck unmount series, and it applies on top
of it (vfs-7.5.super).

The same thing happens at the other end of a super block's life. We put
the super block on the lists in sget_fc(), but it isn't usable until
vfs_get_tree() sets SB_BORN, and super_lock() waits for that
uninterruptibly. If the mount is stuck reading from a dead device or
waiting on a server that went away, everything that walks the super
blocks backs up behind it, and there's no way to kill those things.

This isn't quite the mirror image of the unmount case. A dying super
block is going away, so skipping it loses nothing. An unborn one is
about to be in use, so anybody who has to get at every super block still
has to wait for it.

The things that only flush, sync(), drop_caches and Q_SYNC, skip it.
Nobody can have written to a file system that isn't mounted yet.

The things that are after that particular super block, a second mount of
the same device, ustat(), quotactl() and BLKFLSBUF, still wait for it,
but they can be killed now.

Everything else is left alone. SELinux in particular has to wait, NFS
sets up its security options before SB_BORN, and without a policy loaded
that gets deferred to the walk in selinux_complete_init(). The freeze,
thaw, emergency remount and device removal paths are unchanged as well.

For testing I put ext4 on a dm-linear device, dropped all the caches,
suspended the device underneath it and mounted, which leaves the mount
sitting in ext4_fill_super(). Without the series drop_caches,
quotactl(Q_SYNC), sync, ustat(), BLKFLSBUF and a second mount of the
device all end up in super_lock() and ignore SIGKILL, and the emergency
sync doesn't finish. With it the first three come straight back and the
emergency sync completes, the other three wait but go away on SIGKILL.
Freezing the device waits for the mount with and without the series,
SIGKILL or not. On both kernels the mount finishes once the device is
resumed, the data is there and nothing is left frozen, and 200 rounds of
mounting with sync, drop_caches, ustat() and Q_SYNC running against it
are fine. This was with KASAN and lockdep on, neither had anything to
say.

fstests on ext4, xfs and btrfs gives the same results with and without
the series. Thanks,

Josef

---
Josef Bacik (5):
fs: make a mount waiting on another mount killable
fs: make ustat() and quotactl() killable in lookup
fs: make BLKFLSBUF's wait for a superblock killable
fs: don't make sync(2) wait for unborn superblocks
fs: skip unborn superblocks in drop_caches and Q_SYNC

fs/drop_caches.c | 2 +-
fs/internal.h | 1 +
fs/quota/quota.c | 2 +-
fs/super.c | 168 +++++++++++++++++++++++++++++++++++++++++--------------
4 files changed, 129 insertions(+), 44 deletions(-)
---
base-commit: b4b5957dcf76c676f8a21b24588667731e97bbbc
change-id: 20261021-b4-super-lock-unborn-739369748496