possible deadlock in ocfs2_remove_btree_range (3)

Status: upstream: reported on 2026/07/28 02:59
Reported-by: syzbot+5ef4e438a0104b474f2c@syzkaller.appspotmail.com
First crash: 121d, last: 16h52m
▶ ▼ Similar bugs (5)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ocfs2_remove_btree_range (2) ocfs2 4 1 386d 382d 0/30 auto-obsoleted due to no activity on 2026/02/13 02:43
linux-6.1 possible deadlock in ocfs2_remove_btree_range 4 49 2d06h 301d 0/3 upstream: reported on 2026/01/29 20:10
linux-5.15 possible deadlock in ocfs2_remove_btree_range (2) 4 4 226d 291d 0/3 auto-obsoleted due to no activity on 2026/07/23 14:33
linux-5.15 possible deadlock in ocfs2_remove_btree_range 4 1 802d 802d 0/3 auto-obsoleted due to no activity on 2024/12/24 02:14
upstream possible deadlock in ocfs2_remove_btree_range ocfs2 4 2 733d 759d 0/30 auto-obsoleted due to no activity on 2025/03/03 19:57

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.8.2314/16087 is trying to acquire lock:
ffff888076e9df48 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#5){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:795 [inline]
ffff888076e9df48 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#5){+.+.}-{3:3}, at: ocfs2_remove_btree_range+0x64f/0x15e0 fs/ocfs2/alloc.c:5746

