* [syzbot] [ocfs2?] possible deadlock in shrinker_free
@ 2026-11-20 16:12 syzbot
2026-11-22 2:47 ` syzbot
0 siblings, 1 reply; 4+ messages in thread
From: syzbot @ 2026-11-20 16:12 UTC (permalink / raw)
To: akpm, heming.zhao, jlbec, joseph.qi, linux-kernel, mark,
ocfs2-devel, syzkaller-bugs, zzzccc427
Hello,
syzbot found the following issue on:
HEAD commit: f1715c0c0460 Merge tag 'for_linus' of git://git.kernel.org..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17974dea580000
kernel config: https://syzkaller.appspot.com/x/.config?x=3cc6a7ee2d24d208
dashboard link: https://syzkaller.appspot.com/bug?extid=38fdbb551940270021f1
compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/98fce4d0b21b/non_bootable_disk-f1715c0c.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/74785adb7521/vmlinux-f1715c0c.xz
kernel image: https://storage.googleapis.com/syzbot-assets/5f0383acaa50/bzImage-f1715c0c.xz
The issue was bisected by AI to:
commit f277230d002d03ed98b814b735f9d3d01b42020a
Author: Cen Zhang <zzzccc427@gmail.com>
Date: Fri Oct 30 04:48:56 2026 +0000
ocfs2: serialize inode journal access with shutdown
AI reasoning: https://syzkaller.appspot.com/ai_job?id=0e68af1a-9a2b-4aad-b8ed-125ab8c4ed0a
AI-generated root cause summary:
ocfs2_journal_shutdown() holds down_write(&osb->journal_shutdown_sem) across
jbd2_journal_destroy(), which invokes shrinker_free() and acquires
shrinker_mutex, establishing &osb->journal_shutdown_sem -> shrinker_mutex.
Meanwhile, shrinker_mutex is held across GFP_KERNEL allocations (e.g.,
alloc_shrinker_info()), establishing shrinker_mutex -> fs_reclaim, and memory
reclaim can reach ocfs2_evict_inode() / ocfs2_clear_inode() via
super_cache_scan() and acquire down_read(&osb->journal_shutdown_sem),
establishing fs_reclaim -> &osb->journal_shutdown_sem. Lockdep reports this
3-lock cycle as a circular locking dependency because it does not track the
mutual exclusion provided by sb->s_umount via super_trylock_shared().
full analysis: https://syzkaller.appspot.com/x/ai_root_cause?x=38fdbb551940270021f1
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+38fdbb551940270021f1@syzkaller.appspotmail.com
The cause commit was identified by AI and may be wrong.
If you agree with it, please also add:
Fixes: f277230d002d ("ocfs2: serialize inode journal access with shutdown")
loop0: detected capacity change from 0 to 32768
(syz.0.0,5351,0):ocfs2_block_check_validate:402 ERROR: CRC32 failed: stored: 0xb3775c19, computed 0x2dd1c265. Applying ECC.
(syz.0.0,5351,0):ocfs2_block_check_validate:402 ERROR: CRC32 failed: stored: 0xb3775c19, computed 0x2dd1c265. Applying ECC.
JBD2: Ignoring recovery information on journal
ocfs2: Mounting device (7,0) on (node local, slot 0) with ordered data mode.
(syz.0.0,5351,0):ocfs2_read_blocks_sync:112 ERROR: status = -12
(syz.0.0,5351,0):update_backups:196 ERROR: status = -12
ocfs2: Failed to update super blocks on 7,0 during fs resize. This condition is not fatal, but fsck.ocfs2 should be run to fix it
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.0.0/5351 is trying to acquire lock:
ffffffff90261520 (shrinker_mutex){+.+.}-{4:4}, at: shrinker_free+0xdb/0x3b0 mm/shrinker.c:809
but task is already holding lock:
ffff88804228c2f8 (&osb->journal_shutdown_sem){++++}-{4:4}, at: ocfs2_journal_shutdown+0x4ec/0xb40 fs/ocfs2/journal.c:1122
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&osb->journal_shutdown_sem){++++}-{4:4}:
down_read+0x45/0x320 kernel/locking/rwsem.c:1574
ocfs2_clear_inode fs/ocfs2/inode.c:1326 [inline]
ocfs2_evict_inode+0x2dd8/0x43c0 fs/ocfs2/inode.c:1343
evict+0x6bf/0xc20 fs/inode.c:829
ocfs2_dentry_iput+0x24d/0x390 fs/ocfs2/dcache.c:407
dentry_kill+0x1b9/0x910 fs/dcache.c:857
shrink_kill fs/dcache.c:1317 [inline]
shrink_dentry_list+0x209/0x310 fs/dcache.c:1334
prune_dcache_sb+0x119/0x180 fs/dcache.c:1416
super_cache_scan+0x362/0x4a0 fs/super.c:225
do_shrink_slab+0x6d0/0x10d0 mm/shrinker.c:452
shrink_slab_memcg mm/shrinker.c:569 [inline]
shrink_slab+0x838/0x1210 mm/shrinker.c:647
shrink_one+0x396/0x10f0 mm/vmscan.c:5320
shrink_many mm/vmscan.c:5381 [inline]
lru_gen_shrink_node mm/vmscan.c:5459 [inline]
shrink_node+0x631e/0x6c50 mm/vmscan.c:6465
kswapd_shrink_node mm/vmscan.c:7258 [inline]
balance_pgdat mm/vmscan.c:7429 [inline]
kswapd+0x1ff4/0x3a20 mm/vmscan.c:7705
kthread+0x38b/0x480 kernel/kthread.c:436
ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
-> #1 (fs_reclaim){+.+.}-{0:0}:
__fs_reclaim_acquire mm/page_alloc.c:4388 [inline]
fs_reclaim_acquire+0x71/0x100 mm/page_alloc.c:4402
might_alloc include/linux/sched/mm.h:316 [inline]
slab_pre_alloc_hook mm/slub.c:4673 [inline]
slab_alloc_node mm/slub.c:5011 [inline]
__do_kmalloc_node mm/slub.c:5530 [inline]
__kvmalloc_node_noprof+0x134/0x820 mm/slub.c:7143
alloc_shrinker_info+0xe9/0x400 mm/shrinker.c:101
mem_cgroup_css_online+0x84/0x7b0 mm/memcontrol.c:4396
online_css+0xbf/0x310 kernel/cgroup/cgroup.c:5903
css_create kernel/cgroup/cgroup.c:5983 [inline]
cgroup_apply_control_enable+0x9ed/0xda0 kernel/cgroup/cgroup.c:3474
cgroup_mkdir+0x1220/0x14b0 kernel/cgroup/cgroup.c:6188
kernfs_iop_mkdir+0x213/0x360 fs/kernfs/dir.c:1304
vfs_mkdir+0x411/0x660 fs/namei.c:5428
filename_mkdirat+0x284/0x550 fs/namei.c:5461
__do_sys_mkdirat fs/namei.c:5482 [inline]
__se_sys_mkdirat+0x35/0x150 fs/namei.c:5479
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #0 (shrinker_mutex){+.+.}-{4:4}:
check_prev_add kernel/locking/lockdep.c:3209 [inline]
check_prevs_add kernel/locking/lockdep.c:3328 [inline]
validate_chain kernel/locking/lockdep.c:3952 [inline]
__lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288
lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942
__mutex_lock_common kernel/locking/mutex.c:646 [inline]
__mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821
shrinker_free+0xdb/0x3b0 mm/shrinker.c:809
jbd2_journal_destroy+0x606/0x7e0 fs/jbd2/journal.c:2178
ocfs2_journal_shutdown+0x517/0xb40 fs/ocfs2/journal.c:1125
ocfs2_dismount_volume+0x3c9/0x860 fs/ocfs2/super.c:1874
generic_shutdown_super+0x140/0x2d0 fs/super.c:723
kill_block_super+0x44/0xa0 fs/super.c:1852
deactivate_locked_super+0xbe/0x110 fs/super.c:558
cleanup_mnt+0x204/0x2a0 fs/namespace.c:1396
task_work_run+0x1d9/0x260 kernel/task_work.c:233
exit_task_work include/linux/task_work.h:40 [inline]
do_exit+0x705/0x2360 kernel/exit.c:980
do_group_exit+0x22d/0x2f0 kernel/exit.c:1123
get_signal+0x136a/0x1430 kernel/signal.c:3113
arch_do_signal_or_restart+0xbb/0x860 arch/x86/kernel/signal.c:337
__exit_to_user_mode_loop kernel/entry/common.c:66 [inline]
exit_to_user_mode_loop+0x10e/0x770 kernel/entry/common.c:101
__exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:343 [inline]
do_syscall_64+0x336/0x540 arch/x86/entry/syscall_64.c:107
entry_SYSCALL_64_after_hwframe+0x77/0x7f
other info that might help us debug this:
Chain exists of:
shrinker_mutex --> fs_reclaim --> &osb->journal_shutdown_sem
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&osb->journal_shutdown_sem);
lock(fs_reclaim);
lock(&osb->journal_shutdown_sem);
lock(shrinker_mutex);
*** DEADLOCK ***
locks held by syz.0.0/5351: 2, on CPU#0:
#0: ffff88801342e100 (&type->s_umount_key#53){++++}-{4:4}, at: __super_lock fs/super.c:60 [inline]
#0: ffff88801342e100 (&type->s_umount_key#53){++++}-{4:4}, at: __super_lock_excl fs/super.c:75 [inline]
#0: ffff88801342e100 (&type->s_umount_key#53){++++}-{4:4}, at: deactivate_super+0xac/0xe0 fs/super.c:585
#1: ffff88804228c2f8 (&osb->journal_shutdown_sem){++++}-{4:4}, at: ocfs2_journal_shutdown+0x4ec/0xb40 fs/ocfs2/journal.c:1122
stack backtrace:
CPU: 0 UID: 0 PID: 5351 Comm: syz.0.0 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
print_circular_bug+0x2e2/0x300 kernel/locking/lockdep.c:2087
check_noncircular+0x12f/0x150 kernel/locking/lockdep.c:2219
check_prev_add kernel/locking/lockdep.c:3209 [inline]
check_prevs_add kernel/locking/lockdep.c:3328 [inline]
validate_chain kernel/locking/lockdep.c:3952 [inline]
__lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288
lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942
__mutex_lock_common kernel/locking/mutex.c:646 [inline]
__mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821
shrinker_free+0xdb/0x3b0 mm/shrinker.c:809
jbd2_journal_destroy+0x606/0x7e0 fs/jbd2/journal.c:2178
ocfs2_journal_shutdown+0x517/0xb40 fs/ocfs2/journal.c:1125
ocfs2_dismount_volume+0x3c9/0x860 fs/ocfs2/super.c:1874
generic_shutdown_super+0x140/0x2d0 fs/super.c:723
kill_block_super+0x44/0xa0 fs/super.c:1852
deactivate_locked_super+0xbe/0x110 fs/super.c:558
cleanup_mnt+0x204/0x2a0 fs/namespace.c:1396
task_work_run+0x1d9/0x260 kernel/task_work.c:233
exit_task_work include/linux/task_work.h:40 [inline]
do_exit+0x705/0x2360 kernel/exit.c:980
do_group_exit+0x22d/0x2f0 kernel/exit.c:1123
get_signal+0x136a/0x1430 kernel/signal.c:3113
arch_do_signal_or_restart+0xbb/0x860 arch/x86/kernel/signal.c:337
__exit_to_user_mode_loop kernel/entry/common.c:66 [inline]
exit_to_user_mode_loop+0x10e/0x770 kernel/entry/common.c:101
__exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:343 [inline]
do_syscall_64+0x336/0x540 arch/x86/entry/syscall_64.c:107
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f27f09a9559
Code: Unable to access opcode bytes at 0x7f27f09a952f.
RSP: 002b:00007f27f182a0a8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00007f27f0c25fa8 RCX: 00007f27f09a9559
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00007f27f0c25fa8
RBP: 00007f27f0c25fa0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f27f0c26038 R14: 00007ffd3e516330 R15: 00007ffd3e516418
</TASK>
ocfs2: Unmounting device (7,0) on (node local)
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about AI bisection see: https://goo.gl/tpsmEJ#ai-bisection
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [syzbot] [ocfs2?] possible deadlock in shrinker_free
2026-11-20 16:12 [syzbot] [ocfs2?] possible deadlock in shrinker_free syzbot
@ 2026-11-22 2:47 ` syzbot
2026-11-22 17:34 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: syzbot @ 2026-11-22 2:47 UTC (permalink / raw)
To: akpm, heming.zhao, jlbec, joseph.qi, linux-kernel, mark,
ocfs2-devel, syzkaller-bugs, zzzccc427
syzbot has found a reproducer for the following issue on:
HEAD commit: f802b6558eb8 Merge tag 'xfs-fixes-7.4-rc4' of git://git.ke..
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=141d98e9580000
kernel config: https://syzkaller.appspot.com/x/.config?x=3cc6a7ee2d24d208
dashboard link: https://syzkaller.appspot.com/bug?extid=38fdbb551940270021f1
compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10918a03580000
The issue was bisected by AI to:
commit f277230d002d03ed98b814b735f9d3d01b42020a
Author: Cen Zhang <zzzccc427@gmail.com>
Date: Fri Oct 30 04:48:56 2026 +0000
ocfs2: serialize inode journal access with shutdown
AI reasoning: https://syzkaller.appspot.com/ai_job?id=0e68af1a-9a2b-4aad-b8ed-125ab8c4ed0a
AI-generated root cause summary:
ocfs2_journal_shutdown() holds down_write(&osb->journal_shutdown_sem) across
jbd2_journal_destroy(), which invokes shrinker_free() and acquires
shrinker_mutex, establishing &osb->journal_shutdown_sem -> shrinker_mutex.
Meanwhile, shrinker_mutex is held across GFP_KERNEL allocations (e.g.,
alloc_shrinker_info()), establishing shrinker_mutex -> fs_reclaim, and memory
reclaim can reach ocfs2_evict_inode() / ocfs2_clear_inode() via
super_cache_scan() and acquire down_read(&osb->journal_shutdown_sem),
establishing fs_reclaim -> &osb->journal_shutdown_sem. Lockdep reports this
3-lock cycle as a circular locking dependency because it does not track the
mutual exclusion provided by sb->s_umount via super_trylock_shared().
full analysis: https://syzkaller.appspot.com/x/ai_root_cause?x=38fdbb551940270021f1
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+38fdbb551940270021f1@syzkaller.appspotmail.com
The cause commit was identified by AI and may be wrong.
If you agree with it, please also add:
Fixes: f277230d002d ("ocfs2: serialize inode journal access with shutdown")
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz-executor875/5689 is trying to acquire lock:
ffffffff902617a0 (shrinker_mutex){+.+.}-{4:4}, at: shrinker_free+0xdb/0x3b0 mm/shrinker.c:809
but task is already holding lock:
ffff8880421282f8 (&osb->journal_shutdown_sem){++++}-{4:4}, at: ocfs2_journal_shutdown+0x4ec/0xb40 fs/ocfs2/journal.c:1122
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&osb->journal_shutdown_sem){++++}-{4:4}:
down_read+0x45/0x320 kernel/locking/rwsem.c:1574
ocfs2_clear_inode fs/ocfs2/inode.c:1326 [inline]
ocfs2_evict_inode+0x2dd8/0x43c0 fs/ocfs2/inode.c:1343
evict+0x6bf/0xc20 fs/inode.c:829
ocfs2_dentry_iput+0x24d/0x390 fs/ocfs2/dcache.c:407
dentry_kill+0x1b9/0x910 fs/dcache.c:857
shrink_kill fs/dcache.c:1317 [inline]
shrink_dentry_list+0x209/0x310 fs/dcache.c:1334
prune_dcache_sb+0x119/0x180 fs/dcache.c:1416
super_cache_scan+0x362/0x4a0 fs/super.c:225
do_shrink_slab+0x6d0/0x10d0 mm/shrinker.c:452
shrink_slab_memcg mm/shrinker.c:569 [inline]
shrink_slab+0x838/0x1210 mm/shrinker.c:647
shrink_one+0x396/0x10f0 mm/vmscan.c:5320
shrink_many mm/vmscan.c:5381 [inline]
lru_gen_shrink_node mm/vmscan.c:5459 [inline]
shrink_node+0x631e/0x6c50 mm/vmscan.c:6465
__node_reclaim+0x2f4/0xa10 mm/vmscan.c:8012
user_proactive_reclaim+0x699/0x8d0 mm/vmscan.c:8202
reclaim_store+0x69/0xb0 mm/vmscan.c:8268
kernfs_fop_write_iter+0x3a4/0x540 fs/kernfs/file.c:345
new_sync_write fs/read_write.c:575 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:667
ksys_write+0x150/0x270 fs/read_write.c:719
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #1 (fs_reclaim){+.+.}-{0:0}:
__fs_reclaim_acquire mm/page_alloc.c:4388 [inline]
fs_reclaim_acquire+0x71/0x100 mm/page_alloc.c:4402
might_alloc include/linux/sched/mm.h:316 [inline]
slab_pre_alloc_hook mm/slub.c:4673 [inline]
slab_alloc_node mm/slub.c:5011 [inline]
__do_kmalloc_node mm/slub.c:5530 [inline]
__kvmalloc_node_noprof+0x134/0x820 mm/slub.c:7143
alloc_shrinker_info+0xe9/0x400 mm/shrinker.c:101
mem_cgroup_css_online+0x84/0x7b0 mm/memcontrol.c:4396
online_css+0xbf/0x310 kernel/cgroup/cgroup.c:5903
css_create kernel/cgroup/cgroup.c:5983 [inline]
cgroup_apply_control_enable+0x9ed/0xda0 kernel/cgroup/cgroup.c:3474
cgroup_mkdir+0x1220/0x14b0 kernel/cgroup/cgroup.c:6188
kernfs_iop_mkdir+0x213/0x360 fs/kernfs/dir.c:1304
vfs_mkdir+0x411/0x660 fs/namei.c:5428
filename_mkdirat+0x284/0x550 fs/namei.c:5461
__do_sys_mkdirat fs/namei.c:5482 [inline]
__se_sys_mkdirat+0x35/0x150 fs/namei.c:5479
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #0 (shrinker_mutex){+.+.}-{4:4}:
check_prev_add kernel/locking/lockdep.c:3209 [inline]
check_prevs_add kernel/locking/lockdep.c:3328 [inline]
validate_chain kernel/locking/lockdep.c:3952 [inline]
__lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288
lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942
__mutex_lock_common kernel/locking/mutex.c:646 [inline]
__mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821
shrinker_free+0xdb/0x3b0 mm/shrinker.c:809
jbd2_journal_destroy+0x606/0x7e0 fs/jbd2/journal.c:2178
ocfs2_journal_shutdown+0x517/0xb40 fs/ocfs2/journal.c:1125
ocfs2_dismount_volume+0x3c9/0x860 fs/ocfs2/super.c:1874
generic_shutdown_super+0x140/0x2d0 fs/super.c:723
kill_block_super+0x44/0xa0 fs/super.c:1852
deactivate_locked_super+0xbe/0x110 fs/super.c:558
cleanup_mnt+0x204/0x2a0 fs/namespace.c:1396
task_work_run+0x1d9/0x260 kernel/task_work.c:233
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
__exit_to_user_mode_loop kernel/entry/common.c:70 [inline]
exit_to_user_mode_loop+0x204/0x770 kernel/entry/common.c:101
__exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:343 [inline]
do_syscall_64+0x336/0x540 arch/x86/entry/syscall_64.c:107
entry_SYSCALL_64_after_hwframe+0x77/0x7f
other info that might help us debug this:
Chain exists of:
shrinker_mutex --> fs_reclaim --> &osb->journal_shutdown_sem
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&osb->journal_shutdown_sem);
lock(fs_reclaim);
lock(&osb->journal_shutdown_sem);
lock(shrinker_mutex);
*** DEADLOCK ***
locks held by syz-executor875/5689: 2, on CPU#0:
#0: ffff88804f39a100 (&type->s_umount_key#56){++++}-{4:4}, at: __super_lock fs/super.c:60 [inline]
#0: ffff88804f39a100 (&type->s_umount_key#56){++++}-{4:4}, at: __super_lock_excl fs/super.c:75 [inline]
#0: ffff88804f39a100 (&type->s_umount_key#56){++++}-{4:4}, at: deactivate_super+0xac/0xe0 fs/super.c:585
#1: ffff8880421282f8 (&osb->journal_shutdown_sem){++++}-{4:4}, at: ocfs2_journal_shutdown+0x4ec/0xb40 fs/ocfs2/journal.c:1122
stack backtrace:
CPU: 0 UID: 0 PID: 5689 Comm: syz-executor875 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
print_circular_bug+0x2e2/0x300 kernel/locking/lockdep.c:2087
check_noncircular+0x12f/0x150 kernel/locking/lockdep.c:2219
check_prev_add kernel/locking/lockdep.c:3209 [inline]
check_prevs_add kernel/locking/lockdep.c:3328 [inline]
validate_chain kernel/locking/lockdep.c:3952 [inline]
__lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288
lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942
__mutex_lock_common kernel/locking/mutex.c:646 [inline]
__mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821
shrinker_free+0xdb/0x3b0 mm/shrinker.c:809
jbd2_journal_destroy+0x606/0x7e0 fs/jbd2/journal.c:2178
ocfs2_journal_shutdown+0x517/0xb40 fs/ocfs2/journal.c:1125
ocfs2_dismount_volume+0x3c9/0x860 fs/ocfs2/super.c:1874
generic_shutdown_super+0x140/0x2d0 fs/super.c:723
kill_block_super+0x44/0xa0 fs/super.c:1852
deactivate_locked_super+0xbe/0x110 fs/super.c:558
cleanup_mnt+0x204/0x2a0 fs/namespace.c:1396
task_work_run+0x1d9/0x260 kernel/task_work.c:233
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
__exit_to_user_mode_loop kernel/entry/common.c:70 [inline]
exit_to_user_mode_loop+0x204/0x770 kernel/entry/common.c:101
__exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:343 [inline]
do_syscall_64+0x336/0x540 arch/x86/entry/syscall_64.c:107
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7ff9dea5b657
Code: a2 c7 05 24 da 09 00 00 00 00 00 eb 96 e8 51 09 00 00 90 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 d8 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007fff91194d68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 00007fff91195610 RCX: 00007ff9dea5b657
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00007ff9deac527a
RBP: 00007fff91195210 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000f1aea66
R13: 00007ff9deac527a R14: 00007ff9deac52fe R15: 00005555828d9760
</TASK>
ocfs2: Unmounting device (7,0) on (node local)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [syzbot] [ocfs2?] possible deadlock in shrinker_free
2026-11-22 2:47 ` syzbot
@ 2026-11-22 17:34 ` Andrew Morton
2026-11-22 17:34 ` syzbot
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2026-11-22 17:34 UTC (permalink / raw)
To: syzbot
Cc: heming.zhao, jlbec, joseph.qi, linux-kernel, mark, ocfs2-devel,
syzkaller-bugs, zzzccc427
On Sat, 21 Nov 2026 18:47:38 -0800 syzbot <syzbot+38fdbb551940270021f1@syzkaller.appspotmail.com> wrote:
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: f802b6558eb8 Merge tag 'xfs-fixes-7.4-rc4' of git://git.ke..
> git tree: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> console output: https://syzkaller.appspot.com/x/log.txt?x=141d98e9580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=3cc6a7ee2d24d208
> dashboard link: https://syzkaller.appspot.com/bug?extid=38fdbb551940270021f1
> compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10918a03580000
>
> The issue was bisected by AI to:
>
> commit f277230d002d03ed98b814b735f9d3d01b42020a
> Author: Cen Zhang <zzzccc427@gmail.com>
> Date: Fri Oct 30 04:48:56 2026 +0000
>
> ocfs2: serialize inode journal access with shutdown
#syz test
From: Andrew Morton <akpm@linux-foundation.org>
Subject: ocfs2: unregister the JBD2 shrinker before journal shutdown
Date: Sat, 21 Nov 2026 19:34:56 -0800
sysbot reports a lockdep cycle through shrinker_mutex, filesystem reclaim
and osb->journal_shutdown_sem. Unmount holds the superblock's s_umount
exclusively, while the OCFS2 reclaim path must first get its read side
with super_trylock_shared(). That excludes the two paths for the same
superblock; the report does not establish a runtime deadlock. Still, the
lock ordering is visible to lockdep and produces the warning.
The write side of journal_shutdown_sem must cover all of
jbd2_journal_destroy(): ocfs2_clear_inode() can otherwise release a JBD2
inode through a journal that is being destroyed. Move only the JBD2
shrinker unregister operation before taking the semaphore.
shrinker_free() waits for active shrinker users, so the journal and its
checkpoint counter remain alive while they finish. A successfully
initialized JBD2 journal always has a checkpoint counter. Destroy it
after unregistering the shrinker, whether unregistering happened here or
before taking the OCFS2 semaphore. The semaphore continues to protect
JBD2 destruction, removal of osb->journal and freeing the OCFS2 journal.
The userspace-visible result is removal of this lockdep warning during
OCFS2 unmount; the report does not demonstrate a hung unmount.
Fixes: f277230d002d ("ocfs2: serialize inode journal access with shutdown")
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reported-by: <syzbot+38fdbb551940270021f1@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=38fdbb551940270021f1
Link: https://lore.kernel.org/6b0257ca.6ccd1e40.868ea.001a.GAE@google.com
Tested-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Cen Zhang <zzzccc427@gmail.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Heming Zhao <heming.zhao@suse.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Jan Kara <jack@suse.cz>
Cc: <stable@vger.kernel.org>
---
Tested with CONFIG_PROVE_LOCKING=y in x86-64 QEMU guests. A omitted
this patch; B added it alone. OCFS2 and JBD2 were built in.
Syzbot's C reproducer mounted a local OCFS2 image, accessed 200 files,
exercised reclaim and unmounted it. A reproduced the reported circular
locking warning: shrinker_free() ran from jbd2_journal_destroy() while
ocfs2_journal_shutdown() held journal_shutdown_sem. The unmount
completed; this test did not show a runtime deadlock.
B completed the same sequence without a warning. Three further
mount/reclaim/unmount cycles on B also completed without warnings.
An ext4 read/write/unmount control passed on both kernels.
Both builds needed the same temporary correction for an unrelated
mm/util.c compile error in another queued patch. The correction was
removed after testing. The test did not force an active JBD2 shrinker
callback to overlap unmount or exercise failed-mount cleanup.
fs/jbd2/journal.c | 17 +++++++++++++----
fs/ocfs2/journal.c | 1 +
include/linux/jbd2.h | 1 +
3 files changed, 15 insertions(+), 4 deletions(-)
--- a/fs/jbd2/journal.c~ocfs2-unregister-the-jbd2-shrinker-before-journal-shutdown
+++ a/fs/jbd2/journal.c
@@ -75,6 +75,7 @@ EXPORT_SYMBOL(jbd2_journal_check_availab
EXPORT_SYMBOL(jbd2_journal_set_features);
EXPORT_SYMBOL(jbd2_journal_load);
EXPORT_SYMBOL(jbd2_journal_destroy);
+EXPORT_SYMBOL(jbd2_journal_unregister_shrinker);
EXPORT_SYMBOL(jbd2_journal_abort);
EXPORT_SYMBOL(jbd2_journal_errno);
EXPORT_SYMBOL(jbd2_journal_ack_err);
@@ -2100,6 +2101,16 @@ int jbd2_journal_load(journal_t *journal
return 0;
}
+void jbd2_journal_unregister_shrinker(journal_t *journal)
+{
+ struct shrinker *shrinker = journal->j_shrinker;
+
+ if (!shrinker)
+ return;
+ journal->j_shrinker = NULL;
+ shrinker_free(shrinker);
+}
+
/**
* jbd2_journal_destroy() - Release a journal_t structure.
* @journal: Journal to act on.
@@ -2173,10 +2184,8 @@ int jbd2_journal_destroy(journal_t *jour
brelse(journal->j_sb_buffer);
}
- if (journal->j_shrinker) {
- percpu_counter_destroy(&journal->j_checkpoint_jh_count);
- shrinker_free(journal->j_shrinker);
- }
+ jbd2_journal_unregister_shrinker(journal);
+ percpu_counter_destroy(&journal->j_checkpoint_jh_count);
if (journal->j_proc_entry)
jbd2_stats_proc_exit(journal);
iput(journal->j_inode);
--- a/fs/ocfs2/journal.c~ocfs2-unregister-the-jbd2-shrinker-before-journal-shutdown
+++ a/fs/ocfs2/journal.c
@@ -1119,6 +1119,7 @@ void ocfs2_journal_shutdown(struct ocfs2
* Exclude the final JBD2 inode cleanup in ocfs2_clear_inode() while
* the journal is destroyed and freed.
*/
+ jbd2_journal_unregister_shrinker(journal->j_journal);
down_write(&osb->journal_shutdown_sem);
/* Shutdown the kernel journal system */
--- a/include/linux/jbd2.h~ocfs2-unregister-the-jbd2-shrinker-before-journal-shutdown
+++ a/include/linux/jbd2.h
@@ -1566,6 +1566,7 @@ extern void jbd2_journal_clear_featur
(journal_t *, unsigned long, unsigned long, unsigned long);
extern int jbd2_journal_load (journal_t *journal);
extern int jbd2_journal_destroy (journal_t *);
+extern void jbd2_journal_unregister_shrinker(journal_t *);
extern int jbd2_journal_recover (journal_t *journal);
extern int jbd2_journal_wipe (journal_t *, int);
extern int jbd2_journal_skip_recovery (journal_t *);
_
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [syzbot] [ocfs2?] possible deadlock in shrinker_free
2026-11-22 17:34 ` Andrew Morton
@ 2026-11-22 17:34 ` syzbot
0 siblings, 0 replies; 4+ messages in thread
From: syzbot @ 2026-11-22 17:34 UTC (permalink / raw)
To: akpm
Cc: akpm, heming.zhao, jlbec, joseph.qi, linux-kernel, mark,
ocfs2-devel, syzkaller-bugs, zzzccc427
> On Sat, 21 Nov 2026 18:47:38 -0800 syzbot <syzbot+38fdbb551940270021f1@syzkaller.appspotmail.com> wrote:
>
>> syzbot has found a reproducer for the following issue on:
>>
>> HEAD commit: f802b6558eb8 Merge tag 'xfs-fixes-7.4-rc4' of git://git.ke..
>> git tree: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>> console output: https://syzkaller.appspot.com/x/log.txt?x=141d98e9580000
>> kernel config: https://syzkaller.appspot.com/x/.config?x=3cc6a7ee2d24d208
>> dashboard link: https://syzkaller.appspot.com/bug?extid=38fdbb551940270021f1
>> compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
>> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10918a03580000
>>
>> The issue was bisected by AI to:
>>
>> commit f277230d002d03ed98b814b735f9d3d01b42020a
>> Author: Cen Zhang <zzzccc427@gmail.com>
>> Date: Fri Oct 30 04:48:56 2026 +0000
>>
>> ocfs2: serialize inode journal access with shutdown
>
> #syz test
Patch testing via #syz test is temporarily disabled.
See https://github.com/google/syzkaller/issues/8122 for details.
>
> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: ocfs2: unregister the JBD2 shrinker before journal shutdown
> Date: Sat, 21 Nov 2026 19:34:56 -0800
>
> sysbot reports a lockdep cycle through shrinker_mutex, filesystem reclaim
> and osb->journal_shutdown_sem. Unmount holds the superblock's s_umount
> exclusively, while the OCFS2 reclaim path must first get its read side
> with super_trylock_shared(). That excludes the two paths for the same
> superblock; the report does not establish a runtime deadlock. Still, the
> lock ordering is visible to lockdep and produces the warning.
>
> The write side of journal_shutdown_sem must cover all of
> jbd2_journal_destroy(): ocfs2_clear_inode() can otherwise release a JBD2
> inode through a journal that is being destroyed. Move only the JBD2
> shrinker unregister operation before taking the semaphore.
> shrinker_free() waits for active shrinker users, so the journal and its
> checkpoint counter remain alive while they finish. A successfully
> initialized JBD2 journal always has a checkpoint counter. Destroy it
> after unregistering the shrinker, whether unregistering happened here or
> before taking the OCFS2 semaphore. The semaphore continues to protect
> JBD2 destruction, removal of osb->journal and freeing the OCFS2 journal.
>
> The userspace-visible result is removal of this lockdep warning during
> OCFS2 unmount; the report does not demonstrate a hung unmount.
>
> Fixes: f277230d002d ("ocfs2: serialize inode journal access with shutdown")
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> Reported-by: <syzbot+38fdbb551940270021f1@syzkaller.appspotmail.com>
> Closes: https://syzkaller.appspot.com/bug?extid=38fdbb551940270021f1
> Link: https://lore.kernel.org/6b0257ca.6ccd1e40.868ea.001a.GAE@google.com
> Tested-by: Andrew Morton <akpm@linux-foundation.org>
> Cc: Cen Zhang <zzzccc427@gmail.com>
> Cc: Mark Fasheh <mark@fasheh.com>
> Cc: Joel Becker <jlbec@evilplan.org>
> Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
> Cc: Heming Zhao <heming.zhao@suse.com>
> Cc: Theodore Ts'o <tytso@mit.edu>
> Cc: Jan Kara <jack@suse.cz>
> Cc: <stable@vger.kernel.org>
> ---
> Tested with CONFIG_PROVE_LOCKING=y in x86-64 QEMU guests. A omitted
> this patch; B added it alone. OCFS2 and JBD2 were built in.
>
> Syzbot's C reproducer mounted a local OCFS2 image, accessed 200 files,
> exercised reclaim and unmounted it. A reproduced the reported circular
> locking warning: shrinker_free() ran from jbd2_journal_destroy() while
> ocfs2_journal_shutdown() held journal_shutdown_sem. The unmount
> completed; this test did not show a runtime deadlock.
>
> B completed the same sequence without a warning. Three further
> mount/reclaim/unmount cycles on B also completed without warnings.
> An ext4 read/write/unmount control passed on both kernels.
>
> Both builds needed the same temporary correction for an unrelated
> mm/util.c compile error in another queued patch. The correction was
> removed after testing. The test did not force an active JBD2 shrinker
> callback to overlap unmount or exercise failed-mount cleanup.
>
> fs/jbd2/journal.c | 17 +++++++++++++----
> fs/ocfs2/journal.c | 1 +
> include/linux/jbd2.h | 1 +
> 3 files changed, 15 insertions(+), 4 deletions(-)
>
> --- a/fs/jbd2/journal.c~ocfs2-unregister-the-jbd2-shrinker-before-journal-shutdown
> +++ a/fs/jbd2/journal.c
> @@ -75,6 +75,7 @@ EXPORT_SYMBOL(jbd2_journal_check_availab
> EXPORT_SYMBOL(jbd2_journal_set_features);
> EXPORT_SYMBOL(jbd2_journal_load);
> EXPORT_SYMBOL(jbd2_journal_destroy);
> +EXPORT_SYMBOL(jbd2_journal_unregister_shrinker);
> EXPORT_SYMBOL(jbd2_journal_abort);
> EXPORT_SYMBOL(jbd2_journal_errno);
> EXPORT_SYMBOL(jbd2_journal_ack_err);
> @@ -2100,6 +2101,16 @@ int jbd2_journal_load(journal_t *journal
> return 0;
> }
>
> +void jbd2_journal_unregister_shrinker(journal_t *journal)
> +{
> + struct shrinker *shrinker = journal->j_shrinker;
> +
> + if (!shrinker)
> + return;
> + journal->j_shrinker = NULL;
> + shrinker_free(shrinker);
> +}
> +
> /**
> * jbd2_journal_destroy() - Release a journal_t structure.
> * @journal: Journal to act on.
> @@ -2173,10 +2184,8 @@ int jbd2_journal_destroy(journal_t *jour
> brelse(journal->j_sb_buffer);
> }
>
> - if (journal->j_shrinker) {
> - percpu_counter_destroy(&journal->j_checkpoint_jh_count);
> - shrinker_free(journal->j_shrinker);
> - }
> + jbd2_journal_unregister_shrinker(journal);
> + percpu_counter_destroy(&journal->j_checkpoint_jh_count);
> if (journal->j_proc_entry)
> jbd2_stats_proc_exit(journal);
> iput(journal->j_inode);
> --- a/fs/ocfs2/journal.c~ocfs2-unregister-the-jbd2-shrinker-before-journal-shutdown
> +++ a/fs/ocfs2/journal.c
> @@ -1119,6 +1119,7 @@ void ocfs2_journal_shutdown(struct ocfs2
> * Exclude the final JBD2 inode cleanup in ocfs2_clear_inode() while
> * the journal is destroyed and freed.
> */
> + jbd2_journal_unregister_shrinker(journal->j_journal);
> down_write(&osb->journal_shutdown_sem);
>
> /* Shutdown the kernel journal system */
> --- a/include/linux/jbd2.h~ocfs2-unregister-the-jbd2-shrinker-before-journal-shutdown
> +++ a/include/linux/jbd2.h
> @@ -1566,6 +1566,7 @@ extern void jbd2_journal_clear_featur
> (journal_t *, unsigned long, unsigned long, unsigned long);
> extern int jbd2_journal_load (journal_t *journal);
> extern int jbd2_journal_destroy (journal_t *);
> +extern void jbd2_journal_unregister_shrinker(journal_t *);
> extern int jbd2_journal_recover (journal_t *journal);
> extern int jbd2_journal_wipe (journal_t *, int);
> extern int jbd2_journal_skip_recovery (journal_t *);
> _
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-22 17:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20 16:12 [syzbot] [ocfs2?] possible deadlock in shrinker_free syzbot
2026-11-22 2:47 ` syzbot
2026-11-22 17:34 ` Andrew Morton
2026-11-22 17:34 ` syzbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®