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: 51d, last: 5d14h
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 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ocfs2_try_to_free_truncate_log ocfs2 1 175d 171d 0/28 auto-obsoleted due to no activity on 2025/03/22 03:11

Sample crash report:
loop0: detected capacity change from 0 to 32768
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.15.0-syzkaller-09113-g8477ab143069 #0 Not tainted
--------------------------------------------
syz.0.0/5317 is trying to acquire lock:
ffff888052853480 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#6){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:867 [inline]
ffff888052853480 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#6){+.+.}-{4:4}, at: ocfs2_try_to_free_truncate_log+0xaf/0x360 fs/ocfs2/alloc.c:6132

but task is already holding lock:
ffff888052853480 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#6){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:867 [inline]
ffff888052853480 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#6){+.+.}-{4:4}, at: ocfs2_defrag_extent fs/ocfs2/move_extents.c:247 [inline]
ffff888052853480 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#6){+.+.}-{4:4}, at: __ocfs2_move_extents_range+0x127d/0x3370 fs/ocfs2/move_extents.c:857

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

       CPU0
       ----
  lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#6);
  lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#6);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

5 locks held by syz.0.0/5317:
 #0: ffff8880116b4428 (sb_writers#12){.+.+}-{0:0}, at: mnt_want_write_file+0x60/0x200 fs/namespace.c:601
 #1: ffff888052855f40 (&sb->s_type->i_mutex_key#20){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:867 [inline]
 #1: ffff888052855f40 (&sb->s_type->i_mutex_key#20){+.+.}-{4:4}, at: ocfs2_move_extents+0x1a2/0x960 fs/ocfs2/move_extents.c:905
 #2: ffff888052855be0 (&oi->ip_alloc_sem){++++}-{4:4}, at: ocfs2_move_extents+0x36b/0x960 fs/ocfs2/move_extents.c:925
 #3: ffff88805284ed80 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#3){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:867 [inline]
 #3: ffff88805284ed80 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#3){+.+.}-{4:4}, at: ocfs2_reserve_suballoc_bits+0x15e/0x4640 fs/ocfs2/suballoc.c:788
 #4: ffff888052853480 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#6){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:867 [inline]
 #4: ffff888052853480 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#6){+.+.}-{4:4}, at: ocfs2_defrag_extent fs/ocfs2/move_extents.c:247 [inline]
 #4: ffff888052853480 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#6){+.+.}-{4:4}, at: __ocfs2_move_extents_range+0x127d/0x3370 fs/ocfs2/move_extents.c:857

stack backtrace:
CPU: 0 UID: 0 PID: 5317 Comm: syz.0.0 Not tainted 6.15.0-syzkaller-09113-g8477ab143069 #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:3044
 check_deadlock kernel/locking/lockdep.c:3096 [inline]
 validate_chain+0x1a3f/0x2140 kernel/locking/lockdep.c:3898
 __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5240
 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871
 down_write+0x96/0x1f0 kernel/locking/rwsem.c:1577
 inode_lock include/linux/fs.h:867 [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+0x1612/0x3370 fs/ocfs2/move_extents.c:857
 ocfs2_move_extents+0x378/0x960 fs/ocfs2/move_extents.c:927
 ocfs2_ioctl_move_extents+0x53e/0x710 fs/ocfs2/move_extents.c:1053
 ocfs2_ioctl+0x191/0x750 fs/ocfs2/ioctl.c:946
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:907 [inline]
 __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893
 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:0x7f71add8e969
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:00007f71aeb63038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f71adfb5fa0 RCX: 00007f71add8e969
RDX: 00002000000000c0 RSI: 0000000040406f06 RDI: 0000000000000006
RBP: 00007f71ade10ab1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f71adfb5fa0 R15: 00007fff7b2c5708
 </TASK>

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
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
* Struck through repros no longer work on HEAD.