loop5: detected capacity change from 0 to 4096 EXT4-fs (loop5): mounted filesystem without journal. Opts: ,errors=continue. Quota mode: writeback. ====================================================== WARNING: possible circular locking dependency detected 5.12.0-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.5/11869 is trying to acquire lock: ffff88807fd5e0a8 (&dquot->dq_lock){+.+.}-{3:3}, at: dquot_commit+0x4d/0x420 fs/quota/dquot.c:476 but task is already holding lock: ffff88807fdb35b8 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_map_blocks+0x5e1/0x17d0 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}: down_read+0x9a/0x440 kernel/locking/rwsem.c:1353 ext4_map_blocks+0x381/0x17d0 fs/ext4/inode.c:561 ext4_getblk+0x13c/0x680 fs/ext4/inode.c:848 ext4_bread+0x29/0x210 fs/ext4/inode.c:900 ext4_quota_write+0x26b/0x680 fs/ext4/super.c:6569 write_blk+0x12e/0x220 fs/quota/quota_tree.c:73 get_free_dqblk+0xff/0x2d0 fs/quota/quota_tree.c:102 do_insert_tree+0x79c/0x1180 fs/quota/quota_tree.c:309 do_insert_tree+0xf77/0x1180 fs/quota/quota_tree.c:340 do_insert_tree+0xf77/0x1180 fs/quota/quota_tree.c:340 do_insert_tree+0xf77/0x1180 fs/quota/quota_tree.c:340 dq_insert_tree fs/quota/quota_tree.c:366 [inline] qtree_write_dquot+0x3b7/0x580 fs/quota/quota_tree.c:385 v2_write_dquot+0x11c/0x250 fs/quota/quota_v2.c:358 dquot_acquire+0x2c5/0x590 fs/quota/dquot.c:443 ext4_acquire_dquot+0x254/0x3b0 fs/ext4/super.c:6228 dqget+0x678/0x1080 fs/quota/dquot.c:901 __dquot_initialize+0x560/0xbe0 fs/quota/dquot.c:1479 ext4_create+0x90/0x4d0 fs/ext4/namei.c:2615 lookup_open.isra.0+0xfee/0x13d0 fs/namei.c:3215 open_last_lookups fs/namei.c:3285 [inline] path_openat+0x9b4/0x27e0 fs/namei.c:3491 do_filp_open+0x190/0x3d0 fs/namei.c:3521 do_sys_openat2+0x16d/0x420 fs/open.c:1187 do_sys_open fs/open.c:1203 [inline] __do_sys_creat fs/open.c:1277 [inline] __se_sys_creat fs/open.c:1271 [inline] __x64_sys_creat+0xc9/0x120 fs/open.c:1271 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #1 (&s->s_dquot.dqio_sem){++++}-{3:3}: down_read+0x9a/0x440 kernel/locking/rwsem.c:1353 v2_read_dquot+0x49/0x120 fs/quota/quota_v2.c:332 dquot_acquire+0x12e/0x590 fs/quota/dquot.c:434 ext4_acquire_dquot+0x254/0x3b0 fs/ext4/super.c:6228 dqget+0x678/0x1080 fs/quota/dquot.c:901 __dquot_initialize+0x560/0xbe0 fs/quota/dquot.c:1479 ext4_create+0x90/0x4d0 fs/ext4/namei.c:2615 lookup_open.isra.0+0xfee/0x13d0 fs/namei.c:3215 open_last_lookups fs/namei.c:3285 [inline] path_openat+0x9b4/0x27e0 fs/namei.c:3491 do_filp_open+0x190/0x3d0 fs/namei.c:3521 do_sys_openat2+0x16d/0x420 fs/open.c:1187 do_sys_open fs/open.c:1203 [inline] __do_sys_creat fs/open.c:1277 [inline] __se_sys_creat fs/open.c:1271 [inline] __x64_sys_creat+0xc9/0x120 fs/open.c:1271 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #0 (&dquot->dq_lock){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:2938 [inline] check_prevs_add kernel/locking/lockdep.c:3061 [inline] validate_chain kernel/locking/lockdep.c:3676 [inline] __lock_acquire+0x2a17/0x5230 kernel/locking/lockdep.c:4902 lock_acquire kernel/locking/lockdep.c:5512 [inline] lock_acquire+0x1ab/0x740 kernel/locking/lockdep.c:5477 __mutex_lock_common kernel/locking/mutex.c:949 [inline] __mutex_lock+0x139/0x1120 kernel/locking/mutex.c:1096 dquot_commit+0x4d/0x420 fs/quota/dquot.c:476 ext4_write_dquot+0x24e/0x310 fs/ext4/super.c:6212 ext4_mark_dquot_dirty fs/ext4/super.c:6260 [inline] ext4_mark_dquot_dirty+0x111/0x1b0 fs/ext4/super.c:6254 mark_dquot_dirty fs/quota/dquot.c:347 [inline] mark_all_dquot_dirty fs/quota/dquot.c:385 [inline] __dquot_alloc_space+0x5d4/0xb60 fs/quota/dquot.c:1709 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+0x5b3/0x51a0 fs/ext4/mballoc.c:4944 ext4_ext_map_blocks+0x20da/0x5fb0 fs/ext4/extents.c:4238 ext4_map_blocks+0x653/0x17d0 fs/ext4/inode.c:638 _ext4_get_block+0x241/0x590 fs/ext4/inode.c:794 ext4_block_write_begin+0x4f8/0x1190 fs/ext4/inode.c:1078 ext4_write_begin+0x4ba/0x14b0 fs/ext4/inode.c:1203 ext4_da_write_begin+0x677/0x1160 fs/ext4/inode.c:2962 generic_perform_write+0x20a/0x4f0 mm/filemap.c:3643 ext4_buffered_write_iter+0x244/0x4d0 fs/ext4/file.c:269 ext4_file_write_iter+0x423/0x14e0 fs/ext4/file.c:663 call_write_iter include/linux/fs.h:2116 [inline] new_sync_write+0x426/0x650 fs/read_write.c:518 vfs_write+0x796/0xa30 fs/read_write.c:605 ksys_write+0x12d/0x250 fs/read_write.c:658 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 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 *** 5 locks held by syz-executor.5/11869: #0: ffff888019ab0670 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0xe9/0x100 fs/file.c:974 #1: ffff88802dfd0460 (sb_writers#5){.+.+}-{0:0}, at: ksys_write+0x12d/0x250 fs/read_write.c:658 #2: ffff88807fdb37c8 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: inode_lock include/linux/fs.h:776 [inline] #2: ffff88807fdb37c8 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: ext4_buffered_write_iter+0xb6/0x4d0 fs/ext4/file.c:263 #3: ffff88807fdb35b8 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_map_blocks+0x5e1/0x17d0 fs/ext4/inode.c:631 #4: ffffffff8c121e78 (dquot_srcu){....}-{0:0}, at: i_dquot fs/quota/dquot.c:926 [inline] #4: ffffffff8c121e78 (dquot_srcu){....}-{0:0}, at: __dquot_alloc_space+0x1b4/0xb60 fs/quota/dquot.c:1671 stack backtrace: CPU: 0 PID: 11869 Comm: syz-executor.5 Not tainted 5.12.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x141/0x1d7 lib/dump_stack.c:120 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2129 check_prev_add kernel/locking/lockdep.c:2938 [inline] check_prevs_add kernel/locking/lockdep.c:3061 [inline] validate_chain kernel/locking/lockdep.c:3676 [inline] __lock_acquire+0x2a17/0x5230 kernel/locking/lockdep.c:4902 lock_acquire kernel/locking/lockdep.c:5512 [inline] lock_acquire+0x1ab/0x740 kernel/locking/lockdep.c:5477 __mutex_lock_common kernel/locking/mutex.c:949 [inline] __mutex_lock+0x139/0x1120 kernel/locking/mutex.c:1096 dquot_commit+0x4d/0x420 fs/quota/dquot.c:476 ext4_write_dquot+0x24e/0x310 fs/ext4/super.c:6212 ext4_mark_dquot_dirty fs/ext4/super.c:6260 [inline] ext4_mark_dquot_dirty+0x111/0x1b0 fs/ext4/super.c:6254 mark_dquot_dirty fs/quota/dquot.c:347 [inline] mark_all_dquot_dirty fs/quota/dquot.c:385 [inline] __dquot_alloc_space+0x5d4/0xb60 fs/quota/dquot.c:1709 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+0x5b3/0x51a0 fs/ext4/mballoc.c:4944 ext4_ext_map_blocks+0x20da/0x5fb0 fs/ext4/extents.c:4238 ext4_map_blocks+0x653/0x17d0 fs/ext4/inode.c:638 _ext4_get_block+0x241/0x590 fs/ext4/inode.c:794 ext4_block_write_begin+0x4f8/0x1190 fs/ext4/inode.c:1078 ext4_write_begin+0x4ba/0x14b0 fs/ext4/inode.c:1203 ext4_da_write_begin+0x677/0x1160 fs/ext4/inode.c:2962 generic_perform_write+0x20a/0x4f0 mm/filemap.c:3643 ext4_buffered_write_iter+0x244/0x4d0 fs/ext4/file.c:269 ext4_file_write_iter+0x423/0x14e0 fs/ext4/file.c:663 call_write_iter include/linux/fs.h:2116 [inline] new_sync_write+0x426/0x650 fs/read_write.c:518 vfs_write+0x796/0xa30 fs/read_write.c:605 ksys_write+0x12d/0x250 fs/read_write.c:658 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x4665f9 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fa2a130c188 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 000000000056c008 RCX: 00000000004665f9 RDX: 000000000d4ba0ff RSI: 00000000200009c0 RDI: 0000000000000005 RBP: 00000000004bfce1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056c008 R13: 00007ffc2857d37f R14: 00007fa2a130c300 R15: 0000000000022000