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: 75d, last: 7h36m
▶ ▼ 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 340d 336d 0/29 auto-obsoleted due to no activity on 2026/02/13 02:43
linux-6.1 possible deadlock in ocfs2_remove_btree_range 4 33 5d01h 254d 0/3 upstream: reported on 2026/01/29 20:10
linux-5.15 possible deadlock in ocfs2_remove_btree_range (2) 4 4 179d 244d 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 756d 756d 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 686d 713d 0/29 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.2.865/11277 is trying to acquire lock:
ffff88805083b488 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#7){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:793 [inline]
ffff88805083b488 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#7){+.+.}-{3:3}, at: ocfs2_remove_btree_range+0x64f/0x15e0 fs/ocfs2/alloc.c:5742

but task is already holding lock:
ffff88805092bf60 (&ocfs2_quota_ip_alloc_sem_key){++++}-{3:3}, at: ocfs2_truncate_file+0x335/0x1540 fs/ocfs2/file.c:467

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #4 (&ocfs2_quota_ip_alloc_sem_key){++++}-{3:3}:
       down_write+0x38/0x60 kernel/locking/rwsem.c:1551
       ocfs2_create_local_dquot+0x199/0x18d0 fs/ocfs2/quota_local.c:1224
       ocfs2_acquire_dquot+0x822/0xb30 fs/ocfs2/quota_global.c:871
       dqget+0x713/0xbb0 fs/quota/dquot.c:1010
       __dquot_initialize+0x3a9/0xd00 fs/quota/dquot.c:1539
       ocfs2_get_init_inode+0x144/0x1b0 fs/ocfs2/namei.c:202
       ocfs2_mknod+0x90e/0x2460 fs/ocfs2/namei.c:311
       ocfs2_create+0x192/0x420 fs/ocfs2/namei.c:676
       lookup_open fs/namei.c:3513 [inline]
       open_last_lookups fs/namei.c:3583 [inline]
       path_openat+0x120a/0x2fb0 fs/namei.c:3790
       do_filp_open+0x1df/0x400 fs/namei.c:3820
       do_sys_openat2+0x14b/0x500 fs/open.c:1255
       do_sys_open fs/open.c:1271 [inline]
       __do_sys_open fs/open.c:1279 [inline]
       __se_sys_open fs/open.c:1275 [inline]
       __x64_sys_open+0x11b/0x140 fs/open.c:1275
       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 (&dquot->dq_lock){+.+.}-{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
       dquot_commit+0x5a/0x410 fs/quota/dquot.c:532
       ext4_write_dquot+0x1f0/0x360 fs/ext4/super.c:6212
       mark_dquot_dirty fs/quota/dquot.c:397 [inline]
       mark_all_dquot_dirty+0xf9/0x400 fs/quota/dquot.c:437
       __dquot_free_space+0x7c3/0xb80 fs/quota/dquot.c:1964
       dquot_free_space_nodirty include/linux/quotaops.h:369 [inline]
       dquot_free_space include/linux/quotaops.h:374 [inline]
       dquot_free_block include/linux/quotaops.h:385 [inline]
       ext4_mb_clear_bb fs/ext4/mballoc.c:6164 [inline]
       ext4_free_blocks+0x1b1b/0x24c0 fs/ext4/mballoc.c:6294
       ext4_remove_blocks fs/ext4/extents.c:2540 [inline]
       ext4_ext_rm_leaf fs/ext4/extents.c:2706 [inline]
       ext4_ext_remove_space+0x2106/0x41a0 fs/ext4/extents.c:2954
       ext4_ext_truncate+0x182/0x230 fs/ext4/extents.c:4504
       ext4_truncate+0xa41/0x1190 fs/ext4/inode.c:4263
       ext4_truncate_failed_write fs/ext4/truncate.h:22 [inline]
       ext4_da_write_begin+0x73b/0xb20 fs/ext4/inode.c:3016
       generic_perform_write+0x2b6/0x550 mm/filemap.c:3785
       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:2179 [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 (&ei->i_data_sem){++++}-{3:3}:
       down_write+0x38/0x60 kernel/locking/rwsem.c:1551
       ext4_map_blocks+0x8c4/0x1a50 fs/ext4/inode.c:668
       mpage_map_one_extent fs/ext4/inode.c:2410 [inline]
       mpage_map_and_submit_extent fs/ext4/inode.c:2463 [inline]
       ext4_writepages+0x124a/0x2d40 fs/ext4/inode.c:2831
       do_writepages+0x493/0x700 mm/page-writeback.c:2386
       __writeback_single_inode+0x153/0xda0 fs/fs-writeback.c:1657
       writeback_sb_inodes+0xaaa/0x1750 fs/fs-writeback.c:1940
       __writeback_inodes_wb+0x12a/0x3f0 fs/fs-writeback.c:2011
       wb_writeback+0x45e/0xbc0 fs/fs-writeback.c:2116
       wb_check_old_data_flush fs/fs-writeback.c:2216 [inline]
       wb_do_writeback fs/fs-writeback.c:2269 [inline]
       wb_workfn+0xb15/0xf20 fs/fs-writeback.c:2298
       process_one_work+0x867/0xff0 kernel/workqueue.c:2310
       worker_thread+0xad7/0x12a0 kernel/workqueue.c:2457
       kthread+0x42e/0x520 kernel/kthread.c:334
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

-> #1 (jbd2_handle){++++}-{0:0}:
       jbd2_journal_lock_updates+0xa4/0x390 fs/jbd2/transaction.c:881
       __ocfs2_flush_truncate_log+0x2b4/0x1110 fs/ocfs2/alloc.c:6027
       ocfs2_flush_truncate_log+0x4b/0x60 fs/ocfs2/alloc.c:6074
       ocfs2_sync_fs+0x119/0x330 fs/ocfs2/super.c:403
       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]#7){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3120 [inline]
       check_prevs_add kernel/locking/lockdep.c:3239 [inline]
       validate_chain kernel/locking/lockdep.c:3855 [inline]
       __lock_acquire+0x38f7/0x7d40 kernel/locking/lockdep.c:5120
       lock_acquire+0x19f/0x400 kernel/locking/lockdep.c:5737
       down_write+0x38/0x60 kernel/locking/rwsem.c:1551
       inode_lock include/linux/fs.h:793 [inline]
       ocfs2_remove_btree_range+0x64f/0x15e0 fs/ocfs2/alloc.c:5742
       ocfs2_commit_truncate+0xb62/0x1d30 fs/ocfs2/alloc.c:7346
       ocfs2_truncate_file+0xd89/0x1540 fs/ocfs2/file.c:505
       ocfs2_setattr+0x1545/0x1b40 fs/ocfs2/file.c:1215
       notify_change+0xbc6/0xee0 fs/attr.c:505
       do_truncate+0x1ac/0x240 fs/open.c:65
       handle_truncate fs/namei.c:3316 [inline]
       do_open fs/namei.c:3663 [inline]
       path_openat+0x293b/0x2fb0 fs/namei.c:3793
       do_filp_open+0x1df/0x400 fs/namei.c:3820
       do_sys_openat2+0x14b/0x500 fs/open.c:1255
       do_sys_open fs/open.c:1271 [inline]
       __do_sys_openat fs/open.c:1287 [inline]
       __se_sys_openat fs/open.c:1282 [inline]
       __x64_sys_openat+0x135/0x160 fs/open.c:1282
       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]#7 --> &dquot->dq_lock --> &ocfs2_quota_ip_alloc_sem_key

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&ocfs2_quota_ip_alloc_sem_key);
                               lock(&dquot->dq_lock);
                               lock(&ocfs2_quota_ip_alloc_sem_key);
  lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#7);

 *** DEADLOCK ***

