Re: [PATCH 4/5] super: make sync(2)'s wait for s_umount killable
From: Christian Brauner
Date: Tue Oct 27 2026 - 04:17:00 EST
On Mon, Oct 26, 2026 at 01:02:46PM +0100, Jan Kara wrote:
> On Fri 23-10-26 11:41:04, Christian Brauner wrote:
> > iterate_supers_sync() waits killably for a superblock that's being shut
> > down, but it takes s_umount of a live superblock uninterruptibly. So a
> > freeze_super() or remount that's stuck under s_umount, in
> > sync_filesystem() or ->freeze_fs() say, still hangs every sync(2) on
> > the machine without anyone being able to kill it.
> >
> > That's inconsistent with fs_bdev_sync() which already uses a killable
> > super_lock() for both waits. And the reasoning is the same: if the task
> > is killed the walk stops and ksys_sync() returns, there's nobody left to
> > make a promise to. The emergency sync and the sync before suspend and
> > hibernation run from a workqueue where that can't happen. The PROM sync
> > on sparc32 runs in whatever task it interrupted but that one could
> > already be cut short while it waited for a superblock being shut down.
> >
> > Let __iterate_supers() pass SUPER_LOCK_KILLABLE together with
> > SUPER_LOCK_WAIT_SHUTDOWN for SUPER_ITER_WAIT_SHUTDOWN. Only
> > iterate_supers_sync() passes that flag.
>
> This might get surprising in the future, I guess SUPER_ITER_KILLABLE flag
> might be a more explicit way to control this but I can live with what we
> have now.
I think you're right I'll fix that up in-tree.