[PATCH 5/5] fs: make umount(2) of the root killable on s_umount
From: Josef Bacik
Date: Fri Oct 23 2026 - 16:40:16 EST
Unmounting the root of the caller doesn't unmount anything, it remounts
the filesystem read-only. So it has the same problem as a remount: it
waits for s_umount in D state, can't be killed, and keeps every later
reader of the lock waiting behind it.
Use down_write_killable() in do_umount_root().
Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
---
fs/namespace.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index 837f531e494b..b874accabf76 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1897,9 +1897,11 @@ static void shrink_submounts(struct mount *mnt);
static int do_umount_root(struct super_block *sb)
{
- int ret = 0;
+ int ret;
- down_write(&sb->s_umount);
+ ret = down_write_killable(&sb->s_umount);
+ if (ret)
+ return ret;
if (!sb_rdonly(sb)) {
struct fs_context *fc;
--
2.55.0