syzbot
possible deadlock in __ocfs2_reflink
Status:
upstream: reported on 2026/08/09 16:23
Reported-by: syzbot+508551fa033c2f3af4e6@syzkaller.appspotmail.com
First crash: 10d, last: 1d22h
Sample crash report:
JBD2: Ignoring recovery information on journal
ocfs2: Mounting device (7,1) on (node local, slot 0) with ordered data mode.
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.1.383/5485 is trying to acquire lock:
ffff0000e1c9df48 (&sb->s_type->i_mutex_key#21/2){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:793 [inline]
ffff0000e1c9df48 (&sb->s_type->i_mutex_key#21/2){+.+.}-{3:3}, at: __ocfs2_reflink+0x9c0/0x136c fs/ocfs2/refcounttree.c:4178
but task is already holding lock:
ffff0000e1c9ea20 (&ocfs2_file_ip_alloc_sem_key){++++}-{3:3}, at: ocfs2_reflink+0x484/0x84c fs/ocfs2/refcounttree.c:4276
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&ocfs2_file_ip_alloc_sem_key){++++}-{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:2265 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x3c8/0x7c8 fs/read_write.c:584
ksys_pwrite64 fs/read_write.c:699 [inline]
__do_sys_pwrite64 fs/read_write.c:709 [inline]
__se_sys_pwrite64 fs/read_write.c:706 [inline]
__arm64_sys_pwrite64+0x178/0x210 fs/read_write.c:706
__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/0x128 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#21){+.+.}-{3:3}:
down_write+0x5c/0x88 kernel/locking/rwsem.c:1573
inode_lock include/linux/fs.h:758 [inline]
vfs_rename+0x6a8/0xe3c fs/namei.c:4847
do_renameat2+0x760/0xaa4 fs/namei.c:5035
__do_sys_renameat2 fs/namei.c:5068 [inline]
__se_sys_renameat2 fs/namei.c:5065 [inline]
__arm64_sys_renameat2+0xe8/0x104 fs/namei.c:5065
__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/0x128 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#21/2){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3095 [inline]
check_prevs_add kernel/locking/lockdep.c:3214 [inline]
validate_chain kernel/locking/lockdep.c:3830 [inline]
__lock_acquire+0x2808/0x6634 kernel/locking/lockdep.c:5063
lock_acquire+0x20c/0x638 kernel/locking/lockdep.c:5676
down_write_nested+0x64/0x94 kernel/locking/rwsem.c:1689
inode_lock_nested include/linux/fs.h:793 [inline]
__ocfs2_reflink+0x9c0/0x136c fs/ocfs2/refcounttree.c:4178
ocfs2_reflink+0x498/0x84c fs/ocfs2/refcounttree.c:4277
ocfs2_vfs_reflink+0x300/0x400 fs/ocfs2/refcounttree.c:4403
ocfs2_reflink_ioctl+0x35c/0x3f0 fs/ocfs2/refcounttree.c:4443
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/0x128 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#21/2 --> &sb->s_type->i_mutex_key#21 --> &ocfs2_file_ip_alloc_sem_key
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&ocfs2_file_ip_alloc_sem_key);
lock(&sb->s_type->i_mutex_key#21);
lock(&ocfs2_file_ip_alloc_sem_key);
lock(&sb->s_type->i_mutex_key#21/2);
*** DEADLOCK ***
5 locks held by syz.1.383/5485:
#0: ffff0000f64c0460 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:402
#1: ffff0000f4f7c2c8 (&type->i_mutex_dir_key#8/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:793 [inline]
#1: ffff0000f4f7c2c8 (&type->i_mutex_dir_key#8/1){+.+.}-{3:3}, at: filename_create+0x1b0/0x3a8 fs/namei.c:3884
#2: ffff0000e1c9ed88 (&sb->s_type->i_mutex_key#21){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
#2: ffff0000e1c9ed88 (&sb->s_type->i_mutex_key#21){+.+.}-{3:3}, at: ocfs2_vfs_reflink+0x2bc/0x400 fs/ocfs2/refcounttree.c:4400
#3: ffff0000e1c9eab8 (&oi->ip_xattr_sem){++++}-{3:3}, at: ocfs2_reflink+0x47c/0x84c fs/ocfs2/refcounttree.c:4275
#4: ffff0000e1c9ea20 (&ocfs2_file_ip_alloc_sem_key){++++}-{3:3}, at: ocfs2_reflink+0x484/0x84c fs/ocfs2/refcounttree.c:4276
stack backtrace:
CPU: 1 PID: 5485 Comm: syz.1.383 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/07/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:2048
check_noncircular+0x264/0x2f8 kernel/locking/lockdep.c:2170
check_prev_add kernel/locking/lockdep.c:3095 [inline]
check_prevs_add kernel/locking/lockdep.c:3214 [inline]
validate_chain kernel/locking/lockdep.c:3830 [inline]
__lock_acquire+0x2808/0x6634 kernel/locking/lockdep.c:5063
lock_acquire+0x20c/0x638 kernel/locking/lockdep.c:5676
down_write_nested+0x64/0x94 kernel/locking/rwsem.c:1689
inode_lock_nested include/linux/fs.h:793 [inline]
__ocfs2_reflink+0x9c0/0x136c fs/ocfs2/refcounttree.c:4178
ocfs2_reflink+0x498/0x84c fs/ocfs2/refcounttree.c:4277
ocfs2_vfs_reflink+0x300/0x400 fs/ocfs2/refcounttree.c:4403
ocfs2_reflink_ioctl+0x35c/0x3f0 fs/ocfs2/refcounttree.c:4443
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/0x128 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.