3 locks held by syz.2.865/11277:
 #0: ffff888091018460 (sb_writers#19){.+.+}-{0:0}, at: mnt_want_write+0x3d/0x90 fs/namespace.c:386
 #1: ffff88805092c2c8 (&sb->s_type->i_mutex_key#27){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:793 [inline]
 #1: ffff88805092c2c8 (&sb->s_type->i_mutex_key#27){+.+.}-{3:3}, at: do_truncate+0x198/0x240 fs/open.c:63
 #2: ffff88805092bf60 (&ocfs2_quota_ip_alloc_sem_key){++++}-{3:3}, at: ocfs2_truncate_file+0x335/0x1540 fs/ocfs2/file.c:467

stack backtrace:
CPU: 1 PID: 11277 Comm: syz.2.865 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/16/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:3120 [inline]
 check_prevs_add kernel/locking/lockdep.c:3239 [inline]
 validate_chain kernel/locking/lockdep.c:3855 [inline]
 __lock_acquire+0x38f7/0x7d40 kernel/locking/lockdep.c:5120
 lock_acquire+0x19f/0x400 kernel/locking/lockdep.c:5737
 down_write+0x38/0x60 kernel/locking/rwsem.c:1551
 inode_lock include/linux/fs.h:793 [inline]
 ocfs2_remove_btree_range+0x64f/0x15e0 fs/ocfs2/alloc.c:5742
 ocfs2_commit_truncate+0xb62/0x1d30 fs/ocfs2/alloc.c:7346
 ocfs2_truncate_file+0xd89/0x1540 fs/ocfs2/file.c:505
 ocfs2_setattr+0x1545/0x1b40 fs/ocfs2/file.c:1215
 notify_change+0xbc6/0xee0 fs/attr.c:505
 do_truncate+0x1ac/0x240 fs/open.c:65
 handle_truncate fs/namei.c:3316 [inline]
 do_open fs/namei.c:3663 [inline]
 path_openat+0x293b/0x2fb0 fs/namei.c:3793
 do_filp_open+0x1df/0x400 fs/namei.c:3820
 do_sys_openat2+0x14b/0x500 fs/open.c:1255
 do_sys_open fs/open.c:1271 [inline]
 __do_sys_openat fs/open.c:1287 [inline]
 __se_sys_openat fs/open.c:1282 [inline]
 __x64_sys_openat+0x135/0x160 fs/open.c:1282
 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:0x7f12f09461d9
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:00007f12eeb5c028 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f12f0bce180 RCX: 00007f12f09461d9
RDX: 00000000000c4242 RSI: 0000200000000300 RDI: ffffffffffffff9c
RBP: 00007f12f09dd888 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000000001ff R11: 0000000000000246 R12: 0000000000000000
R13: 00007f12f0bce218 R14: 00007f12f0bce180 R15: 00007ffd210591a8
 </TASK>

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
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.