but task is already holding lock:
ffff888076e994a0 (&ocfs2_file_ip_alloc_sem_key){++++}-{3:3}, at: ocfs2_remap_file_range+0x3d4/0x740 fs/ocfs2/file.c:2726

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #5 (&ocfs2_file_ip_alloc_sem_key){++++}-{3:3}:
       down_write+0x38/0x60 kernel/locking/rwsem.c:1551
       ocfs2_page_mkwrite+0x2c4/0xaa0 fs/ocfs2/mmap.c:141
       do_page_mkwrite+0x168/0x3c0 mm/memory.c:2929
       wp_page_shared+0x163/0x6c0 mm/memory.c:3268
       handle_pte_fault mm/memory.c:4677 [inline]
       __handle_mm_fault mm/memory.c:4794 [inline]
       handle_mm_fault+0x1fbd/0x4440 mm/memory.c:4892
       do_user_addr_fault+0x494/0xc90 arch/x86/mm/fault.c:1355
       handle_page_fault arch/x86/mm/fault.c:1443 [inline]
       exc_page_fault+0x60/0x100 arch/x86/mm/fault.c:1496
       asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:606
       copy_user_enhanced_fast_string+0xe/0x40 arch/x86/lib/copy_user_64.S:205
       copy_user_generic arch/x86/include/asm/uaccess_64.h:37 [inline]
       raw_copy_to_user arch/x86/include/asm/uaccess_64.h:58 [inline]
       copyout lib/iov_iter.c:157 [inline]
       copy_page_to_iter_iovec lib/iov_iter.c:228 [inline]
       __copy_page_to_iter lib/iov_iter.c:861 [inline]
       copy_page_to_iter+0x4c9/0x930 lib/iov_iter.c:889
       filemap_read+0x1e0a/0x2560 mm/filemap.c:2714
       ocfs2_file_read_iter+0x288/0xab0 fs/ocfs2/file.c:2622
       call_read_iter include/linux/fs.h:2175 [inline]
       new_sync_read fs/read_write.c:404 [inline]
       vfs_read+0x75e/0xd50 fs/read_write.c:485
       ksys_read+0x153/0x260 fs/read_write.c:623
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #4 (sb_pagefaults#8){.+.+}-{0:0}:
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1819 [inline]
       sb_start_pagefault include/linux/fs.h:1918 [inline]
       ocfs2_page_mkwrite+0x1a7/0xaa0 fs/ocfs2/mmap.c:121
       do_page_mkwrite+0x168/0x3c0 mm/memory.c:2929
       wp_page_shared+0x163/0x6c0 mm/memory.c:3268
       handle_pte_fault mm/memory.c:4677 [inline]
       __handle_mm_fault mm/memory.c:4794 [inline]
       handle_mm_fault+0x1fbd/0x4440 mm/memory.c:4892
       do_user_addr_fault+0x494/0xc90 arch/x86/mm/fault.c:1355
       handle_page_fault arch/x86/mm/fault.c:1443 [inline]
       exc_page_fault+0x60/0x100 arch/x86/mm/fault.c:1496
       asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:606
       copy_user_enhanced_fast_string+0xe/0x40 arch/x86/lib/copy_user_64.S:205
       copy_user_generic arch/x86/include/asm/uaccess_64.h:37 [inline]
       raw_copy_to_user arch/x86/include/asm/uaccess_64.h:58 [inline]
       copyout lib/iov_iter.c:157 [inline]
       copy_page_to_iter_iovec lib/iov_iter.c:228 [inline]
       __copy_page_to_iter lib/iov_iter.c:861 [inline]
       copy_page_to_iter+0x4c9/0x930 lib/iov_iter.c:889
       filemap_read+0x1e0a/0x2560 mm/filemap.c:2714
       ocfs2_file_read_iter+0x288/0xab0 fs/ocfs2/file.c:2622
       call_read_iter include/linux/fs.h:2175 [inline]
       new_sync_read fs/read_write.c:404 [inline]
       vfs_read+0x75e/0xd50 fs/read_write.c:485
       ksys_read+0x153/0x260 fs/read_write.c:623
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #3 (&mm->mmap_lock){++++}-{3:3}:
       down_read+0x44/0x2e0 kernel/locking/rwsem.c:1498
       mmap_read_lock+0x1c/0x50 include/linux/mmap_lock.h:117
       do_user_addr_fault+0xc3f/0xc90 arch/x86/mm/fault.c:1306
       handle_page_fault arch/x86/mm/fault.c:1443 [inline]
       exc_page_fault+0x60/0x100 arch/x86/mm/fault.c:1496
       asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:606
       __get_user_nocheck_1+0x6/0x10 arch/x86/lib/getuser.S:103
       fault_in_readable+0x52/0x150 mm/gup.c:1793
       fault_in_iov_iter_readable+0x128/0x270 lib/iov_iter.c:460
       generic_perform_write+0x3b8/0x550 mm/filemap.c:3783
       ext4_buffered_write_iter+0x256/0x3a0 fs/ext4/file.c:275
       ext4_file_write_iter+0x73f/0x1720 fs/ext4/file.c:-1
       call_write_iter include/linux/fs.h:2181 [inline]
       new_sync_write fs/read_write.c:507 [inline]
       vfs_write+0x748/0xd70 fs/read_write.c:594
       ksys_write+0x153/0x260 fs/read_write.c:647
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #2 (&sb->s_type->i_mutex_key#9){++++}-{3:3}:
       down_read+0x44/0x2e0 kernel/locking/rwsem.c:1498
       inode_lock_shared include/linux/fs.h:805 [inline]
       ext4_bmap+0x4f/0x3f0 fs/ext4/inode.c:3167
       bmap+0xa2/0xd0 fs/inode.c:1828
       jbd2_journal_bmap fs/jbd2/journal.c:981 [inline]
       jbd2_fc_get_buf+0x17b/0x350 fs/jbd2/journal.c:894
       ext4_fc_reserve_space+0x4fa/0x890 fs/ext4/fast_commit.c:705
       ext4_fc_add_tlv+0xab/0x570 fs/ext4/fast_commit.c:797
       ext4_fc_perform_commit fs/ext4/fast_commit.c:1122 [inline]
       ext4_fc_commit+0xb08/0x1380 fs/ext4/fast_commit.c:1235
       ext4_fsync_journal fs/ext4/fsync.c:115 [inline]
       ext4_sync_file+0x550/0xb10 fs/ext4/fsync.c:174
       generic_write_sync include/linux/fs.h:3003 [inline]
       ext4_buffered_write_iter+0x32b/0x3a0 fs/ext4/file.c:282
       ext4_file_write_iter+0x73f/0x1720 fs/ext4/file.c:-1
       call_write_iter include/linux/fs.h:2181 [inline]
       new_sync_write fs/read_write.c:507 [inline]
       vfs_write+0x748/0xd70 fs/read_write.c:594
       ksys_pwrite64 fs/read_write.c:701 [inline]
       __do_sys_pwrite64 fs/read_write.c:711 [inline]
       __se_sys_pwrite64 fs/read_write.c:708 [inline]
       __x64_sys_pwrite64+0x197/0x220 fs/read_write.c:708
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #1 (&journal->j_barrier){+.+.}-{3:3}:
       __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596
       __mutex_lock kernel/locking/mutex.c:729 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
       jbd2_journal_lock_updates+0x2ce/0x390 fs/jbd2/transaction.c:905
       __ocfs2_flush_truncate_log+0x2b4/0x1110 fs/ocfs2/alloc.c:6031
       ocfs2_flush_truncate_log+0x4b/0x60 fs/ocfs2/alloc.c:6078
       ocfs2_sync_fs+0x119/0x330 fs/ocfs2/super.c:404
       sync_filesystem+0x1be/0x220 fs/sync.c:66
       generic_shutdown_super+0x6b/0x300 fs/super.c:448
       kill_block_super+0x7c/0xe0 fs/super.c:1438
       deactivate_locked_super+0x93/0xf0 fs/super.c:335
       cleanup_mnt+0x426/0x4d0 fs/namespace.c:1148
       task_work_run+0x125/0x1a0 kernel/task_work.c:188
       tracehook_notify_resume include/linux/tracehook.h:189 [inline]
       exit_to_user_mode_loop+0x10f/0x130 kernel/entry/common.c:184
       exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:217
       __syscall_exit_to_user_mode_work kernel/entry/common.c:299 [inline]
       syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:310
       do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #0 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#5){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3125 [inline]
       check_prevs_add kernel/locking/lockdep.c:3244 [inline]
       validate_chain kernel/locking/lockdep.c:3860 [inline]
       __lock_acquire+0x39b7/0x7e20 kernel/locking/lockdep.c:5134
       lock_acquire+0x19f/0x400 kernel/locking/lockdep.c:5751
       down_write+0x38/0x60 kernel/locking/rwsem.c:1551
       inode_lock include/linux/fs.h:795 [inline]
       ocfs2_remove_btree_range+0x64f/0x15e0 fs/ocfs2/alloc.c:5746
       ocfs2_remove_inode_range+0xf4a/0x2610 fs/ocfs2/file.c:1935
       ocfs2_reflink_remap_extent fs/ocfs2/refcounttree.c:4598 [inline]
       ocfs2_reflink_remap_blocks+0xc6b/0x1ab0 fs/ocfs2/refcounttree.c:4745
       ocfs2_remap_file_range+0x4a7/0x740 fs/ocfs2/file.c:2736
       vfs_copy_file_range+0xf5c/0x1520 fs/read_write.c:1512
       __do_sys_copy_file_range fs/read_write.c:1590 [inline]
       __se_sys_copy_file_range+0x320/0x470 fs/read_write.c:1553
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

