syzbot


possible deadlock in dquot_commit

Status: fixed on 2022/03/08 16:11
Reported-by: syzbot+3b6f9218b1301ddda3e2@syzkaller.appspotmail.com
Fix commit: 4013d47a5307 ext4: make sure to reset inode lockdep class when quota enabling fails
First crash: 658d, last: 353d

Cause bisection: introduced by (bisect log) [merge commit]:
commit fe38bd6862074c0a2b9be7f31f043aaa70b2af5f
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Wed Sep 18 16:49:13 2019 +0000

  Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm

Crash: WARNING: ODEBUG bug in netdev_freemem (log)
Repro: C syz .config
similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in dquot_commit (2) C inconclusive 645 3d01h 48d 0/24 upstream: reported C repro on 2022/10/08 19:13
linux-4.14 possible deadlock in dquot_commit C error 8 37d 564d 0/1 upstream: reported C repro on 2021/05/11 01:53
linux-4.19 possible deadlock in dquot_commit C error 61 6h42m 788d 0/1 upstream: reported C repro on 2020/09/29 12:02
Patch testing requests:
Created Duration User Patch Repo Result
2021/10/07 09:50 19m jack@suse.cz patch git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 60a9483534ed0d99090a2ee1d4bb0b8179195f51 OK
2021/08/09 14:52 39m jack@suse.cz patch git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 902e7f373fff2476b53824264c12e4e76c7ec02a report log

Sample crash report:
loop0: detected capacity change from 0 to 4096
EXT4-fs (loop0): mounted filesystem without journal. Opts: ,errors=continue. Quota mode: writeback.
======================================================
WARNING: possible circular locking dependency detected
5.14.0-rc4-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor211/9242 is trying to acquire lock:
ffff88803a37ece8 (&dquot->dq_lock){+.+.}-{3:3}, at: dquot_commit+0x57/0x360 fs/quota/dquot.c:474

but task is already holding lock:
ffff88803a303e48 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_map_blocks+0x9e5/0x1cb0 fs/ext4/inode.c:631

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&ei->i_data_sem/2){++++}-{3:3}:
       lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625
       down_read+0x3b/0x50 kernel/locking/rwsem.c:1353
       ext4_map_blocks+0x266/0x1cb0 fs/ext4/inode.c:561
       ext4_getblk+0x187/0x6c0 fs/ext4/inode.c:848
       ext4_bread+0x2a/0x170 fs/ext4/inode.c:900
       ext4_quota_write+0x2c7/0x5b0 fs/ext4/super.c:6602
       write_blk fs/quota/quota_tree.c:64 [inline]
       get_free_dqblk+0x33a/0x660 fs/quota/quota_tree.c:93
       do_insert_tree+0x24c/0x1d30 fs/quota/quota_tree.c:300
       do_insert_tree+0x659/0x1d30 fs/quota/quota_tree.c:331
       do_insert_tree+0x659/0x1d30 fs/quota/quota_tree.c:331
       do_insert_tree+0x659/0x1d30 fs/quota/quota_tree.c:331
       dq_insert_tree fs/quota/quota_tree.c:357 [inline]
       qtree_write_dquot+0x3b6/0x530 fs/quota/quota_tree.c:376
       v2_write_dquot+0x110/0x1a0 fs/quota/quota_v2.c:358
       dquot_acquire+0x2d7/0x5b0 fs/quota/dquot.c:441
       ext4_acquire_dquot+0x2e0/0x400 fs/ext4/super.c:6261
       dqget+0x999/0xdc0 fs/quota/dquot.c:899
       __dquot_initialize+0x291/0xd40 fs/quota/dquot.c:1477
       ext4_create+0xb0/0x550 fs/ext4/namei.c:2731
       lookup_open fs/namei.c:3228 [inline]
       open_last_lookups fs/namei.c:3298 [inline]
       path_openat+0x13b7/0x36b0 fs/namei.c:3504
       do_filp_open+0x253/0x4d0 fs/namei.c:3534
       do_sys_openat2+0x124/0x460 fs/open.c:1204
       do_sys_open fs/open.c:1220 [inline]
       __do_sys_creat fs/open.c:1294 [inline]
       __se_sys_creat fs/open.c:1288 [inline]
       __x64_sys_creat+0x11f/0x160 fs/open.c:1288
       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+0x44/0xae

