syzbot


possible deadlock in ext4_map_blocks

Status: upstream: reported on 2022/10/04 14:40
Reported-by: syzbot+6de5025c31d33047d2a4@syzkaller.appspotmail.com
First crash: 55d, last: 20h34m
similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 possible deadlock in ext4_map_blocks 2 10h52m 47d 0/1 upstream: reported on 2022/10/12 20:37

Sample crash report:
ext4 filesystem being mounted at /root/syzkaller-testdir415279428/syzkaller.a617fl/126/file0 supports timestamps until 2038 (0x7fffffff)
======================================================
WARNING: possible circular locking dependency detected
6.1.0-rc7-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.3/7614 is trying to acquire lock:
ffff88807471c8c0 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_map_blocks+0x398/0x1cc0 fs/ext4/inode.c:568

but task is already holding lock:
ffff8880208a0208 (&s->s_dquot.dqio_sem){++++}-{3:3}, at: v2_write_dquot+0x9b/0x190 fs/quota/quota_v2.c:354

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&s->s_dquot.dqio_sem){++++}-{3:3}:
       lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668
       down_read+0x39/0x50 kernel/locking/rwsem.c:1509
       v2_read_dquot+0x4a/0x100 fs/quota/quota_v2.c:332
       dquot_acquire+0x186/0x670 fs/quota/dquot.c:435
       ext4_acquire_dquot+0x2e0/0x400 fs/ext4/super.c:6738
       dqget+0x999/0xdc0 fs/quota/dquot.c:914
       __dquot_initialize+0x291/0xcf0 fs/quota/dquot.c:1492
       ext4_create+0xb0/0x560 fs/ext4/namei.c:2802
       lookup_open fs/namei.c:3413 [inline]
       open_last_lookups fs/namei.c:3481 [inline]
       path_openat+0x12d0/0x2df0 fs/namei.c:3711
       do_filp_open+0x264/0x4f0 fs/namei.c:3741
       do_sys_openat2+0x124/0x4e0 fs/open.c:1310
       do_sys_open fs/open.c:1326 [inline]
       __do_sys_openat fs/open.c:1342 [inline]
       __se_sys_openat fs/open.c:1337 [inline]
       __x64_sys_openat+0x243/0x290 fs/open.c:1337
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #1 (&dquot->dq_lock){+.+.}-{3:3}:
       lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668
       __mutex_lock_common+0x1bd/0x26e0 kernel/locking/mutex.c:603
       __mutex_lock kernel/locking/mutex.c:747 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799
       dquot_commit+0x58/0x4e0 fs/quota/dquot.c:479
       ext4_write_dquot+0x1e4/0x2b0 fs/ext4/super.c:6722
       mark_dquot_dirty fs/quota/dquot.c:346 [inline]
       mark_all_dquot_dirty fs/quota/dquot.c:384 [inline]
       __dquot_alloc_space+0xa09/0x1030 fs/quota/dquot.c:1722
       dquot_alloc_space_nodirty include/linux/quotaops.h:300 [inline]
       dquot_alloc_space include/linux/quotaops.h:313 [inline]
       dquot_alloc_block include/linux/quotaops.h:337 [inline]
       ext4_mb_new_blocks+0x102f/0x3e40 fs/ext4/mballoc.c:5573
       ext4_ext_map_blocks+0x1868/0x6880 fs/ext4/extents.c:4287
       ext4_map_blocks+0xa49/0x1cc0 fs/ext4/inode.c:645
       ext4_getblk+0x1b9/0x770 fs/ext4/inode.c:858
       ext4_bread+0x2a/0x170 fs/ext4/inode.c:914
       ext4_append+0x290/0x530 fs/ext4/namei.c:83
       ext4_init_new_dir+0x359/0x670 fs/ext4/namei.c:2956
       ext4_mkdir+0x4fa/0xcf0 fs/ext4/namei.c:3002
       vfs_mkdir+0x3b3/0x590 fs/namei.c:4036
       ovl_do_mkdir fs/overlayfs/overlayfs.h:186 [inline]
       ovl_mkdir_real+0xcf/0x2c0 fs/overlayfs/dir.c:146
       ovl_workdir_create+0x437/0x9c0 fs/overlayfs/super.c:794
       ovl_make_workdir+0x107/0xe50 fs/overlayfs/super.c:1384
       ovl_get_workdir+0x2e4/0x410 fs/overlayfs/super.c:1534
       ovl_fill_super+0x19d7/0x2790 fs/overlayfs/super.c:2090
       mount_nodev+0x52/0xe0 fs/super.c:1447
       legacy_get_tree+0xea/0x180 fs/fs_context.c:610
       vfs_get_tree+0x88/0x270 fs/super.c:1531
       do_new_mount+0x289/0xad0 fs/namespace.c:3040
       do_mount fs/namespace.c:3383 [inline]
       __do_sys_mount fs/namespace.c:3591 [inline]
       __se_sys_mount+0x2d3/0x3c0 fs/namespace.c:3568
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #0 (&ei->i_data_sem/2){++++}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3097 [inline]
       check_prevs_add kernel/locking/lockdep.c:3216 [inline]
       validate_chain+0x1898/0x6ae0 kernel/locking/lockdep.c:3831
       __lock_acquire+0x1292/0x1f60 kernel/locking/lockdep.c:5055
       lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668
       down_read+0x39/0x50 kernel/locking/rwsem.c:1509
       ext4_map_blocks+0x398/0x1cc0 fs/ext4/inode.c:568
       ext4_getblk+0x1b9/0x770 fs/ext4/inode.c:858
       ext4_bread+0x2a/0x170 fs/ext4/inode.c:914
       ext4_quota_write+0x225/0x570 fs/ext4/super.c:7082
       write_blk fs/quota/quota_tree.c:64 [inline]
       get_free_dqblk+0x34a/0x6d0 fs/quota/quota_tree.c:130
       do_insert_tree+0x271/0x1b50 fs/quota/quota_tree.c:340
       do_insert_tree+0x744/0x1b50 fs/quota/quota_tree.c:375
       dq_insert_tree fs/quota/quota_tree.c:401 [inline]
       qtree_write_dquot+0x3b6/0x530 fs/quota/quota_tree.c:420
       v2_write_dquot+0x11b/0x190 fs/quota/quota_v2.c:358
       dquot_acquire+0x348/0x670 fs/quota/dquot.c:444
       ext4_acquire_dquot+0x2e0/0x400 fs/ext4/super.c:6738
       dqget+0x999/0xdc0 fs/quota/dquot.c:914
       __dquot_initialize+0x291/0xcf0 fs/quota/dquot.c:1492
       ext4_cross_rename fs/ext4/namei.c:4035 [inline]
       ext4_rename2+0xb25/0x4760 fs/ext4/namei.c:4173
       vfs_rename+0xd53/0x1130 fs/namei.c:4779
       do_renameat2+0xb53/0x1370 fs/namei.c:4930
       __do_sys_renameat2 fs/namei.c:4963 [inline]
       __se_sys_renameat2 fs/namei.c:4960 [inline]
       __x64_sys_renameat2+0xce/0xe0 fs/namei.c:4960
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

