possible deadlock in ocfs2_duplicate_inline_data

Status: upstream: reported on 2026/11/25 07:40
Reported-by: syzbot+24284c3ef621cac69e53@syzkaller.appspotmail.com
First crash: 7d00h, last: 6d02h
▶ ▼ Similar bugs (1)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ocfs2_duplicate_inline_data prio:high ocfs2 4 syz, C 13 1h52m 17d 2/30 upstream: reported C repro on 2026/11/14 08:26

Sample crash report:
loop3: detected capacity change from 0 to 32768
JBD2: Ignoring recovery information on journal
ocfs2: Mounting device (7,3) on (node local, slot 0) with ordered data mode.
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.3.456/6217 is trying to acquire lock:
ffff888024060650 (sb_internal#3){.+.+}-{0:0}, at: ocfs2_duplicate_inline_data+0x167/0x560 fs/ocfs2/refcounttree.c:3968

but task is already holding lock:
ffff88807252cda0 (&ocfs2_file_ip_alloc_sem_key/1){+.+.}-{3:3}, at: ocfs2_remap_file_range+0x3f0/0x740 fs/ocfs2/file.c:2725

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&ocfs2_file_ip_alloc_sem_key/1){+.+.}-{3:3}:
       down_write_nested+0x39/0x60 kernel/locking/rwsem.c:1689
       ocfs2_xattr_set_handle+0x3f9/0x820 fs/ocfs2/xattr.c:3591
       ocfs2_set_acl+0x4a5/0x580 fs/ocfs2/acl.c:249
       ocfs2_init_acl+0x1f7/0x420 fs/ocfs2/acl.c:426
       ocfs2_mknod+0x1869/0x2500 fs/ocfs2/namei.c:409
       ocfs2_mkdir+0x1b6/0x4b0 fs/ocfs2/namei.c:658
       vfs_mkdir+0x386/0x570 fs/namei.c:4161
       do_mkdirat+0x1d8/0x440 fs/namei.c:4186
       __do_sys_mkdirat fs/namei.c:4201 [inline]
       __se_sys_mkdirat fs/namei.c:4199 [inline]
       __x64_sys_mkdirat+0x85/0x90 fs/namei.c:4199
       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 (&journal->j_trans_barrier){.+.+}-{3:3}:
       down_read+0x42/0x2d0 kernel/locking/rwsem.c:1520
       ocfs2_start_trans+0x3a4/0x6f0 fs/ocfs2/journal.c:384
       ocfs2_setattr+0x1029/0x1dd0 fs/ocfs2/file.c:1276
       notify_change+0xca0/0xf90 fs/attr.c:499
       chown_common+0x489/0x640 fs/open.c:736
       vfs_fchown fs/open.c:804 [inline]
       ksys_fchown+0xe2/0x150 fs/open.c:815
       __do_sys_fchown fs/open.c:823 [inline]
       __se_sys_fchown fs/open.c:821 [inline]
       __x64_sys_fchown+0x76/0x80 fs/open.c:821
       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 (sb_internal#3){.+.+}-{0:0}:
       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+0x3a03/0x7ea0 kernel/locking/lockdep.c:5171
       lock_acquire+0x1bc/0x4a0 kernel/locking/lockdep.c:5790
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1899 [inline]
       sb_start_intwrite include/linux/fs.h:2021 [inline]
       ocfs2_start_trans+0x2a5/0x6f0 fs/ocfs2/journal.c:382
       ocfs2_duplicate_inline_data+0x167/0x560 fs/ocfs2/refcounttree.c:3968
       ocfs2_reflink_remap_blocks+0x4a7/0x1ab0 fs/ocfs2/refcounttree.c:4661
       ocfs2_remap_file_range+0x4a7/0x740 fs/ocfs2/file.c:2733
       vfs_copy_file_range+0xd89/0x1520 fs/read_write.c:1520
       __do_sys_copy_file_range fs/read_write.c:1598 [inline]
       __se_sys_copy_file_range+0x320/0x470 fs/read_write.c:1561
       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:
  sb_internal#3 --> &journal->j_trans_barrier --> &ocfs2_file_ip_alloc_sem_key/1

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&ocfs2_file_ip_alloc_sem_key/1);
                               lock(&journal->j_trans_barrier);
                               lock(&ocfs2_file_ip_alloc_sem_key/1);
  rlock(sb_internal#3);

 *** DEADLOCK ***

5 locks held by syz.3.456/6217:
 #0: ffff888024060460 (sb_writers#17){.+.+}-{0:0}, at: vfs_copy_file_range+0x8c2/0x1520 fs/read_write.c:1504
 #1: ffff88807252d108 (&sb->s_type->i_mutex_key#32){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:766 [inline]
 #1: ffff88807252d108 (&sb->s_type->i_mutex_key#32){+.+.}-{3:3}, at: lock_two_nondirectories+0xf7/0x150 fs/inode.c:1217
 #2: ffff88807252df48 (&sb->s_type->i_mutex_key#32/4){+.+.}-{3:3}, at: ocfs2_reflink_inodes_lock+0x129/0xcc0 fs/ocfs2/refcounttree.c:4749
 #3: ffff88807252dbe0 (&ocfs2_file_ip_alloc_sem_key){++++}-{3:3}, at: ocfs2_remap_file_range+0x3d4/0x740 fs/ocfs2/file.c:2723
 #4: ffff88807252cda0 (&ocfs2_file_ip_alloc_sem_key/1){+.+.}-{3:3}, at: ocfs2_remap_file_range+0x3f0/0x740 fs/ocfs2/file.c:2725

stack backtrace:
CPU: 1 PID: 6217 Comm: syz.3.456 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x188/0x24e lib/dump_stack.c:106
 check_noncircular+0x2f8/0x400 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+0x3a03/0x7ea0 kernel/locking/lockdep.c:5171
 lock_acquire+0x1bc/0x4a0 kernel/locking/lockdep.c:5790
 percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
 __sb_start_write include/linux/fs.h:1899 [inline]
 sb_start_intwrite include/linux/fs.h:2021 [inline]
 ocfs2_start_trans+0x2a5/0x6f0 fs/ocfs2/journal.c:382
 ocfs2_duplicate_inline_data+0x167/0x560 fs/ocfs2/refcounttree.c:3968
 ocfs2_reflink_remap_blocks+0x4a7/0x1ab0 fs/ocfs2/refcounttree.c:4661
 ocfs2_remap_file_range+0x4a7/0x740 fs/ocfs2/file.c:2733
 vfs_copy_file_range+0xd89/0x1520 fs/read_write.c:1520
 __do_sys_copy_file_range fs/read_write.c:1598 [inline]
 __se_sys_copy_file_range+0x320/0x470 fs/read_write.c:1561
 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:0x7f53f07a9a19
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:00007f53ee9f6028 EFLAGS: 00000246 ORIG_RAX: 0000000000000146
RAX: ffffffffffffffda RBX: 00007f53f0a35fa0 RCX: 00007f53f07a9a19
RDX: 0000000000000004 RSI: 00002000000001c0 RDI: 0000000000000005
RBP: 00007f53f0839156 R08: 00000000a003e458 R09: 0700000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f53f0a36038 R14: 00007f53f0a35fa0 R15: 00007ffd108848e8
 </TASK>

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/25 07:40 linux-6.1.y 1ca1436ccc68 bda6e3c6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_duplicate_inline_data
2026/11/26 05:11 linux-6.1.y 1ca1436ccc68 9a575fe5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_duplicate_inline_data
2026/11/26 05:11 linux-6.1.y 1ca1436ccc68 9a575fe5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_duplicate_inline_data
2026/11/26 05:10 linux-6.1.y 1ca1436ccc68 9a575fe5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_duplicate_inline_data
* Struck through repros no longer work on HEAD.