-> #1 (&s->s_dquot.dqio_sem){++++}-{3:3}:
       lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625
       down_read+0x3b/0x50 kernel/locking/rwsem.c:1353
       v2_read_dquot+0x4a/0x100 fs/quota/quota_v2.c:332
       dquot_acquire+0x144/0x5b0 fs/quota/dquot.c:432
       ext4_acquire_dquot+0x2e0/0x400 fs/ext4/super.c:6261
       dqget+0x999/0xdc0 fs/quota/dquot.c:899
       __dquot_initialize+0x291/0xd40 fs/quota/dquot.c:1477
       ext4_create+0xb0/0x550 fs/ext4/namei.c:2731
       lookup_open fs/namei.c:3228 [inline]
       open_last_lookups fs/namei.c:3298 [inline]
       path_openat+0x13b7/0x36b0 fs/namei.c:3504
       do_filp_open+0x253/0x4d0 fs/namei.c:3534
       do_sys_openat2+0x124/0x460 fs/open.c:1204
       do_sys_open fs/open.c:1220 [inline]
       __do_sys_creat fs/open.c:1294 [inline]
       __se_sys_creat fs/open.c:1288 [inline]
       __x64_sys_creat+0x11f/0x160 fs/open.c:1288
       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+0x44/0xae

-> #0 (&dquot->dq_lock){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3051 [inline]
       check_prevs_add+0x4f9/0x5b30 kernel/locking/lockdep.c:3174
       validate_chain kernel/locking/lockdep.c:3789 [inline]
       __lock_acquire+0x4476/0x6100 kernel/locking/lockdep.c:5015
       lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625
       __mutex_lock_common+0x1ad/0x3770 kernel/locking/mutex.c:959
       __mutex_lock kernel/locking/mutex.c:1104 [inline]
       mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:1119
       dquot_commit+0x57/0x360 fs/quota/dquot.c:474
       ext4_write_dquot+0x1e4/0x2b0 fs/ext4/super.c:6245
       mark_dquot_dirty fs/quota/dquot.c:345 [inline]
       mark_all_dquot_dirty fs/quota/dquot.c:383 [inline]
       __dquot_alloc_space+0xa18/0x1020 fs/quota/dquot.c:1707
       dquot_alloc_space_nodirty include/linux/quotaops.h:297 [inline]
       dquot_alloc_space include/linux/quotaops.h:310 [inline]
       dquot_alloc_block include/linux/quotaops.h:334 [inline]
       ext4_mb_new_blocks+0xe85/0x2470 fs/ext4/mballoc.c:5477
       ext4_ext_map_blocks+0x2be3/0x7210 fs/ext4/extents.c:4245
       ext4_map_blocks+0xab3/0x1cb0 fs/ext4/inode.c:638
       _ext4_get_block+0x24b/0x710 fs/ext4/inode.c:794
       ext4_block_write_begin+0x63a/0x1250 fs/ext4/inode.c:1077
       ext4_write_begin+0x5cc/0x1350 fs/ext4/ext4_jbd2.h:498
       ext4_da_write_begin+0x384/0x10c0 fs/ext4/inode.c:2960
       generic_perform_write+0x262/0x580 mm/filemap.c:3656
       ext4_buffered_write_iter+0x41c/0x590 fs/ext4/file.c:269
       ext4_file_write_iter+0x8f7/0x1b90 fs/ext4/file.c:519
       call_write_iter include/linux/fs.h:2114 [inline]
       new_sync_write fs/read_write.c:518 [inline]
       vfs_write+0xa39/0xc90 fs/read_write.c:605
       ksys_write+0x171/0x2a0 fs/read_write.c:658
       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+0x44/0xae

other info that might help us debug this:

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

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