other info that might help us debug this:

Chain exists of:
  &ei->i_data_sem/2 --> &dquot->dq_lock --> &s->s_dquot.dqio_sem

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&s->s_dquot.dqio_sem);
                               lock(&dquot->dq_lock);
                               lock(&s->s_dquot.dqio_sem);
  lock(&ei->i_data_sem/2);

 *** DEADLOCK ***

8 locks held by syz-executor.3/7614:
 #0: ffff8880208a0460 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:393
 #1: ffff8880208a0748 (&type->s_vfs_rename_key){+.+.}-{3:3}, at: lock_rename+0x54/0x1a0 fs/namei.c:2994
 #2: ffff8880717da218 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: lock_rename+0x13a/0x1a0
 #3: ffff88805a0a4a38 (&type->i_mutex_dir_key#3/2){+.+.}-{3:3}, at: lock_rename+0x16e/0x1a0
 #4: ffff88805a0a3628 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: inode_lock include/linux/fs.h:756 [inline]
 #4: ffff88805a0a3628 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: lock_two_nondirectories+0xdd/0x130 fs/inode.c:1121
 #5: ffff88805a0a5440 (&sb->s_type->i_mutex_key#8/4){+.+.}-{3:3}, at: vfs_rename+0x80a/0x1130 fs/namei.c:4749
 #6: ffff8880426bcea8 (&dquot->dq_lock){+.+.}-{3:3}, at: dquot_acquire+0x64/0x670 fs/quota/dquot.c:432
 #7: ffff8880208a0208 (&s->s_dquot.dqio_sem){++++}-{3:3}, at: v2_write_dquot+0x9b/0x190 fs/quota/quota_v2.c:354

