syzbot
possible deadlock in ocfs2_reflink
Status:
upstream: reported on 2026/07/23 12:37
Reported-by: syzbot+a23565fe695ce2cb9a77@syzkaller.appspotmail.com
First crash: 5d22h, last: 4h42m
Sample crash report:
loop4: detected capacity change from 0 to 32768
JBD2: Ignoring recovery information on journal
ocfs2: Mounting device (7,4) on (node local, slot 0) with ordered data mode.
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.4.5223/19332 is trying to acquire lock:
ffff8880727bb120 (&ocfs2_file_ip_alloc_sem_key){++++}-{3:3}, at: ocfs2_reflink+0x4cb/0x920 fs/ocfs2/refcounttree.c:4276
but task is already holding lock:
ffff8880727bb1b8 (&oi->ip_xattr_sem){++++}-{3:3}, at: ocfs2_reflink+0x4bc/0x920 fs/ocfs2/refcounttree.c:4275
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #3 (&oi->ip_xattr_sem){++++}-{3:3}:
down_read+0x42/0x2d0 kernel/locking/rwsem.c:1520
ocfs2_init_acl+0x307/0x770 fs/ocfs2/acl.c:365
ocfs2_mknod+0x18e0/0x2580 fs/ocfs2/namei.c:410
ocfs2_create+0x1b6/0x4b0 fs/ocfs2/namei.c:674
lookup_open fs/namei.c:3490 [inline]
open_last_lookups fs/namei.c:3558 [inline]
path_openat+0x11b9/0x2f10 fs/namei.c:3788
do_filp_open+0x1ee/0x420 fs/namei.c:3818
do_sys_openat2+0x14b/0x4f0 fs/open.c:1320
do_sys_open fs/open.c:1336 [inline]
__do_sys_openat fs/open.c:1352 [inline]
__se_sys_openat fs/open.c:1347 [inline]
__x64_sys_openat+0x135/0x160 fs/open.c:1347
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2
-> #2 (&journal->j_trans_barrier){.+.+}-{3:3}:
down_read+0x42/0x2d0 kernel/locking/rwsem.c:1520
ocfs2_start_trans+0x3a4/0x6f0 fs/ocfs2/journal.c:374
ocfs2_mknod+0x1273/0x2580 fs/ocfs2/namei.c:361
ocfs2_create+0x1b6/0x4b0 fs/ocfs2/namei.c:674
lookup_open fs/namei.c:3490 [inline]
open_last_lookups fs/namei.c:3558 [inline]
path_openat+0x11b9/0x2f10 fs/namei.c:3788
do_filp_open+0x1ee/0x420 fs/namei.c:3818
do_sys_openat2+0x14b/0x4f0 fs/open.c:1320
do_sys_open fs/open.c:1336 [inline]
__do_sys_openat fs/open.c:1352 [inline]
__se_sys_openat fs/open.c:1347 [inline]
__x64_sys_openat+0x135/0x160 fs/open.c:1347
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2
-> #1 (sb_internal#3){.+.+}-{0:0}:
percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
__sb_start_write include/linux/fs.h:1891 [inline]
sb_start_intwrite include/linux/fs.h:2013 [inline]
ocfs2_start_trans+0x2a5/0x6f0 fs/ocfs2/journal.c:372
ocfs2_write_begin_nolock+0x2995/0x4590 fs/ocfs2/aops.c:1772
ocfs2_write_begin+0x1b7/0x310 fs/ocfs2/aops.c:1906
generic_perform_write+0x2fa/0x5c0 mm/filemap.c:3862
__generic_file_write_iter+0x148/0x2a0 mm/filemap.c:3960
ocfs2_file_write_iter+0x1731/0x1fc0 fs/ocfs2/file.c:2469
call_write_iter include/linux/fs.h:2265 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x482/0x9a0 fs/read_write.c:584
ksys_write+0x14d/0x260 fs/read_write.c:637
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2
-> #0 (&ocfs2_file_ip_alloc_sem_key){++++}-{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+0x2d18/0x7c40 kernel/locking/lockdep.c:5063
lock_acquire+0x1bb/0x4a0 kernel/locking/lockdep.c:5676
down_write+0x36/0x60 kernel/locking/rwsem.c:1573
ocfs2_reflink+0x4cb/0x920 fs/ocfs2/refcounttree.c:4276
ocfs2_vfs_reflink+0x333/0x450 fs/ocfs2/refcounttree.c:4403
ocfs2_reflink_ioctl+0x39c/0x440 fs/ocfs2/refcounttree.c:4443
ocfs2_ioctl+0x584/0x7c0 fs/ocfs2/ioctl.c:913
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl+0xfa/0x170 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2
other info that might help us debug this:
Chain exists of:
&ocfs2_file_ip_alloc_sem_key --> &journal->j_trans_barrier --> &oi->ip_xattr_sem
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&oi->ip_xattr_sem);
lock(&journal->j_trans_barrier);
lock(&oi->ip_xattr_sem);
lock(&ocfs2_file_ip_alloc_sem_key);
*** DEADLOCK ***
4 locks held by syz.4.5223/19332:
#0: ffff888076bce460 (sb_writers#28){.+.+}-{0:0}, at: mnt_want_write+0x3d/0x90 fs/namespace.c:402
#1: ffff88804f8ea648 (&type->i_mutex_dir_key#23/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:793 [inline]
#1: ffff88804f8ea648 (&type->i_mutex_dir_key#23/1){+.+.}-{3:3}, at: filename_create+0x20b/0x450 fs/namei.c:3884
#2: ffff8880727bb488 (&sb->s_type->i_mutex_key#37){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
#2: ffff8880727bb488 (&sb->s_type->i_mutex_key#37){+.+.}-{3:3}, at: ocfs2_vfs_reflink+0x2f3/0x450 fs/ocfs2/refcounttree.c:4400
#3: ffff8880727bb1b8 (&oi->ip_xattr_sem){++++}-{3:3}, at: ocfs2_reflink+0x4bc/0x920 fs/ocfs2/refcounttree.c:4275
stack backtrace:
CPU: 0 PID: 19332 Comm: syz.4.5223 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
Call Trace:
<TASK>
dump_stack_lvl+0x188/0x24e lib/dump_stack.c:106
check_noncircular+0x296/0x330 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+0x2d18/0x7c40 kernel/locking/lockdep.c:5063
lock_acquire+0x1bb/0x4a0 kernel/locking/lockdep.c:5676
down_write+0x36/0x60 kernel/locking/rwsem.c:1573
ocfs2_reflink+0x4cb/0x920 fs/ocfs2/refcounttree.c:4276
ocfs2_vfs_reflink+0x333/0x450 fs/ocfs2/refcounttree.c:4403
ocfs2_reflink_ioctl+0x39c/0x440 fs/ocfs2/refcounttree.c:4443
ocfs2_ioctl+0x584/0x7c0 fs/ocfs2/ioctl.c:913
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl+0xfa/0x170 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f513099de99
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f5131897028 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f5130c25fa0 RCX: 00007f513099de99
RDX: 00002000000001c0 RSI: 0000000040186f04 RDI: 0000000000000004
RBP: 00007f5130a33eaf R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f5130c26038 R14: 00007f5130c25fa0 R15: 00007fff49779688
</TASK>
* Struck through repros no longer work on HEAD.