4 locks held by syz-executor211/9242:
 #0: ffff88802ff60460 (sb_writers#5){.+.+}-{0:0}, at: vfs_write+0x21b/0xc90 fs/read_write.c:601
 #1: ffff88803a304058 (&sb->s_type->i_mutex_key#9){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:774 [inline]
 #1: ffff88803a304058 (&sb->s_type->i_mutex_key#9){+.+.}-{3:3}, at: ext4_buffered_write_iter+0xaf/0x590 fs/ext4/file.c:263
 #2: ffff88803a303e48 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_map_blocks+0x9e5/0x1cb0 fs/ext4/inode.c:631
 #3: ffffffff8c840518 (dquot_srcu){....}-{0:0}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:266

stack backtrace:
CPU: 1 PID: 9242 Comm: syz-executor211 Not tainted 5.14.0-rc4-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1ae/0x29f lib/dump_stack.c:105
 print_circular_bug+0xb17/0xdc0 kernel/locking/lockdep.c:2009
 check_noncircular+0x2cc/0x390 kernel/locking/lockdep.c:2131
 check_prev_add kernel/locking/lockdep.c:3051 [inline]
 check_prevs_add+0x4f9/0x5b30 kernel/locking/lockdep.c:3174
 validate_chain kernel/locking/lockdep.c:3789 [inline]
 __lock_acquire+0x4476/0x6100 kernel/locking/lockdep.c:5015
 lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625
 __mutex_lock_common+0x1ad/0x3770 kernel/locking/mutex.c:959
 __mutex_lock kernel/locking/mutex.c:1104 [inline]
 mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:1119
 dquot_commit+0x57/0x360 fs/quota/dquot.c:474
 ext4_write_dquot+0x1e4/0x2b0 fs/ext4/super.c:6245
 mark_dquot_dirty fs/quota/dquot.c:345 [inline]
 mark_all_dquot_dirty fs/quota/dquot.c:383 [inline]
 __dquot_alloc_space+0xa18/0x1020 fs/quota/dquot.c:1707
 dquot_alloc_space_nodirty include/linux/quotaops.h:297 [inline]
 dquot_alloc_space include/linux/quotaops.h:310 [inline]
 dquot_alloc_block include/linux/quotaops.h:334 [inline]
 ext4_mb_new_blocks+0xe85/0x2470 fs/ext4/mballoc.c:5477
 ext4_ext_map_blocks+0x2be3/0x7210 fs/ext4/extents.c:4245
 ext4_map_blocks+0xab3/0x1cb0 fs/ext4/inode.c:638
 _ext4_get_block+0x24b/0x710 fs/ext4/inode.c:794
 ext4_block_write_begin+0x63a/0x1250 fs/ext4/inode.c:1077
 ext4_write_begin+0x5cc/0x1350 fs/ext4/ext4_jbd2.h:498
 ext4_da_write_begin+0x384/0x10c0 fs/ext4/inode.c:2960
 generic_perform_write+0x262/0x580 mm/filemap.c:3656
 ext4_buffered_write_iter+0x41c/0x590 fs/ext4/file.c:269
 ext4_file_write_iter+0x8f7/0x1b90 fs/ext4/file.c:519
 call_write_iter include/linux/fs.h:2114 [inline]
 new_sync_write fs/read_write.c:518 [inline]
 vfs_write+0xa39/0xc90 fs/read_write.c:605
 ksys_write+0x171/0x2a0 fs/read_write.c:658
 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+0x44/0xae
RIP: 0033:0x445219
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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd8864cd18 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00000000004885e9 RCX: 0000000000445219
RDX: 000000000d4ba0ff RSI: 00000000200009c0 RDI: 0000000000000003
RBP: 0000000020010500 R08: 00007ffd8864cd40 R09: 00007ffd8864cd40
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000020010000
R13: 0030656c69662f2e R14: 00007ffd8864cd50 R15: 000000000000004d

