====================================================== WARNING: possible circular locking dependency detected 5.14.0-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.2/19969 is trying to acquire lock: ffff88802c7ac268 (&dquot->dq_lock){+.+.}-{3:3}, at: dquot_commit+0x57/0x360 fs/quota/dquot.c:474 but task is already holding lock: ffff88806dce5238 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_map_blocks+0x9f9/0x1cc0 fs/ext4/inode.c:630 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+0x19f/0x4d0 kernel/locking/lockdep.c:5625 down_read+0x3b/0x50 kernel/locking/rwsem.c:1462 ext4_map_blocks+0x27a/0x1cc0 fs/ext4/inode.c:560 ext4_getblk+0x19c/0x700 fs/ext4/inode.c:847 ext4_bread+0x2a/0x170 fs/ext4/inode.c:900 ext4_quota_write+0x2a5/0x600 fs/ext4/super.c:6469 write_blk fs/quota/quota_tree.c:64 [inline] get_free_dqblk+0x33a/0x660 fs/quota/quota_tree.c:93 do_insert_tree+0x297/0x1db0 fs/quota/quota_tree.c:300 do_insert_tree+0x690/0x1db0 fs/quota/quota_tree.c:331 do_insert_tree+0x690/0x1db0 fs/quota/quota_tree.c:331 do_insert_tree+0x690/0x1db0 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:6138 dqget+0x999/0xdc0 fs/quota/dquot.c:899 __dquot_initialize+0x2d4/0xe60 fs/quota/dquot.c:1477 ext4_create+0xe3/0x550 fs/ext4/namei.c:2739 lookup_open fs/namei.c:3280 [inline] open_last_lookups fs/namei.c:3350 [inline] path_openat+0x1397/0x3670 fs/namei.c:3556 do_filp_open+0x277/0x4f0 fs/namei.c:3586 do_sys_openat2+0x13b/0x500 fs/open.c:1200 do_sys_open fs/open.c:1216 [inline] __do_sys_creat fs/open.c:1290 [inline] __se_sys_creat fs/open.c:1284 [inline] __x64_sys_creat+0x11f/0x160 fs/open.c:1284 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #1 (&s->s_dquot.dqio_sem){++++}-{3:3}: lock_acquire+0x19f/0x4d0 kernel/locking/lockdep.c:5625 down_read+0x3b/0x50 kernel/locking/rwsem.c:1462 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:6138 dqget+0x999/0xdc0 fs/quota/dquot.c:899 __dquot_initialize+0x2d4/0xe60 fs/quota/dquot.c:1477 ext4_create+0xe3/0x550 fs/ext4/namei.c:2739 lookup_open fs/namei.c:3280 [inline] open_last_lookups fs/namei.c:3350 [inline] path_openat+0x1397/0x3670 fs/namei.c:3556 do_filp_open+0x277/0x4f0 fs/namei.c:3586 do_sys_openat2+0x13b/0x500 fs/open.c:1200 do_sys_open fs/open.c:1216 [inline] __do_sys_creat fs/open.c:1290 [inline] __se_sys_creat fs/open.c:1284 [inline] __x64_sys_creat+0x11f/0x160 fs/open.c:1284 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 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 kernel/locking/lockdep.c:3174 [inline] validate_chain+0x1dfb/0x8240 kernel/locking/lockdep.c:3789 __lock_acquire+0x1382/0x2b00 kernel/locking/lockdep.c:5015 lock_acquire+0x19f/0x4d0 kernel/locking/lockdep.c:5625 __mutex_lock_common+0x1df/0x2550 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:743 dquot_commit+0x57/0x360 fs/quota/dquot.c:474 ext4_write_dquot+0x1e4/0x2b0 fs/ext4/super.c:6122 mark_dquot_dirty fs/quota/dquot.c:345 [inline] mark_all_dquot_dirty fs/quota/dquot.c:383 [inline] __dquot_alloc_space+0xa38/0x1040 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+0xee6/0x25b0 fs/ext4/mballoc.c:5548 ext4_ext_map_blocks+0x2b83/0x7220 fs/ext4/extents.c:4250 ext4_map_blocks+0xaba/0x1cc0 fs/ext4/inode.c:637 _ext4_get_block+0x254/0x710 fs/ext4/inode.c:793 ext4_block_write_begin+0x671/0x12e0 fs/ext4/inode.c:1078 ext4_write_begin+0x57e/0x12b0 ext4_da_write_begin+0x377/0x1060 fs/ext4/inode.c:2966 generic_perform_write+0x2dd/0x600 mm/filemap.c:3770 ext4_buffered_write_iter+0x43b/0x5b0 fs/ext4/file.c:269 ext4_file_write_iter+0x8f7/0x1bb0 call_write_iter include/linux/fs.h:2163 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0xb11/0xe90 fs/read_write.c:594 ksys_write+0x18f/0x2c0 fs/read_write.c:647 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 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 *** 5 locks held by syz-executor.2/19969: #0: ffff88801a8285f0 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x24e/0x2f0 fs/file.c:990 #1: ffff88801a34c460 (sb_writers#5){.+.+}-{0:0}, at: vfs_write+0x2b5/0xe90 fs/read_write.c:590 #2: ffff88806dce53b0 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: inode_lock include/linux/fs.h:786 [inline] #2: ffff88806dce53b0 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: ext4_buffered_write_iter+0xaf/0x5b0 fs/ext4/file.c:263 #3: ffff88806dce5238 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_map_blocks+0x9f9/0x1cc0 fs/ext4/inode.c:630 #4: ffffffff8ca47bf8 (dquot_srcu){....}-{0:0}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:266 stack backtrace: CPU: 0 PID: 19969 Comm: syz-executor.2 Not tainted 5.14.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:88 [inline] dump_stack_lvl+0x1dc/0x2d8 lib/dump_stack.c:106 check_noncircular+0x2f9/0x3b0 kernel/locking/lockdep.c:2131 check_prev_add kernel/locking/lockdep.c:3051 [inline] check_prevs_add kernel/locking/lockdep.c:3174 [inline] validate_chain+0x1dfb/0x8240 kernel/locking/lockdep.c:3789 __lock_acquire+0x1382/0x2b00 kernel/locking/lockdep.c:5015 lock_acquire+0x19f/0x4d0 kernel/locking/lockdep.c:5625 __mutex_lock_common+0x1df/0x2550 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:743 dquot_commit+0x57/0x360 fs/quota/dquot.c:474 ext4_write_dquot+0x1e4/0x2b0 fs/ext4/super.c:6122 mark_dquot_dirty fs/quota/dquot.c:345 [inline] mark_all_dquot_dirty fs/quota/dquot.c:383 [inline] __dquot_alloc_space+0xa38/0x1040 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+0xee6/0x25b0 fs/ext4/mballoc.c:5548 ext4_ext_map_blocks+0x2b83/0x7220 fs/ext4/extents.c:4250 ext4_map_blocks+0xaba/0x1cc0 fs/ext4/inode.c:637 _ext4_get_block+0x254/0x710 fs/ext4/inode.c:793 ext4_block_write_begin+0x671/0x12e0 fs/ext4/inode.c:1078 ext4_write_begin+0x57e/0x12b0 ext4_da_write_begin+0x377/0x1060 fs/ext4/inode.c:2966 generic_perform_write+0x2dd/0x600 mm/filemap.c:3770 ext4_buffered_write_iter+0x43b/0x5b0 fs/ext4/file.c:269 ext4_file_write_iter+0x8f7/0x1bb0 call_write_iter include/linux/fs.h:2163 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0xb11/0xe90 fs/read_write.c:594 ksys_write+0x18f/0x2c0 fs/read_write.c:647 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 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:00007f3a5d458188 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665f9 RDX: 000000000d4ba0ff RSI: 00000000200009c0 RDI: 0000000000000004 RBP: 00000000004bfcc4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80 R13: 00007ffd1edec0ef R14: 00007f3a5d458300 R15: 0000000000022000