syzbot


possible deadlock in ocfs2_try_to_free_truncate_log (2)

Status: upstream: reported on 2025/04/19 11:02
Subsystems: ocfs2
[Documentation on labels]
Reported-by: syzbot+c535cfdd86331295512d@syzkaller.appspotmail.com
First crash: 133d, last: 9d08h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [ocfs2?] possible deadlock in ocfs2_try_to_free_truncate_log (2) 0 (1) 2025/04/19 11:02
Similar bugs (1)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ocfs2_try_to_free_truncate_log ocfs2 4 1 257d 253d 0/29 auto-obsoleted due to no activity on 2025/03/22 03:11

Sample crash report:
loop0: detected capacity change from 0 to 32768
=======================================================
WARNING: The mand mount option has been deprecated and
         and is ignored by this kernel. Remove the mand
         option from the mount to silence this warning.
=======================================================
ocfs2: Mounting device (7,0) on (node local, slot 0) with ordered data mode.
============================================
WARNING: possible recursive locking detected
6.16.0-syzkaller-11952-g6e64f4580381 #0 Not tainted
--------------------------------------------
syz.0.0/5356 is trying to acquire lock:
ffff8880449c3480 (&ocfs2_sysfile_lock_key[TRUNCATE_LOG_SYSTEM_INODE]){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:869 [inline]
ffff8880449c3480 (&ocfs2_sysfile_lock_key[TRUNCATE_LOG_SYSTEM_INODE]){+.+.}-{4:4}, at: ocfs2_try_to_free_truncate_log+0xaf/0x360 fs/ocfs2/alloc.c:6132

but task is already holding lock:
ffff8880449c3480 (&ocfs2_sysfile_lock_key[TRUNCATE_LOG_SYSTEM_INODE]){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:869 [inline]
ffff8880449c3480 (&ocfs2_sysfile_lock_key[TRUNCATE_LOG_SYSTEM_INODE]){+.+.}-{4:4}, at: ocfs2_defrag_extent fs/ocfs2/move_extents.c:247 [inline]
ffff8880449c3480 (&ocfs2_sysfile_lock_key[TRUNCATE_LOG_SYSTEM_INODE]){+.+.}-{4:4}, at: __ocfs2_move_extents_range+0x1283/0x3380 fs/ocfs2/move_extents.c:856

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&ocfs2_sysfile_lock_key[TRUNCATE_LOG_SYSTEM_INODE]);
  lock(&ocfs2_sysfile_lock_key[TRUNCATE_LOG_SYSTEM_INODE]);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

5 locks held by syz.0.0/5356:
 #0: ffff8880433be428 (sb_writers#12){.+.+}-{0:0}, at: mnt_want_write_file+0x60/0x200 fs/namespace.c:601
 #1: ffff8880449c5100 (&sb->s_type->i_mutex_key#20){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:869 [inline]
 #1: ffff8880449c5100 (&sb->s_type->i_mutex_key#20){+.+.}-{4:4}, at: ocfs2_move_extents+0x1a2/0x960 fs/ocfs2/move_extents.c:904
 #2: ffff8880449c4da0 (&oi->ip_alloc_sem){++++}-{4:4}, at: ocfs2_move_extents+0x36b/0x960 fs/ocfs2/move_extents.c:924
 #3: ffff8880449bed80 (&ocfs2_sysfile_lock_key[EXTENT_ALLOC_SYSTEM_INODE]){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:869 [inline]
 #3: ffff8880449bed80 (&ocfs2_sysfile_lock_key[EXTENT_ALLOC_SYSTEM_INODE]){+.+.}-{4:4}, at: ocfs2_reserve_suballoc_bits+0x15e/0x4640 fs/ocfs2/suballoc.c:788
 #4: ffff8880449c3480 (&ocfs2_sysfile_lock_key[TRUNCATE_LOG_SYSTEM_INODE]){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:869 [inline]
 #4: ffff8880449c3480 (&ocfs2_sysfile_lock_key[TRUNCATE_LOG_SYSTEM_INODE]){+.+.}-{4:4}, at: ocfs2_defrag_extent fs/ocfs2/move_extents.c:247 [inline]
 #4: ffff8880449c3480 (&ocfs2_sysfile_lock_key[TRUNCATE_LOG_SYSTEM_INODE]){+.+.}-{4:4}, at: __ocfs2_move_extents_range+0x1283/0x3380 fs/ocfs2/move_extents.c:856

stack backtrace:
CPU: 0 UID: 0 PID: 5356 Comm: syz.0.0 Not tainted 6.16.0-syzkaller-11952-g6e64f4580381 #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 print_deadlock_bug+0x28b/0x2a0 kernel/locking/lockdep.c:3041
 check_deadlock kernel/locking/lockdep.c:3093 [inline]
 validate_chain+0x1a3f/0x2140 kernel/locking/lockdep.c:3895
 __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237
 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
 down_write+0x96/0x1f0 kernel/locking/rwsem.c:1590
 inode_lock include/linux/fs.h:869 [inline]
 ocfs2_try_to_free_truncate_log+0xaf/0x360 fs/ocfs2/alloc.c:6132
 ocfs2_reserve_clusters_with_limit+0x3c2/0xba0 fs/ocfs2/suballoc.c:1186
 ocfs2_defrag_extent fs/ocfs2/move_extents.c:266 [inline]
 __ocfs2_move_extents_range+0x1634/0x3380 fs/ocfs2/move_extents.c:856
 ocfs2_move_extents+0x378/0x960 fs/ocfs2/move_extents.c:926
 ocfs2_ioctl_move_extents+0x53e/0x710 fs/ocfs2/move_extents.c:1052
 ocfs2_ioctl+0x191/0x750 fs/ocfs2/ioctl.c:946
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:598 [inline]
 __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fd38858ebe9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fd38935c038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fd3887b5fa0 RCX: 00007fd38858ebe9
RDX: 00002000000000c0 RSI: 0000000040406f06 RDI: 0000000000000008
RBP: 00007fd388611e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fd3887b6038 R14: 00007fd3887b5fa0 R15: 00007ffcf75b0fd8
 </TASK>

Crashes (9):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/08/08 01:40 upstream 6e64f4580381 6a893178 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in ocfs2_try_to_free_truncate_log
2025/07/02 22:35 upstream b4911fb0b060 0cd59a8f .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in ocfs2_try_to_free_truncate_log
2025/06/27 04:55 upstream f02769e7f272 803ce19b .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in ocfs2_try_to_free_truncate_log
2025/06/18 03:12 upstream 4663747812d1 e77fae15 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in ocfs2_try_to_free_truncate_log
2025/05/31 08:51 upstream 8477ab143069 3d2f584d .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in ocfs2_try_to_free_truncate_log
2025/05/26 23:01 upstream 0ff41df1cb26 06877188 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in ocfs2_try_to_free_truncate_log
2025/05/26 03:13 upstream d0c22de9995b 2d4582d0 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in ocfs2_try_to_free_truncate_log
2025/04/15 10:51 upstream 834a4a689699 85125322 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in ocfs2_try_to_free_truncate_log
2025/08/17 07:38 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 8f5ae30d69d7 1804e95e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in ocfs2_try_to_free_truncate_log
* Struck through repros no longer work on HEAD.