syzbot


possible deadlock in ocfs2_write_begin_nolock

Status: upstream: reported on 2024/10/11 23:44
Reported-by: syzbot+13376da5d4f789911f90@syzkaller.appspotmail.com
First crash: 174d, last: 6d20h
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ocfs2_write_begin_nolock ocfs2 C 572 2d14h 204d 0/28 upstream: reported C repro on 2024/09/12 09:35
linux-5.15 possible deadlock in ocfs2_write_begin_nolock 49 1d01h 159d 0/3 upstream: reported on 2024/10/27 04:30

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.1.132-syzkaller #0 Not tainted
------------------------------------------------------
syz.6.2008/10542 is trying to acquire lock:
ffff888061a2e650 (sb_internal#5){.+.+}-{0:0}, at: ocfs2_write_begin_inline fs/ocfs2/aops.c:1481 [inline]
ffff888061a2e650 (sb_internal#5){.+.+}-{0:0}, at: ocfs2_try_to_write_inline_data fs/ocfs2/aops.c:1584 [inline]
ffff888061a2e650 (sb_internal#5){.+.+}-{0:0}, at: ocfs2_write_begin_nolock+0x2073/0x4e40 fs/ocfs2/aops.c:1670

but task is already holding lock:
ffff888071f0dbe0 (&oi->ip_alloc_sem){++++}-{3:3}, at: ocfs2_write_begin+0x1cd/0x390 fs/ocfs2/aops.c:1902

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3
 (&oi->ip_alloc_sem){++++}-{3:3}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       down_read+0xad/0xa30 kernel/locking/rwsem.c:1520
       ocfs2_read_virt_blocks+0x2dc/0xab0 fs/ocfs2/extent_map.c:976
       ocfs2_read_dir_block+0x102/0x5b0 fs/ocfs2/dir.c:508
       ocfs2_dir_foreach_blk_el fs/ocfs2/dir.c:1842 [inline]
       ocfs2_dir_foreach_blk+0x2a1/0x1e10 fs/ocfs2/dir.c:1928
       ocfs2_dir_foreach+0x20c/0x270 fs/ocfs2/dir.c:1938
       ocfs2_empty_dir+0x446/0x7b0 fs/ocfs2/dir.c:2156
       ocfs2_rename+0x26c2/0x4000 fs/ocfs2/namei.c:1499
       vfs_rename+0xd32/0x10f0 fs/namei.c:4874
       do_renameat2+0xde0/0x1440 fs/namei.c:5027
       __do_sys_rename fs/namei.c:5073 [inline]
       __se_sys_rename fs/namei.c:5071 [inline]
       __x64_sys_rename+0x82/0x90 fs/namei.c:5071
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #2 (jbd2_handle){++++}-{0:0}
:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       start_this_handle+0x1f71/0x21b0 fs/jbd2/transaction.c:463
       jbd2__journal_start+0x2d1/0x5c0 fs/jbd2/transaction.c:520
       jbd2_journal_start+0x25/0x30 fs/jbd2/transaction.c:559
       ocfs2_start_trans+0x3c0/0x6f0 fs/ocfs2/journal.c:354
       ocfs2_mknod+0x1638/0x2e20 fs/ocfs2/namei.c:361
       vfs_mknod+0x444/0x4d0 fs/namei.c:3985
       do_mknodat+0x3f8/0x5a0 fs/namei.c:-1
       __do_sys_mknodat fs/namei.c:4063 [inline]
       __se_sys_mknodat fs/namei.c:4060 [inline]
       __x64_sys_mknodat+0xa5/0xc0 fs/namei.c:4060
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #1 (&journal->j_trans_barrier){.+.+}-{3:3}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       down_read+0xad/0xa30 kernel/locking/rwsem.c:1520
       ocfs2_start_trans+0x3b5/0x6f0 fs/ocfs2/journal.c:352
       ocfs2_mknod+0x1638/0x2e20 fs/ocfs2/namei.c:361
       vfs_mknod+0x444/0x4d0 fs/namei.c:3985
       do_mknodat+0x3f8/0x5a0 fs/namei.c:-1
       __do_sys_mknodat fs/namei.c:4063 [inline]
       __se_sys_mknodat fs/namei.c:4060 [inline]
       __x64_sys_mknodat+0xa5/0xc0 fs/namei.c:4060
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (sb_internal#5){.+.+}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3090 [inline]
       check_prevs_add kernel/locking/lockdep.c:3209 [inline]
       validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
       __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1891 [inline]
       sb_start_intwrite include/linux/fs.h:2013 [inline]
       ocfs2_start_trans+0x2b0/0x6f0 fs/ocfs2/journal.c:350
       ocfs2_write_begin_inline fs/ocfs2/aops.c:1481 [inline]
       ocfs2_try_to_write_inline_data fs/ocfs2/aops.c:1584 [inline]
       ocfs2_write_begin_nolock+0x2073/0x4e40 fs/ocfs2/aops.c:1670
       ocfs2_write_begin+0x201/0x390 fs/ocfs2/aops.c:1904
       generic_perform_write+0x2fc/0x5e0 mm/filemap.c:3845
       __generic_file_write_iter+0x176/0x400 mm/filemap.c:3973
       ocfs2_file_write_iter+0x19d7/0x2280 fs/ocfs2/file.c:2469
       call_write_iter include/linux/fs.h:2265 [inline]
       new_sync_write fs/read_write.c:491 [inline]
       vfs_write+0x857/0xbc0 fs/read_write.c:584
       ksys_write+0x19c/0x2c0 fs/read_write.c:637
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

Chain exists of:
  sb_internal#5 --> jbd2_handle --> &oi->ip_alloc_sem

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&oi->ip_alloc_sem);
                               lock(jbd2_handle);
                               lock(&oi->ip_alloc_sem);
  lock(sb_internal#5);

 *** DEADLOCK ***

4 locks held by syz.6.2008/10542:
 #0: ffff88807d2d25e8 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x2ba/0x360 fs/file.c:1032
 #1: ffff888061a2e460 (sb_writers#26){.+.+}-{0:0}, at: vfs_write+0x269/0xbc0 fs/read_write.c:580
 #2: ffff888071f0df48 (&sb->s_type->i_mutex_key#41){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
 #2: ffff888071f0df48 (&sb->s_type->i_mutex_key#41){+.+.}-{3:3}, at: ocfs2_file_write_iter+0x454/0x2280 fs/ocfs2/file.c:2399
 #3: ffff888071f0dbe0 (&oi->ip_alloc_sem){++++}-{3:3}, at: ocfs2_write_begin+0x1cd/0x390 fs/ocfs2/aops.c:1902

stack backtrace:
CPU: 1 PID: 10542 Comm: syz.6.2008 Not tainted 6.1.132-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2170
 check_prev_add kernel/locking/lockdep.c:3090 [inline]
 check_prevs_add kernel/locking/lockdep.c:3209 [inline]
 validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
 percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
 __sb_start_write include/linux/fs.h:1891 [inline]
 sb_start_intwrite include/linux/fs.h:2013 [inline]
 ocfs2_start_trans+0x2b0/0x6f0 fs/ocfs2/journal.c:350
 ocfs2_write_begin_inline fs/ocfs2/aops.c:1481 [inline]
 ocfs2_try_to_write_inline_data fs/ocfs2/aops.c:1584 [inline]
 ocfs2_write_begin_nolock+0x2073/0x4e40 fs/ocfs2/aops.c:1670
 ocfs2_write_begin+0x201/0x390 fs/ocfs2/aops.c:1904
 generic_perform_write+0x2fc/0x5e0 mm/filemap.c:3845
 __generic_file_write_iter+0x176/0x400 mm/filemap.c:3973
 ocfs2_file_write_iter+0x19d7/0x2280 fs/ocfs2/file.c:2469
 call_write_iter include/linux/fs.h:2265 [inline]
 new_sync_write fs/read_write.c:491 [inline]
 vfs_write+0x857/0xbc0 fs/read_write.c:584
 ksys_write+0x19c/0x2c0 fs/read_write.c:637
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f2220f8d169
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:00007f2221d05038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f22211a5fa0 RCX: 00007f2220f8d169
RDX: 0000000000000028 RSI: 00002000000000c0 RDI: 0000000000000004
RBP: 00007f222100e2a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f22211a5fa0 R15: 00007ffebc446fd8
 </TASK>
ocfs2: Unmounting device (7,6) on (node local)

Crashes (104):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/03/29 00:39 linux-6.1.y 8e60a714ba3b 9a1a9e31 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/26 19:25 linux-6.1.y 344a09659766 20510e88 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/24 02:09 linux-6.1.y 344a09659766 875573af .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/24 00:44 linux-6.1.y 344a09659766 875573af .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/21 22:04 linux-6.1.y 344a09659766 c6512ef7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/21 01:17 linux-6.1.y 344a09659766 62330552 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/19 06:08 linux-6.1.y 344a09659766 8d0a2921 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/19 04:30 linux-6.1.y 344a09659766 8d0a2921 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/18 16:35 linux-6.1.y 344a09659766 22a6c2b1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/17 23:46 linux-6.1.y 344a09659766 ce3352cd .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/17 08:41 linux-6.1.y 344a09659766 948c34e4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/14 03:01 linux-6.1.y 344a09659766 e2826670 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/13 15:18 linux-6.1.y 344a09659766 44be8b44 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/13 09:41 linux-6.1.y 6ae7ac5c4251 44be8b44 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/13 03:07 linux-6.1.y 6ae7ac5c4251 1a5d9317 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/09 03:36 linux-6.1.y 6ae7ac5c4251 163f510d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/07 16:16 linux-6.1.y 3a8358583626 7e3bd60d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/06 06:51 linux-6.1.y 3a8358583626 831e3629 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/05 23:53 linux-6.1.y 3a8358583626 831e3629 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/03 07:12 linux-6.1.y 3a8358583626 c3901742 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/02/26 23:25 linux-6.1.y 3a8358583626 6a8fcbc4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/02/19 16:25 linux-6.1.y 0cbb5f65e52f b257a9b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/02/11 17:39 linux-6.1.y 0cbb5f65e52f f2baddf5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/02/10 16:39 linux-6.1.y 0cbb5f65e52f 43f51a00 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/02/06 10:14 linux-6.1.y 0cbb5f65e52f 577d049b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/02/06 04:39 linux-6.1.y 0cbb5f65e52f 577d049b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/02/04 02:28 linux-6.1.y 0cbb5f65e52f 8f267cef .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/02/04 02:23 linux-6.1.y 0cbb5f65e52f 8f267cef .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/02/04 02:23 linux-6.1.y 0cbb5f65e52f 8f267cef .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/02/03 14:04 linux-6.1.y 0cbb5f65e52f a21a8419 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/01/30 17:27 linux-6.1.y 75cefdf153f5 4c6ac32f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_write_begin_nolock
2025/03/16 12:57 linux-6.1.y 344a09659766 e2826670 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_write_begin_nolock
2025/03/13 16:45 linux-6.1.y 344a09659766 44be8b44 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_write_begin_nolock
2025/03/13 12:09 linux-6.1.y 6ae7ac5c4251 44be8b44 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_write_begin_nolock
2025/03/12 22:51 linux-6.1.y 6ae7ac5c4251 1a5d9317 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_write_begin_nolock
2025/03/11 15:49 linux-6.1.y 6ae7ac5c4251 16256247 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_write_begin_nolock
2025/03/10 19:30 linux-6.1.y 6ae7ac5c4251 16256247 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_write_begin_nolock
2025/03/10 18:22 linux-6.1.y 6ae7ac5c4251 16256247 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_write_begin_nolock
2025/03/08 11:57 linux-6.1.y 6ae7ac5c4251 7e3bd60d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_write_begin_nolock
2025/03/07 16:04 linux-6.1.y 3a8358583626 7e3bd60d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_write_begin_nolock
2025/03/06 20:27 linux-6.1.y 3a8358583626 831e3629 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_write_begin_nolock
2025/02/28 06:55 linux-6.1.y 3a8358583626 6a8fcbc4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_write_begin_nolock
2025/02/27 00:56 linux-6.1.y 3a8358583626 6a8fcbc4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_write_begin_nolock
2025/02/22 02:37 linux-6.1.y 3a8358583626 d34966d1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_write_begin_nolock
2025/02/10 18:50 linux-6.1.y 0cbb5f65e52f 43f51a00 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_write_begin_nolock
2024/10/11 23:44 linux-6.1.y aa4cd140bba5 084d8178 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_write_begin_nolock
* Struck through repros no longer work on HEAD.