freenode
Kernel & Low-Level

Linux VFS stops stuck unmounts from freezing the host

Josef Bacik’s series makes sync, drop_caches, quotas, and remounts skip or killably wait on dying superblocks instead of hanging uninterruptibly behind one bad umount.

Josef Bacik has landed Virtual File System changes that keep a single stuck unmount from dragging down unrelated work across the machine, a recurring failure mode on container hosts.

When umount hangs, often because the device underneath is slow or frozen, the kernel holds the superblock’s umount lock for the whole teardown: writeout, inode eviction, and put_super. Many other paths that walk superblocks waited uninterruptibly on that lock. After the wait they discovered the filesystem was already dying and had nothing to do, yet they could not be killed. One bad container mount could therefore stall every sync, drop_caches write, global quota sync, ustat or quotactl on that device, block flush, and even later mount attempts, with no way out short of a reboot.

The series separates callers that need a cleanliness barrier from those that do not. Operations that only care about a filesystem still being written out now wait explicitly for the dying state, and where the caller can usefully be interrupted that wait is killable. Callers that have no business with a superblock already on its way out skip it as soon as its active reference count hits zero, without taking the lock. A mount that collides with an old superblock still shutting down can likewise be killed instead of sitting forever.

Emergency sync, remount, suspend freezes, and orderly device removal still wait for writeout to finish so their guarantees hold; ordinary user sync and block flush become killable. Bacik calls the work only the first step toward stopping misbehaving containers from taking the host with them. Christian Brauner has queued the series in the VFS tree for the next merge window, with review from Jan Kara.

In Bacik’s test, suspending the device under a dirty ext4 mount left umount stuck in filesystem sync. Without the changes, drop_caches, quota sync, ustat, sync, block flush and a second mount all piled up unkillably. With them, the first three return at once, the others wait but yield to SIGKILL, and an unkilled sync still completes only after the unmount finishes.