stack backtrace:
CPU: 0 PID: 7614 Comm: syz-executor.3 Not tainted 6.1.0-rc7-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1b1/0x28e lib/dump_stack.c:106
 check_noncircular+0x2cc/0x390 kernel/locking/lockdep.c:2177
 check_prev_add kernel/locking/lockdep.c:3097 [inline]
 check_prevs_add kernel/locking/lockdep.c:3216 [inline]
 validate_chain+0x1898/0x6ae0 kernel/locking/lockdep.c:3831
 __lock_acquire+0x1292/0x1f60 kernel/locking/lockdep.c:5055
 lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668
 down_read+0x39/0x50 kernel/locking/rwsem.c:1509
 ext4_map_blocks+0x398/0x1cc0 fs/ext4/inode.c:568
 ext4_getblk+0x1b9/0x770 fs/ext4/inode.c:858
 ext4_bread+0x2a/0x170 fs/ext4/inode.c:914
 ext4_quota_write+0x225/0x570 fs/ext4/super.c:7082
 write_blk fs/quota/quota_tree.c:64 [inline]
 get_free_dqblk+0x34a/0x6d0 fs/quota/quota_tree.c:130
 do_insert_tree+0x271/0x1b50 fs/quota/quota_tree.c:340
 do_insert_tree+0x744/0x1b50 fs/quota/quota_tree.c:375
 dq_insert_tree fs/quota/quota_tree.c:401 [inline]
 qtree_write_dquot+0x3b6/0x530 fs/quota/quota_tree.c:420
 v2_write_dquot+0x11b/0x190 fs/quota/quota_v2.c:358
 dquot_acquire+0x348/0x670 fs/quota/dquot.c:444
 ext4_acquire_dquot+0x2e0/0x400 fs/ext4/super.c:6738
 dqget+0x999/0xdc0 fs/quota/dquot.c:914
 __dquot_initialize+0x291/0xcf0 fs/quota/dquot.c:1492
 ext4_cross_rename fs/ext4/namei.c:4035 [inline]
 ext4_rename2+0xb25/0x4760 fs/ext4/namei.c:4173
 vfs_rename+0xd53/0x1130 fs/namei.c:4779
 do_renameat2+0xb53/0x1370 fs/namei.c:4930
 __do_sys_renameat2 fs/namei.c:4963 [inline]
 __se_sys_renameat2 fs/namei.c:4960 [inline]
 __x64_sys_renameat2+0xce/0xe0 fs/namei.c:4960
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f7be068c0d9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f7be13b7168 EFLAGS: 00000246 ORIG_RAX: 000000000000013c
RAX: ffffffffffffffda RBX: 00007f7be07abf80 RCX: 00007f7be068c0d9
RDX: 0000000000000004 RSI: 0000000020000000 RDI: 0000000000000005
RBP: 00007f7be06e7ae9 R08: 0000000000000002 R09: 0000000000000000
R10: 0000000020000080 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffd87dfbdaf R14: 00007f7be13b7300 R15: 0000000000022000
 </TASK>
EXT4-fs error (device loop3): ext4_mb_generate_buddy:1098: group 0, block bitmap and bg descriptor inconsistent: 86 vs 96 free clusters
Quota error (device loop3): write_blk: dquota write failed
Quota error (device loop3): qtree_write_dquot: Error -28 occurred while creating quota

