Chen Changcheng
503d67fbae
fs/super: fix emergency thaw double-unlock of s_umount
do_thaw_all() iterates over all superblocks via __iterate_supers()
with SUPER_ITER_EXCL, which acquires s_umount exclusively before
calling the callback and releases it afterwards. However, the
callback do_thaw_all_callback() calls thaw_super_locked() which
unconditionally releases s_umount on every code path. This results
in a second unlock attempt in __iterate_supers() that corrupts the
rwsem state, triggering a DEBUG_RWSEMS warning:
[ 182.601148] sysrq: Emergency Thaw of all frozen filesystems
[ 182.601865] ------------[ cut here ]------------
[ 182.602375] DEBUG_RWSEMS_WARN_ON((rwsem_owner(sem) != current) && !rwsem_test_oflags(sem, RWSEM_NONSPINNABLE)): count = 0x0, magic = 0xffff99b1011e5870, owner = 0x0, curr 0xffff99b101b06c80, list not empty
[ 182.603817] WARNING: kernel/locking/rwsem.c:1412 at up_write+0xa3/0x170, CPU#2: kworker/2:1/53
[ 182.604578] Modules linked in:
[ 182.604864] CPU: 2 UID: 0 PID: 53 Comm: kworker/2:1 Not tainted 7.2.0-rc4-00001-gbd3bd93ea98a-dirty #4 PREEMPT(lazy)
[ 182.605711] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1kylin1 04/01/2014
[ 182.606417] Workqueue: events do_thaw_all
[ 182.606750] RIP: 0010:up_write+0xaf/0x170
[ 182.607076] Code: 19 3a 92 48 0f 44 c2 48 8b 55 08 48 8b 55 00 4c 8b 45 08 48 8b 55 00 48 8d 3d ad 91 e0 01 48 8b 4d 20 50 48 c7 c6 f0 8c 26 92 <67> 48 0f b9 3a e8 d7 93 4e 00 58 eb 81 48 83 7f 18 00 48 c7 c2 8d
[ 182.608563] RSP: 0018:ffffb670001d7e08 EFLAGS: 00010246
[ 182.609007] RAX: ffffffff92349e8d RBX: 0000000000000000 RCX: ffff99b1011e5870
[ 182.609595] RDX: 0000000000000000 RSI: ffffffff92268cf0 RDI: ffffffff92914d10
[ 182.610283] RBP: ffff99b1011e5870 R08: 0000000000000000 R09: ffff99b101b06c80
[ 182.610847] R10: ffff99b10139a808 R11: fefefefefefefeff R12: 0000000000000000
[ 182.611414] R13: ffffffff90cf74d0 R14: 0000000000000000 R15: ffff99b1011e5800
[ 182.612009] FS: 0000000000000000(0000) GS:ffff99b1eaaee000(0000) knlGS:0000000000000000
[ 182.612670] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 182.613146] CR2: 00000000005c631c CR3: 00000000013ee000 CR4: 00000000000006f0
[ 182.613722] Call Trace:
[ 182.613946] <TASK>
[ 182.614130] __iterate_supers+0x128/0x150
[ 182.614463] do_thaw_all+0x1b/0x30
[ 182.614759] process_scheduled_works+0xbb/0x3f0
[ 182.615150] ? __pfx_worker_thread+0x10/0x10
[ 182.615499] worker_thread+0x129/0x270
[ 182.615816] ? __pfx_worker_thread+0x10/0x10
[ 182.616201] kthread+0xe2/0x120
[ 182.616469] ? __pfx_kthread+0x10/0x10
[ 182.616792] ret_from_fork+0x15b/0x240
[ 182.617115] ? __pfx_kthread+0x10/0x10
[ 182.617426] ret_from_fork_asm+0x1a/0x30
[ 182.617761] </TASK>
[ 182.617968] ---[ end trace 0000000000000000 ]---
[ 182.618412] Emergency Thaw complete
Fix this by switching to SUPER_ITER_UNLOCKED and acquiring s_umount
in the callback via super_lock_excl() before calling
thaw_super_locked(). This matches the locking pattern expected by
thaw_super_locked() and eliminates the double unlock.
While at it, remove the dead 'return;' at the end of
do_thaw_all_callback().
Fixes: 2992476528 ("super: use a common iterator (Part 1)")
Cc: stable@vger.kernel.org
Signed-off-by: Chen Changcheng <chenchangcheng@kylinos.cn>
Link: https://patch.msgid.link/20260721064140.152305-1-chenchangcheng@kylinos.cn
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-07-23 10:10:24 +02:00
..
2026-06-21 10:26:31 -07:00
2026-04-25 07:44:26 -07:00
2026-05-21 13:39:35 +02:00
2026-07-01 15:26:29 +02:00
2026-04-13 14:20:11 -07:00
2026-05-21 13:39:35 +02:00
2026-05-28 13:58:14 +02:00
2026-07-14 09:10:27 -07:00
2026-07-01 15:26:28 +02:00
2026-06-26 16:15:53 -07:00
2026-04-21 14:03:10 -07:00
2026-06-15 04:28:20 +05:30
2026-05-03 09:12:23 -06:00
2026-06-22 12:12:11 -07:00
2026-04-02 16:15:23 +02:00
2026-02-21 17:09:51 -08:00
2026-05-08 08:38:03 -05:00
2026-06-26 08:24:06 -07:00
2026-04-28 12:30:59 +02:00
2026-06-11 11:42:21 -07:00
2026-07-13 16:41:42 +08:00
2026-07-01 15:26:47 +02:00
2026-06-05 00:34:55 -04:00
2026-06-02 10:56:16 +02:00
2026-06-18 09:42:02 -07:00
2026-06-22 19:55:27 +00:00
2026-07-01 15:26:25 +02:00
2026-07-01 15:26:26 +02:00
2026-07-01 15:26:47 +02:00
2026-06-26 15:13:06 -07:00
2026-06-16 12:27:23 +05:30
2026-06-16 12:27:23 +05:30
2026-02-21 17:09:51 -08:00
2026-06-15 03:59:45 +05:30
2026-06-21 11:37:38 -07:00
2026-07-01 15:26:47 +02:00
2026-06-16 11:58:52 +05:30
2026-06-18 09:42:02 -07:00
2026-03-06 14:31:28 +01:00
2026-06-15 03:59:45 +05:30
2026-06-15 12:41:17 +05:30
2026-06-09 16:32:59 -04:00
2026-07-01 15:26:24 +02:00
2026-07-03 11:52:41 +02:00
2026-07-08 14:43:40 -04:00
2026-01-02 13:43:41 -05:00
2026-07-13 08:38:01 -07:00
2026-06-16 12:14:20 +05:30
2025-12-01 11:58:06 +02:00
2026-06-16 11:56:43 +05:30
2026-07-10 18:20:15 -07:00
2026-07-01 15:26:47 +02:00
2026-06-21 13:20:19 -07:00
2026-05-21 13:39:36 +02:00
2025-10-20 20:22:26 +02:00
2026-07-01 15:26:27 +02:00
2026-07-22 16:42:28 +02:00
2026-07-22 15:37:24 +02:00
2026-04-15 12:59:16 -07:00
2026-05-21 13:39:35 +02:00
2026-05-28 14:16:33 +02:00
2026-05-27 15:12:22 +02:00
2026-04-05 13:53:07 -07:00
2026-07-06 19:05:49 -07:00
2026-02-18 20:50:32 -08:00
2026-07-17 21:41:54 -07:00
2026-02-24 11:13:27 -08:00
2026-06-15 12:41:17 +05:30
2026-03-18 11:41:53 -07:00
2026-06-05 01:12:15 -04:00
2026-05-11 23:12:28 +02:00
2026-06-16 11:58:52 +05:30
2026-04-13 12:46:42 -07:00
2026-02-21 17:09:51 -08:00
2026-05-11 16:50:29 +02:00
2026-06-17 09:18:14 +01:00
2026-07-16 09:40:03 -07:00
2026-05-12 07:53:20 +09:00
2026-06-04 10:10:49 +02:00
2026-06-04 10:10:49 +02:00
2026-05-15 19:24:32 +02:00
2026-06-10 09:49:25 +02:00
2026-01-12 14:01:32 +01:00
2026-07-21 13:22:34 +02:00
2026-04-05 13:53:39 -07:00
2026-07-20 23:34:15 +02:00
2026-07-01 15:26:27 +02:00
2026-06-15 03:59:45 +05:30
2026-02-21 17:09:51 -08:00
2026-06-15 03:59:45 +05:30
2026-04-07 12:32:22 +02:00
2026-04-21 14:12:01 -07:00
2026-06-15 04:15:31 +05:30
2026-05-26 11:01:55 -06:00
2025-10-20 20:22:26 +02:00
2026-02-21 17:09:51 -08:00
2026-06-04 13:53:50 +02:00
2026-07-21 13:00:49 +02:00
2026-06-15 03:59:45 +05:30
2026-07-01 15:26:32 +02:00
2026-05-11 16:50:27 +02:00
2026-06-15 04:15:31 +05:30
2026-05-28 14:27:00 +02:00
2026-06-12 14:26:27 +02:00
2026-04-13 14:20:11 -07:00
2025-11-05 09:51:30 +01:00
2026-02-19 14:34:26 +01:00
2026-01-14 16:50:37 +01:00
2026-06-04 10:16:51 +02:00
2026-03-06 14:31:28 +01:00
2026-02-21 17:09:51 -08:00
2026-02-09 16:58:28 -08:00
2026-06-23 12:03:44 -07:00
2026-06-15 14:06:20 +02:00
2026-05-28 21:24:42 -07:00
2026-06-15 04:21:00 +05:30
2026-05-15 19:24:32 +02:00
2026-06-04 14:45:03 -07:00
2026-04-13 14:20:11 -07:00
2026-05-11 14:19:01 +02:00
2026-06-15 04:07:58 +05:30
2026-04-15 12:59:16 -07:00
2026-07-01 15:26:18 +02:00
2026-06-15 04:07:58 +05:30
2026-06-15 03:59:45 +05:30
2026-01-12 16:52:09 +01:00
2026-06-23 12:03:44 -07:00
2026-07-22 16:45:57 +02:00
2026-05-28 14:33:24 +02:00
2026-07-21 21:52:51 +02:00
2026-06-05 14:46:20 +02:00
2026-03-24 14:44:02 +01:00
2026-06-15 03:59:45 +05:30
2026-02-21 01:02:28 -08:00
2026-02-21 17:09:51 -08:00
2026-02-21 17:09:51 -08:00
2026-01-16 12:52:04 -05:00
2026-01-16 12:52:04 -05:00
2026-07-23 10:10:24 +02:00
2026-05-21 13:39:36 +02:00
2026-05-01 21:36:13 +02:00
2026-01-16 12:52:03 -05:00
2026-06-17 12:34:16 +01:00