syzbot
possible deadlock in __ocfs2_reflink
Status:
upstream: reported on 2026/08/09 16:23
Reported-by: syzbot+508551fa033c2f3af4e6@syzkaller.appspotmail.com
First crash: 95d, last: 27d
Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Tainted: G M
------------------------------------------------------
syz.3.323/5563 is trying to acquire lock:
ffff0000fa47ed88 (&sb->s_type->i_mutex_key#26/2){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:799 [inline]
ffff0000fa47ed88 (&sb->s_type->i_mutex_key#26/2){+.+.}-{3:3}, at: __ocfs2_reflink+0xa64/0x1338 fs/ocfs2/refcounttree.c:4202
but task is already holding lock:
ffff0000fa4922e0 (&oi->ip_alloc_sem){++++}-{3:3}, at: ocfs2_reflink+0x484/0x84c fs/ocfs2/refcounttree.c:4300
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&oi->ip_alloc_sem){++++}-{3:3}:
down_read+0x64/0x300 kernel/locking/rwsem.c:1520
ocfs2_inode_lock_for_extent_tree+0xec/0x268 fs/ocfs2/file.c:2210
ocfs2_prepare_inode_for_write fs/ocfs2/file.c:2266 [inline]
ocfs2_file_write_iter+0x5bc/0x1cd0 fs/ocfs2/file.c:2451
call_write_iter include/linux/fs.h:2271 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x3c8/0x7c8 fs/read_write.c:584
ksys_write+0x12c/0x228 fs/read_write.c:637
__do_sys_write fs/read_write.c:649 [inline]
__se_sys_write fs/read_write.c:646 [inline]
__arm64_sys_write+0x7c/0x90 fs/read_write.c:646
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x290 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x13c/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x5c/0x134 arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x12c arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585
-> #1 (&sb->s_type->i_mutex_key#27){+.+.}-{3:3}:
down_write+0x5c/0x88 kernel/locking/rwsem.c:1573
inode_lock include/linux/fs.h:764 [inline]
vfs_rename+0x6a8/0xe3c fs/namei.c:4890
do_renameat2+0x760/0xaa4 fs/namei.c:5078
__do_sys_renameat2 fs/namei.c:5111 [inline]
__se_sys_renameat2 fs/namei.c:5108 [inline]
__arm64_sys_renameat2+0xe8/0x104 fs/namei.c:5108
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x290 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x13c/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x5c/0x134 arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x12c arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585
-> #0 (&sb->s_type->i_mutex_key#26/2){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3162 [inline]
check_prevs_add kernel/locking/lockdep.c:3281 [inline]
validate_chain kernel/locking/lockdep.c:3897 [inline]
__lock_acquire+0x3504/0x7280 kernel/locking/lockdep.c:5171
lock_acquire+0x210/0x63c kernel/locking/lockdep.c:5790
down_write_nested+0x64/0x94 kernel/locking/rwsem.c:1689
inode_lock_nested include/linux/fs.h:799 [inline]
__ocfs2_reflink+0xa64/0x1338 fs/ocfs2/refcounttree.c:4202
ocfs2_reflink+0x498/0x84c fs/ocfs2/refcounttree.c:4301
ocfs2_vfs_reflink+0x300/0x400 fs/ocfs2/refcounttree.c:4427
ocfs2_reflink_ioctl+0x35c/0x3f0 fs/ocfs2/refcounttree.c:4467
ocfs2_ioctl+0x884/0xb2c fs/ocfs2/ioctl.c:913
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:856
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x290 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x13c/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x5c/0x134 arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x12c arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585
other info that might help us debug this:
Chain exists of:
&sb->s_type->i_mutex_key#26/2 --> &sb->s_type->i_mutex_key#27 --> &oi->ip_alloc_sem
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&oi->ip_alloc_sem);
lock(&sb->s_type->i_mutex_key#27);
lock(&oi->ip_alloc_sem);
lock(&sb->s_type->i_mutex_key#26/2);
*** DEADLOCK ***
5 locks held by syz.3.323/5563:
#0: ffff0000fd50c460 (sb_writers#16){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:402
#1: ffff0000fa483488 (&type->i_mutex_dir_key#10/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:799 [inline]
#1: ffff0000fa483488 (&type->i_mutex_dir_key#10/1){+.+.}-{3:3}, at: filename_create+0x1b0/0x3a8 fs/namei.c:3927
#2: ffff0000fa492648 (&sb->s_type->i_mutex_key#27){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:764 [inline]
#2: ffff0000fa492648 (&sb->s_type->i_mutex_key#27){+.+.}-{3:3}, at: ocfs2_vfs_reflink+0x2bc/0x400 fs/ocfs2/refcounttree.c:4424
#3: ffff0000fa492378 (&oi->ip_xattr_sem){++++}-{3:3}, at: ocfs2_reflink+0x47c/0x84c fs/ocfs2/refcounttree.c:4299
#4: ffff0000fa4922e0 (&oi->ip_alloc_sem){++++}-{3:3}, at: ocfs2_reflink+0x484/0x84c fs/ocfs2/refcounttree.c:4300
stack backtrace:
CPU: 1 PID: 5563 Comm: syz.3.323 Tainted: G M syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/14/2026
Call trace:
dump_backtrace+0x1c4/0x1f0 arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack+0x30/0x40 lib/dump_stack.c:88
dump_stack_lvl+0xf4/0x15c lib/dump_stack.c:106
dump_stack+0x1c/0x5c lib/dump_stack.c:113
print_circular_bug+0x148/0x1b0 kernel/locking/lockdep.c:2088
check_noncircular+0x290/0x370 kernel/locking/lockdep.c:2215
check_prev_add kernel/locking/lockdep.c:3162 [inline]
check_prevs_add kernel/locking/lockdep.c:3281 [inline]
validate_chain kernel/locking/lockdep.c:3897 [inline]
__lock_acquire+0x3504/0x7280 kernel/locking/lockdep.c:5171
lock_acquire+0x210/0x63c kernel/locking/lockdep.c:5790
down_write_nested+0x64/0x94 kernel/locking/rwsem.c:1689
inode_lock_nested include/linux/fs.h:799 [inline]
__ocfs2_reflink+0xa64/0x1338 fs/ocfs2/refcounttree.c:4202
ocfs2_reflink+0x498/0x84c fs/ocfs2/refcounttree.c:4301
ocfs2_vfs_reflink+0x300/0x400 fs/ocfs2/refcounttree.c:4427
ocfs2_reflink_ioctl+0x35c/0x3f0 fs/ocfs2/refcounttree.c:4467
ocfs2_ioctl+0x884/0xb2c fs/ocfs2/ioctl.c:913
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:856
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x290 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x13c/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x5c/0x134 arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x12c arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585
* Struck through repros no longer work on HEAD.