Crashes (36):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-upstream-fs 2022/11/28 12:56 upstream b7b275e60bcd 247de55b .config log report info possible deadlock in ext4_map_blocks
ci2-upstream-fs 2022/11/27 04:36 upstream 644e9524388a f4470a7b .config log report info possible deadlock in ext4_map_blocks
ci2-upstream-fs 2022/11/21 18:13 upstream eb7081409f94 5bb70014 .config log report info possible deadlock in ext4_map_blocks
ci2-upstream-fs 2022/11/20 11:54 upstream fe24a97cf254 5bb70014 .config log report info possible deadlock in ext4_map_blocks
ci2-upstream-fs 2022/11/20 00:21 upstream fe24a97cf254 5bb70014 .config log report info possible deadlock in ext4_map_blocks
ci2-upstream-fs 2022/11/19 04:28 upstream ab290eaddc4c 5bb70014 .config log report info possible deadlock in ext4_map_blocks
ci2-upstream-fs 2022/11/19 04:23 upstream ab290eaddc4c 5bb70014 .config log report info possible deadlock in ext4_map_blocks
ci2-upstream-fs 2022/11/18 21:41 upstream ab290eaddc4c 5bb70014 .config log report info possible deadlock in ext4_map_blocks
ci2-upstream-fs 2022/11/17 08:06 upstream cc675d22e422 3a127a31 .config log report info possible deadlock in ext4_map_blocks
ci2-upstream-fs 2022/11/15 00:33 upstream e01d50cbd6ee 97de9cfc .config log report info possible deadlock in ext4_map_blocks
ci2-upstream-fs 2022/11/13 03:19 upstream fef7fd48922d f42ee5d8 .config log report info possible deadlock in ext4_map_blocks
ci2-upstream-fs 2022/11/12 19:02 upstream 8f2975c2bb4c f42ee5d8 .config log report info possible deadlock in ext4_map_blocks
ci2-upstream-fs 2022/11/08 06:45 upstream 59f2f4b8a757 6feb842b .config log report info possible deadlock in ext4_map_blocks
ci2-upstream-fs 2022/10/07 22:35 upstream 4c86114194e6 79a59635 .config log report info possible deadlock in ext4_map_blocks
ci2-upstream-fs 2022/10/07 01:23 upstream 833477fce7a1 80b58a42 .config log report info possible deadlock in ext4_map_blocks
ci2-upstream-fs 2022/10/06 10:21 upstream 2bca25eaeba6 2c6543ad .config log report info possible deadlock in ext4_map_blocks
ci2-upstream-fs 2022/10/06 03:06 upstream 2bca25eaeba6 2c6543ad .config log report info possible deadlock in ext4_map_blocks
ci-upstream-gce-arm64 2022/11/28 15:22 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6d464646530f 247de55b .config log report info possible deadlock in ext4_map_blocks
ci-upstream-gce-arm64 2022/11/28 13:32 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6d464646530f 247de55b .config log report info possible deadlock in ext4_map_blocks
ci-upstream-gce-arm64 2022/11/25 21:03 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6d464646530f 74a66371 .config log report info possible deadlock in ext4_map_blocks
ci-upstream-gce-arm64 2022/11/23 10:10 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 65762d97e6fa 75740b3f .config log report info possible deadlock in ext4_map_blocks
ci-upstream-gce-arm64 2022/11/20 17:53 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 9500fc6e9e60 5bb70014 .config log report info possible deadlock in ext4_map_blocks
ci-upstream-gce-arm64 2022/11/18 10:49 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 9500fc6e9e60 4ba8ab94 .config log report info possible deadlock in ext4_map_blocks
ci-upstream-gce-arm64 2022/11/17 16:04 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 9500fc6e9e60 3a127a31 .config log report info possible deadlock in ext4_map_blocks
ci-upstream-gce-arm64 2022/11/13 21:19 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 1621b6eaebf7 3ead01ad .config log report info possible deadlock in ext4_map_blocks
ci-upstream-gce-arm64 2022/11/07 15:01 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci f0c4d9fc9cc9 a779b11a .config log report info possible deadlock in ext4_map_blocks
ci-upstream-gce-arm64 2022/11/03 04:50 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 08977f5d .config log report info possible deadlock in ext4_map_blocks
ci-upstream-gce-arm64 2022/10/31 22:52 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 2a71366b .config log report info possible deadlock in ext4_map_blocks
ci-upstream-gce-arm64 2022/10/30 16:29 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 2a71366b .config log report info possible deadlock in ext4_map_blocks
ci-upstream-gce-arm64 2022/10/19 04:56 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 b31320fc .config log report info possible deadlock in ext4_map_blocks
ci-upstream-gce-arm64 2022/10/17 20:34 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 67cb024c .config log report info possible deadlock in ext4_map_blocks
ci-upstream-gce-arm64 2022/10/16 16:25 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 67cb024c .config log report info possible deadlock in ext4_map_blocks
ci-upstream-gce-arm64 2022/10/15 21:14 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 67cb024c .config log report info possible deadlock in ext4_map_blocks
ci-upstream-gce-arm64 2022/10/11 04:56 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 2b253ced .config log report info possible deadlock in ext4_map_blocks
ci-upstream-gce-arm64 2022/10/07 20:06 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 0de35f24 .config log report info possible deadlock in ext4_map_blocks
ci-upstream-gce-arm64 2022/10/04 14:17 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 eab8f949 .config log report info possible deadlock in ext4_map_blocks
* Struck through repros no longer work on HEAD.