other info that might help us debug this:

Chain exists of:
  &ocfs2_sysfile_lock_key[args->fi_sysfile_type]#5 --> sb_pagefaults#8 --> &ocfs2_file_ip_alloc_sem_key

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&ocfs2_file_ip_alloc_sem_key);
                               lock(sb_pagefaults#8);
                               lock(&ocfs2_file_ip_alloc_sem_key);
  lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#5);

 *** DEADLOCK ***

3 locks held by syz.8.2314/16087:
 #0: ffff888040c88460 (
sb_writers#39
){.+.+}-{0:0}, at: vfs_copy_file_range+0x8f3/0x1520 fs/read_write.c:1496
 #1: ffff888076e99808 (&sb->s_type->i_mutex_key#47){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:795 [inline]
 #1: ffff888076e99808 (&sb->s_type->i_mutex_key#47){+.+.}-{3:3}, at: lock_two_nondirectories+0xf7/0x150 fs/inode.c:1155
 #2: 
ffff888076e994a0
 (&ocfs2_file_ip_alloc_sem_key){++++}-{3:3}, at: ocfs2_remap_file_range+0x3d4/0x740 fs/ocfs2/file.c:2726

stack backtrace:
CPU: 0 PID: 16087 Comm: syz.8.2314 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/0x250 lib/dump_stack.c:106
 check_noncircular+0x2f8/0x400 kernel/locking/lockdep.c:2178
 check_prev_add kernel/locking/lockdep.c:3125 [inline]
 check_prevs_add kernel/locking/lockdep.c:3244 [inline]
 validate_chain kernel/locking/lockdep.c:3860 [inline]
 __lock_acquire+0x39b7/0x7e20 kernel/locking/lockdep.c:5134
 lock_acquire+0x19f/0x400 kernel/locking/lockdep.c:5751
 down_write+0x38/0x60 kernel/locking/rwsem.c:1551
 inode_lock include/linux/fs.h:795 [inline]
 ocfs2_remove_btree_range+0x64f/0x15e0 fs/ocfs2/alloc.c:5746
 ocfs2_remove_inode_range+0xf4a/0x2610 fs/ocfs2/file.c:1935
 ocfs2_reflink_remap_extent fs/ocfs2/refcounttree.c:4598 [inline]
 ocfs2_reflink_remap_blocks+0xc6b/0x1ab0 fs/ocfs2/refcounttree.c:4745
 ocfs2_remap_file_range+0x4a7/0x740 fs/ocfs2/file.c:2736
 vfs_copy_file_range+0xf5c/0x1520 fs/read_write.c:1512
 __do_sys_copy_file_range fs/read_write.c:1590 [inline]
 __se_sys_copy_file_range+0x320/0x470 fs/read_write.c:1553
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f9cdb36ba99
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:00007f9cd9576028 EFLAGS: 00000246 ORIG_RAX: 0000000000000146
RAX: ffffffffffffffda RBX: 00007f9cdb5f8190 RCX: 00007f9cdb36ba99
RDX: 0000000000000006 RSI: 0000000000000000 RDI: 0000000000000006
RBP: 00007f9cdb3fb18b R08: 0000000000000863 R09: 0000000000000000
R10: 0000200000018000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f9cdb5f8228 R14: 00007f9cdb5f8190 R15: 00007fff20f8c818
 </TASK>
