syzbot


possible deadlock in __jbd2_log_wait_for_space

Status: upstream: reported on 2022/08/08 07:33
Reported-by: syzbot+fa1bbda326271b8808c9@syzkaller.appspotmail.com
First crash: 53d, last: now

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.0.0-rc7-syzkaller-00132-g987a926c1d8a #0 Not tainted
------------------------------------------------------
syz-executor.0/8147 is trying to acquire lock:
ffff88802825c3f8 (&journal->j_checkpoint_mutex){+.+.}-{3:3}, at: __jbd2_log_wait_for_space+0x22d/0x790 fs/jbd2/checkpoint.c:110

but task is already holding lock:
ffff888039b62218 (&sb->s_type->i_mutex_key#7){++++}-{3:3}, at: inode_lock include/linux/fs.h:756 [inline]
ffff888039b62218 (&sb->s_type->i_mutex_key#7){++++}-{3:3}, at: vfs_unlink+0xe0/0x5f0 fs/namei.c:4218

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&sb->s_type->i_mutex_key#7){++++}-{3:3}:
       lock_acquire+0x1a7/0x400 kernel/locking/lockdep.c:5666
       down_read+0x39/0x50 kernel/locking/rwsem.c:1499
       inode_lock_shared include/linux/fs.h:766 [inline]
       ext4_bmap+0x55/0x410 fs/ext4/inode.c:3157
       bmap+0xa1/0xd0 fs/inode.c:1799
       jbd2_journal_bmap fs/jbd2/journal.c:971 [inline]
       __jbd2_journal_erase fs/jbd2/journal.c:1784 [inline]
       jbd2_journal_flush+0x5d0/0xca0 fs/jbd2/journal.c:2490
       ext4_ioctl_checkpoint fs/ext4/ioctl.c:1082 [inline]
       __ext4_ioctl fs/ext4/ioctl.c:1586 [inline]
       ext4_ioctl+0x378a/0x55c0 fs/ext4/ioctl.c:1606
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:870 [inline]
       __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:856
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #0 (&journal->j_checkpoint_mutex){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3095 [inline]
       check_prevs_add kernel/locking/lockdep.c:3214 [inline]
       validate_chain+0x1872/0x6600 kernel/locking/lockdep.c:3829
       __lock_acquire+0x1292/0x1f60 kernel/locking/lockdep.c:5053
       lock_acquire+0x1a7/0x400 kernel/locking/lockdep.c:5666
       __mutex_lock_common+0x1de/0x26c0 kernel/locking/mutex.c:603
       mutex_lock_io_nested+0x43/0x60 kernel/locking/mutex.c:833
       __jbd2_log_wait_for_space+0x22d/0x790 fs/jbd2/checkpoint.c:110
       add_transaction_credits+0x936/0xbf0 fs/jbd2/transaction.c:298
       start_this_handle+0x758/0x1660 fs/jbd2/transaction.c:422
       jbd2__journal_start+0x2ca/0x5b0 fs/jbd2/transaction.c:520
       __ext4_journal_start_sb+0x111/0x1d0 fs/ext4/ext4_jbd2.c:105
       __ext4_journal_start fs/ext4/ext4_jbd2.h:326 [inline]
       ext4_unlink+0x2a1/0x440 fs/ext4/namei.c:3271
       vfs_unlink+0x357/0x5f0 fs/namei.c:4229
       do_unlinkat+0x4c4/0x9a0 fs/namei.c:4297
       __do_sys_unlink fs/namei.c:4345 [inline]
       __se_sys_unlink fs/namei.c:4343 [inline]
       __x64_sys_unlink+0x45/0x50 fs/namei.c:4343
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&sb->s_type->i_mutex_key#7);
                               lock(&journal->j_checkpoint_mutex);
                               lock(&sb->s_type->i_mutex_key#7);
  lock(&journal->j_checkpoint_mutex);

 *** DEADLOCK ***

3 locks held by syz-executor.0/8147:
 #0: ffff888028258460 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:393
 #1: ffff888039a3ac20 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:791 [inline]
 #1: ffff888039a3ac20 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: do_unlinkat+0x27d/0x9a0 fs/namei.c:4280
 #2: ffff888039b62218 (&sb->s_type->i_mutex_key#7){++++}-{3:3}, at: inode_lock include/linux/fs.h:756 [inline]
 #2: ffff888039b62218 (&sb->s_type->i_mutex_key#7){++++}-{3:3}, at: vfs_unlink+0xe0/0x5f0 fs/namei.c:4218

stack backtrace:
CPU: 0 PID: 8147 Comm: syz-executor.0 Not tainted 6.0.0-rc7-syzkaller-00132-g987a926c1d8a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2f9/0x3b0 kernel/locking/lockdep.c:2175
 check_prev_add kernel/locking/lockdep.c:3095 [inline]
 check_prevs_add kernel/locking/lockdep.c:3214 [inline]
 validate_chain+0x1872/0x6600 kernel/locking/lockdep.c:3829
 __lock_acquire+0x1292/0x1f60 kernel/locking/lockdep.c:5053
 lock_acquire+0x1a7/0x400 kernel/locking/lockdep.c:5666
 __mutex_lock_common+0x1de/0x26c0 kernel/locking/mutex.c:603
 mutex_lock_io_nested+0x43/0x60 kernel/locking/mutex.c:833
 __jbd2_log_wait_for_space+0x22d/0x790 fs/jbd2/checkpoint.c:110
 add_transaction_credits+0x936/0xbf0 fs/jbd2/transaction.c:298
 start_this_handle+0x758/0x1660 fs/jbd2/transaction.c:422
 jbd2__journal_start+0x2ca/0x5b0 fs/jbd2/transaction.c:520
 __ext4_journal_start_sb+0x111/0x1d0 fs/ext4/ext4_jbd2.c:105
 __ext4_journal_start fs/ext4/ext4_jbd2.h:326 [inline]
 ext4_unlink+0x2a1/0x440 fs/ext4/namei.c:3271
 vfs_unlink+0x357/0x5f0 fs/namei.c:4229
 do_unlinkat+0x4c4/0x9a0 fs/namei.c:4297
 __do_sys_unlink fs/namei.c:4345 [inline]
 __se_sys_unlink fs/namei.c:4343 [inline]
 __x64_sys_unlink+0x45/0x50 fs/namei.c:4343
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fa2cbc89ee7
Code: 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 57 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe70e829f8 EFLAGS: 00000206 ORIG_RAX: 0000000000000057
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fa2cbc89ee7
RDX: 00007ffe70e82a30 RSI: 00007ffe70e82a30 RDI: 00007ffe70e82ac0
RBP: 00007ffe70e82ac0 R08: 0000000000000001 R09: 00007ffe70e82890
R10: 00005555555f1893 R11: 0000000000000206 R12: 00007fa2cbce45f6
R13: 00007ffe70e83b80 R14: 00005555555f1810 R15: 00007ffe70e83bc0
 </TASK>

Crashes (12488):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-smack-root 2022/09/30 10:42 upstream 987a926c1d8a 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci2-upstream-fs 2022/09/30 09:39 upstream 987a926c1d8a 45fd7169 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-kasan-gce-selinux-root 2022/09/30 09:21 upstream 987a926c1d8a 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-kasan-gce-selinux-root 2022/09/30 07:06 upstream 987a926c1d8a 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-kasan-gce-selinux-root 2022/09/30 06:25 upstream 987a926c1d8a 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci2-upstream-fs 2022/09/30 05:10 upstream c3e0e1e23c70 45fd7169 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci2-upstream-fs 2022/09/30 04:33 upstream c3e0e1e23c70 45fd7169 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-kasan-gce-selinux-root 2022/09/30 03:19 upstream 511cce163b75 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci2-upstream-fs 2022/09/30 02:14 upstream c3e0e1e23c70 45fd7169 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-kasan-gce-root 2022/09/30 00:37 upstream 987a926c1d8a 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-kasan-gce-root 2022/09/29 23:49 upstream 987a926c1d8a 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci2-upstream-fs 2022/09/29 22:46 upstream c3e0e1e23c70 45fd7169 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-kasan-gce-smack-root 2022/09/29 21:43 upstream 511cce163b75 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci2-upstream-fs 2022/09/29 21:27 upstream c3e0e1e23c70 45fd7169 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-kasan-gce-selinux-root 2022/09/29 20:03 upstream 511cce163b75 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-kasan-gce-selinux-root 2022/09/29 17:13 upstream 511cce163b75 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci2-upstream-fs 2022/09/29 15:34 upstream c3e0e1e23c70 45fd7169 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-kasan-gce-smack-root 2022/09/29 14:33 upstream c3e0e1e23c70 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci2-upstream-fs 2022/09/29 09:20 upstream 49c13ed0316d a41a2080 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci2-upstream-fs 2022/09/29 09:15 upstream 49c13ed0316d a41a2080 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci2-upstream-fs 2022/09/29 08:13 upstream 49c13ed0316d a41a2080 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-kasan-gce-root 2022/09/29 07:12 upstream c3e0e1e23c70 e2556bc3 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-kasan-gce-selinux-root 2022/09/29 06:43 upstream c3e0e1e23c70 e2556bc3 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-kasan-gce-selinux-root 2022/09/29 04:44 upstream c3e0e1e23c70 e2556bc3 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci2-upstream-fs 2022/09/29 03:07 upstream 49c13ed0316d a41a2080 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-kasan-gce-smack-root 2022/09/29 02:16 upstream c3e0e1e23c70 e2556bc3 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-kasan-gce-selinux-root 2022/09/28 23:11 upstream 49c13ed0316d e2556bc3 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci2-upstream-fs 2022/09/28 22:05 upstream 49c13ed0316d a41a2080 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci2-upstream-fs 2022/09/28 20:11 upstream 49c13ed0316d a41a2080 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-qemu-upstream 2022/09/28 15:04 upstream 49c13ed0316d e2556bc3 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-qemu-upstream-386 2022/09/29 18:14 upstream 511cce163b75 d9da3ac6 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-qemu-upstream-386 2022/09/29 12:36 upstream c3e0e1e23c70 d9da3ac6 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-qemu-upstream-386 2022/09/29 00:43 upstream c3e0e1e23c70 a41a2080 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-qemu-upstream-386 2022/09/29 00:17 upstream c3e0e1e23c70 a41a2080 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-net-this-kasan-gce 2022/09/29 13:17 net 3b04cba7add0 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-net-this-kasan-gce 2022/09/29 11:07 net 3b04cba7add0 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-net-this-kasan-gce 2022/09/29 10:21 net 3b04cba7add0 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-net-this-kasan-gce 2022/09/29 04:07 net af2faee54d59 e2556bc3 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-net-this-kasan-gce 2022/09/29 03:44 net af2faee54d59 e2556bc3 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-net-this-kasan-gce 2022/09/29 01:43 net af2faee54d59 e2556bc3 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-bpf-kasan-gce 2022/09/18 07:53 bpf 83c10cc362d9 dd9a85ff .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-net-kasan-gce 2022/09/30 08:16 net-next 510bbf82f8dc 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-net-kasan-gce 2022/09/30 03:16 net-next 510bbf82f8dc 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-net-kasan-gce 2022/09/30 01:48 net-next 510bbf82f8dc 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-net-kasan-gce 2022/09/29 20:26 net-next d49e265b66d9 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-net-kasan-gce 2022/09/29 16:55 net-next d49e265b66d9 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-net-kasan-gce 2022/09/29 11:45 net-next d49e265b66d9 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-net-kasan-gce 2022/09/29 10:25 net-next d49e265b66d9 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-net-kasan-gce 2022/09/29 05:41 net-next 929a6cdfaeac e2556bc3 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-net-kasan-gce 2022/09/28 21:14 net-next b9a5cbf8ba24 e2556bc3 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-bpf-next-kasan-gce 2022/09/23 00:18 bpf-next 020e2176b23e 0042f2b4 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-linux-next-kasan-gce-root 2022/08/21 15:29 linux-next 8755ae45a9e8 26a13b38 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-linux-next-kasan-gce-root 2022/08/08 06:20 linux-next ca688bff68bc 88e3a122 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-linux-next-kasan-gce-root 2022/08/08 04:29 linux-next ca688bff68bc 88e3a122 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-gce-arm64 2022/09/29 23:54 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 5911b92626df 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
ci-upstream-gce-arm64 2022/09/29 19:00 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 5911b92626df 1d385642 .config log report info possible deadlock in __jbd2_log_wait_for_space
* Struck through repros no longer work on HEAD.