====================================================== WARNING: possible circular locking dependency detected 4.19.194-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor198/8602 is trying to acquire lock: 00000000c8e05b3c (&dquot->dq_lock){+.+.}, at: dquot_commit+0x4d/0x400 fs/quota/dquot.c:469 but task is already holding lock: 00000000480561e3 (&ei->i_data_sem/2){++++}, at: ext4_map_blocks+0x740/0x1a50 fs/ext4/inode.c:650 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&ei->i_data_sem/2){++++}: ext4_map_blocks+0x33e/0x1a50 fs/ext4/inode.c:578 ext4_getblk+0xad/0x4f0 fs/ext4/inode.c:993 ext4_bread+0x7c/0x210 fs/ext4/inode.c:1043 ext4_quota_write+0x205/0x530 fs/ext4/super.c:6000 write_blk+0x10a/0x200 fs/quota/quota_tree.c:72 get_free_dqblk+0xff/0x2d0 fs/quota/quota_tree.c:101 do_insert_tree+0x79c/0x1150 fs/quota/quota_tree.c:308 do_insert_tree+0xf5c/0x1150 fs/quota/quota_tree.c:339 dq_insert_tree fs/quota/quota_tree.c:365 [inline] qtree_write_dquot+0x1cb/0x570 fs/quota/quota_tree.c:384 v2_write_dquot+0x11c/0x250 fs/quota/quota_v2.c:359 dquot_acquire+0x25c/0x490 fs/quota/dquot.c:436 ext4_acquire_dquot+0x1e7/0x2d0 fs/ext4/super.c:5658 dqget+0x785/0xfc0 fs/quota/dquot.c:896 __dquot_initialize+0x3bd/0xb70 fs/quota/dquot.c:1470 ext4_tmpfile+0x87/0x480 fs/ext4/namei.c:2574 vfs_tmpfile+0x208/0x370 fs/namei.c:3456 do_tmpfile fs/namei.c:3488 [inline] path_openat+0x1e02/0x2df0 fs/namei.c:3531 do_filp_open+0x18c/0x3f0 fs/namei.c:3567 do_sys_open+0x3b3/0x520 fs/open.c:1085 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #1 (&s->s_dquot.dqio_sem){++++}: v2_read_dquot+0x49/0x120 fs/quota/quota_v2.c:333 dquot_acquire+0x121/0x490 fs/quota/dquot.c:428 ext4_acquire_dquot+0x1e7/0x2d0 fs/ext4/super.c:5658 dqget+0x785/0xfc0 fs/quota/dquot.c:896 __dquot_initialize+0x3bd/0xb70 fs/quota/dquot.c:1470 ext4_tmpfile+0x87/0x480 fs/ext4/namei.c:2574 vfs_tmpfile+0x208/0x370 fs/namei.c:3456 do_tmpfile fs/namei.c:3488 [inline] path_openat+0x1e02/0x2df0 fs/namei.c:3531 do_filp_open+0x18c/0x3f0 fs/namei.c:3567 do_sys_open+0x3b3/0x520 fs/open.c:1085 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #0 (&dquot->dq_lock){+.+.}: __mutex_lock_common kernel/locking/mutex.c:938 [inline] __mutex_lock+0xd7/0x1200 kernel/locking/mutex.c:1083 dquot_commit+0x4d/0x400 fs/quota/dquot.c:469 ext4_write_dquot+0x1e7/0x280 fs/ext4/super.c:5642 ext4_mark_dquot_dirty+0x111/0x1a0 fs/ext4/super.c:5693 mark_dquot_dirty fs/quota/dquot.c:341 [inline] mark_all_dquot_dirty fs/quota/dquot.c:379 [inline] __dquot_alloc_space+0x37e/0x860 fs/quota/dquot.c:1702 dquot_alloc_space_nodirty include/linux/quotaops.h:298 [inline] dquot_alloc_space include/linux/quotaops.h:311 [inline] dquot_alloc_block include/linux/quotaops.h:335 [inline] ext4_mb_new_blocks+0x58c/0x4370 fs/ext4/mballoc.c:4533 ext4_ext_map_blocks+0x2aa2/0x7390 fs/ext4/extents.c:4490 ext4_map_blocks+0x7a2/0x1a50 fs/ext4/inode.c:657 _ext4_get_block+0x208/0x530 fs/ext4/inode.c:810 __block_write_begin_int+0x46c/0x17b0 fs/buffer.c:1978 ext4_write_begin+0x52d/0x1610 fs/ext4/inode.c:1345 ext4_da_write_begin+0x737/0x10e0 fs/ext4/inode.c:3051 generic_perform_write+0x1f8/0x4d0 mm/filemap.c:3170 __generic_file_write_iter+0x24b/0x610 mm/filemap.c:3295 ext4_file_write_iter+0x2fe/0xf20 fs/ext4/file.c:272 call_write_iter include/linux/fs.h:1821 [inline] do_iter_readv_writev+0x668/0x790 fs/read_write.c:681 do_iter_write+0x182/0x5d0 fs/read_write.c:960 vfs_writev+0x153/0x2e0 fs/read_write.c:1005 do_pwritev fs/read_write.c:1094 [inline] __do_sys_pwritev fs/read_write.c:1141 [inline] __se_sys_pwritev fs/read_write.c:1136 [inline] __x64_sys_pwritev+0x22b/0x310 fs/read_write.c:1136 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe 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-executor198/8602: #0: 000000009bc8eb21 (sb_writers#3){.+.+}, at: file_start_write include/linux/fs.h:2779 [inline] #0: 000000009bc8eb21 (sb_writers#3){.+.+}, at: vfs_writev+0x259/0x2e0 fs/read_write.c:1004 #1: 0000000052ec3999 (&sb->s_type->i_mutex_key#10){+.+.}, at: inode_trylock include/linux/fs.h:768 [inline] #1: 0000000052ec3999 (&sb->s_type->i_mutex_key#10){+.+.}, at: ext4_file_write_iter+0x21f/0xf20 fs/ext4/file.c:238 #2: 00000000480561e3 (&ei->i_data_sem/2){++++}, at: ext4_map_blocks+0x740/0x1a50 fs/ext4/inode.c:650 #3: 000000008f04b416 (dquot_srcu){....}, at: i_dquot fs/quota/dquot.c:921 [inline] #3: 000000008f04b416 (dquot_srcu){....}, at: __dquot_alloc_space+0x1ad/0x860 fs/quota/dquot.c:1662 stack backtrace: CPU: 0 PID: 8602 Comm: syz-executor198 Not tainted 4.19.194-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1fc/0x2ef lib/dump_stack.c:118 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1222 check_prev_add kernel/locking/lockdep.c:1866 [inline] check_prevs_add kernel/locking/lockdep.c:1979 [inline] validate_chain kernel/locking/lockdep.c:2420 [inline] __lock_acquire+0x30c9/0x3ff0 kernel/locking/lockdep.c:3416 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3908 __mutex_lock_common kernel/locking/mutex.c:938 [inline] __mutex_lock+0xd7/0x1200 kernel/locking/mutex.c:1083 dquot_commit+0x4d/0x400 fs/quota/dquot.c:469 ext4_write_dquot+0x1e7/0x280 fs/ext4/super.c:5642 ext4_mark_dquot_dirty+0x111/0x1a0 fs/ext4/super.c:5693 mark_dquot_dirty fs/quota/dquot.c:341 [inline] mark_all_dquot_dirty fs/quota/dquot.c:379 [inline] __dquot_alloc_space+0x37e/0x860 fs/quota/dquot.c:1702 dquot_alloc_space_nodirty include/linux/quotaops.h:298 [inline] dquot_alloc_space include/linux/quotaops.h:311 [inline] dquot_alloc_block include/linux/quotaops.h:335 [inline] ext4_mb_new_blocks+0x58c/0x4370 fs/ext4/mballoc.c:4533 ext4_ext_map_blocks+0x2aa2/0x7390 fs/ext4/extents.c:4490 ext4_map_blocks+0x7a2/0x1a50 fs/ext4/inode.c:657 _ext4_get_block+0x208/0x530 fs/ext4/inode.c:810 __block_write_begin_int+0x46c/0x17b0 fs/buffer.c:1978 ext4_write_begin+0x52d/0x1610 fs/ext4/inode.c:1345 ext4_da_write_begin+0x737/0x10e0 fs/ext4/inode.c:3051 generic_perform_write+0x1f8/0x4d0 mm/filemap.c:3170 __generic_file_write_iter+0x24b/0x610 mm/filemap.c:3295 ext4_file_write_iter+0x2fe/0xf20 fs/ext4/file.c:272 call_write_iter include/linux/fs.h:1821 [inline] do_iter_readv_writev+0x668/0x790 fs/read_write.c:681 do_iter_write+0x182/0x5d0 fs/read_write.c:960 vfs_writev+0x153/0x2e0 fs/read_write.c:1005 do_pwritev fs/read_write.c:1094 [inline] __do_sys_pwritev fs/read_write.c:1141 [inline] __se_sys_pwritev fs/read_write.c:1136 [inline] __x64_sys_pwritev+0x22b/0x310 fs/read_write.c:1136 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4453a9 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:00007ffc62038b68 EFLAGS: 00000246 ORIG_RAX: 0000000000000128 RAX: ffffffffffffffda RBX: 0000000000488218 RCX: 00000000004453a9 RDX: 0000000000000018 RSI: 00000000200006c0 RDI: 0000000000000003 RBP: 00000000004881d0 R08: 0000000000000004 R09: 000000000000000d R10: 000000000400fa7f R11: 0000000000000246 R12: 0000000000488188 R13: 00000000004880c0 R14: 0000000020011000 R15: 0000000020010e00