Crashes (41):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-smack-root 2021/08/09 12:53 upstream 66745863ecde 6972b106 .config log report syz C possible deadlock in dquot_commit
ci-upstream-kasan-gce-root 2021/12/07 17:33 upstream cd8c917a56f2 0230ba3e .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-root 2021/12/02 20:49 upstream a51e3ac43ddb 61f86278 .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-smack-root 2021/12/01 23:13 upstream 58e1100fdc59 61f86278 .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-root 2021/12/01 14:48 upstream 58e1100fdc59 5fa3eacc .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-smack-root 2021/11/27 19:08 upstream c5c17547b778 63eeac02 .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-smack-root 2021/11/12 21:29 upstream 7246f4dcaccc 83f5c9b5 .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-smack-root 2021/11/12 01:19 upstream 5833291ab6de 75b04091 .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-smack-root 2021/11/09 14:20 upstream d2f38a3c6507 59bcaf9a .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-root 2021/11/08 23:30 upstream e851dfae4371 8ab17e57 .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-root 2021/11/06 16:06 upstream d4439a1189f9 4c1be0be .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-root 2021/11/02 04:58 upstream d2fac0afe89f 098b5d53 .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-root 2021/10/24 13:03 upstream 9c0c4d24ac00 282f03fb .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-smack-root 2021/10/16 19:19 upstream 8fe31e0995f0 0c5d9412 .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-smack-root 2021/10/04 18:22 upstream 84b3e42564ac ce697b49 .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-selinux-root 2021/09/23 15:00 upstream 58e2cf5d7946 8cac236e .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-root 2021/09/20 21:21 upstream e4e737bb5c17 af796c18 .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-smack-root 2021/09/09 15:28 upstream a3fa7a101dcf e2776ee4 .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-root 2021/08/30 03:50 upstream 90ac80dcd313 be2c130d .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-root 2021/08/29 07:48 upstream 64b4fc45bea6 be2c130d .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-root 2021/08/21 17:04 upstream fa54d366a6e4 b599f2fc .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-smack-root 2021/08/09 01:05 upstream 66745863ecde 6972b106 .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-root 2021/08/03 18:11 upstream c500bee1c5b2 6c236867 .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-root 2021/07/25 03:32 upstream 6498f6151825 4d1b57d4 .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-smack-root 2021/06/21 18:08 upstream 13311e74253f aba2b2fb .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-root 2021/05/25 00:44 upstream 1434a3127887 3c7fef33 .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-smack-root 2021/05/16 00:00 upstream c12a29ed9094 f54a5c09 .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-root 2021/05/11 12:51 upstream 1140ab592e2e ca873091 .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-root 2021/05/09 10:52 upstream b741596468b0 bc5434be .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-selinux-root 2021/05/04 17:02 upstream d2b6f8a17919 09efdd63 .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-root 2021/04/12 01:33 upstream 7d900724913c bfeda1b1 .config log report info possible deadlock in dquot_commit
ci-upstream-kasan-gce-selinux-root 2021/02/06 11:23 upstream 1e0d27fce010 23a562df .config log report info possible deadlock in dquot_commit
ci-qemu-upstream-386 2021/10/28 01:55 upstream 1fc596a56b33 be531bb4 .config log report info possible deadlock in dquot_commit
ci-upstream-linux-next-kasan-gce-root 2021/11/29 09:10 linux-next f81e94e91878 63eeac02 .config log report info possible deadlock in dquot_commit
ci-upstream-linux-next-kasan-gce-root 2021/11/08 12:40 linux-next e844ee04dee0 d29682f1 .config log report info possible deadlock in dquot_commit
ci-upstream-linux-next-kasan-gce-root 2021/10/29 23:14 linux-next bdcc9f6a5682 098b5d53 .config log report info possible deadlock in dquot_commit
ci-upstream-linux-next-kasan-gce-root 2021/10/17 06:08 linux-next 7c832d2f9b95 0c5d9412 .config log report info possible deadlock in dquot_commit
ci-upstream-linux-next-kasan-gce-root 2021/05/10 02:05 linux-next e6f67ebd93ef bc5434be .config log report info possible deadlock in dquot_commit
ci-upstream-linux-next-kasan-gce-root 2021/03/02 13:17 linux-next 92f791ebd25b 92ead296 .config log report info possible deadlock in dquot_commit
ci-qemu2-riscv64 2021/06/17 19:51 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 18a3c5f7abfd aba2b2fb .config log report info possible deadlock in dquot_commit
ci-qemu2-riscv64 2021/05/02 09:08 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 18a3c5f7abfd 77e2b668 .config log report info possible deadlock in dquot_commit
* Struck through repros no longer work on HEAD.