kcov: kcov_task_exit: t = ffff88802c880000, kcov->t = ffff88802c880000

Crashes (10):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/26 05:25 linux-5.15.y 4f2df9a01754 9a575fe5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ocfs2_remove_btree_range
2026/11/23 15:45 linux-5.15.y 4f2df9a01754 e9bfbe3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ocfs2_remove_btree_range
2026/11/10 05:01 linux-5.15.y 29c6cdaac04a 70ec0380 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ocfs2_remove_btree_range
2026/10/18 13:46 linux-5.15.y 792fbe1537d8 432c0077 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ocfs2_remove_btree_range
2026/10/17 03:02 linux-5.15.y 792fbe1537d8 432c0077 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ocfs2_remove_btree_range
2026/10/15 23:27 linux-5.15.y 792fbe1537d8 3f2522c6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ocfs2_remove_btree_range
2026/10/10 21:15 linux-5.15.y a051a4bf909f 4f92358f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ocfs2_remove_btree_range
2026/10/07 13:26 linux-5.15.y a051a4bf909f 6520ecdb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ocfs2_remove_btree_range
2026/08/14 13:20 linux-5.15.y aabd761612db 6f9b3e89 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ocfs2_remove_btree_range
2026/07/28 02:58 linux-5.15.y 674f684f7c61 45ae1df4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ocfs2_remove_btree_range
* Struck through repros no longer work on HEAD.