loop0: detected capacity change from 0 to 4096 EXT4-fs (loop0): mounted filesystem without journal. Quota mode: writeback. ====================================================== WARNING: possible circular locking dependency detected 6.0.0-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/12036 is trying to acquire lock: ffff8880731c8ce8 (&dquot->dq_lock){+.+.}-{3:3}, at: dquot_commit+0x58/0x4e0 fs/quota/dquot.c:479 but task is already holding lock: ffff88807338f0e0 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_map_blocks+0x971/0x1cc0 fs/ext4/inode.c:638 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/0x3c0 kernel/locking/lockdep.c:5666 down_read+0x39/0x50 kernel/locking/rwsem.c:1499 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:6956 write_blk fs/quota/quota_tree.c:64 [inline] get_free_dqblk+0x357/0x6a0 fs/quota/quota_tree.c:93 do_insert_tree+0x26c/0x1a40 fs/quota/quota_tree.c:300 do_insert_tree+0x693/0x1a40 fs/quota/quota_tree.c:331 do_insert_tree+0x693/0x1a40 fs/quota/quota_tree.c:331 do_insert_tree+0x693/0x1a40 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+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:6612 dqget+0x999/0xdc0 fs/quota/dquot.c:914 __dquot_initialize+0x291/0xcf0 fs/quota/dquot.c:1492 ext4_process_orphan+0x57/0x2d0 fs/ext4/orphan.c:329 ext4_orphan_cleanup+0xb60/0x1340 fs/ext4/orphan.c:474 __ext4_fill_super+0x9634/0x9a10 fs/ext4/super.c:5378 ext4_fill_super+0x313/0x700 fs/ext4/super.c:5517 get_tree_bdev+0x400/0x620 fs/super.c:1323 vfs_get_tree+0x88/0x270 fs/super.c:1530 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 -> #1 (&s->s_dquot.dqio_sem){++++}-{3:3}: lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5666 down_read+0x39/0x50 kernel/locking/rwsem.c:1499 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:6612 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:2789 lookup_open fs/namei.c:3413 [inline] open_last_lookups fs/namei.c:3481 [inline] path_openat+0x12d0/0x2df0 fs/namei.c:3688 do_filp_open+0x264/0x4f0 fs/namei.c:3718 do_sys_openat2+0x124/0x4e0 fs/open.c:1313 do_sys_open fs/open.c:1329 [inline] __do_sys_open fs/open.c:1337 [inline] __se_sys_open fs/open.c:1333 [inline] __x64_sys_open+0x221/0x270 fs/open.c:1333 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 (&dquot->dq_lock){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3095 [inline] check_prevs_add kernel/locking/lockdep.c:3214 [inline] validate_chain+0x1873/0x6c00 kernel/locking/lockdep.c:3829 __lock_acquire+0x1292/0x1f60 kernel/locking/lockdep.c:5053 lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5666 __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:6596 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+0x106f/0x3e80 fs/ext4/mballoc.c:5573 ext4_ext_map_blocks+0x17b4/0x65b0 fs/ext4/extents.c:4285 ext4_map_blocks+0xa49/0x1cc0 fs/ext4/inode.c:645 _ext4_get_block+0x233/0x660 fs/ext4/inode.c:802 ext4_block_write_begin+0x6a8/0x2290 fs/ext4/inode.c:1092 ext4_write_begin+0x4dc/0xc60 ext4_da_write_begin+0x326/0x760 fs/ext4/inode.c:2972 generic_perform_write+0x2a8/0x5b0 mm/filemap.c:3738 ext4_buffered_write_iter+0x122/0x3a0 fs/ext4/file.c:270 ext4_file_write_iter+0xabb/0x1ad0 call_write_iter include/linux/fs.h:2187 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x7dc/0xc50 fs/read_write.c:584 ksys_write+0x177/0x2a0 fs/read_write.c:637 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: &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.0/12036: #0: ffff88801ffe9768 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x242/0x2e0 fs/file.c:1036 #1: ffff8880278b0460 (sb_writers#4){.+.+}-{0:0}, at: vfs_write+0x287/0xc50 fs/read_write.c:580 #2: ffff88807338f258 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: inode_lock include/linux/fs.h:756 [inline] #2: ffff88807338f258 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: ext4_buffered_write_iter+0xae/0x3a0 fs/ext4/file.c:264 #3: ffff88807338f0e0 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_map_blocks+0x971/0x1cc0 fs/ext4/inode.c:638 #4: ffffffff8cc637a8 (dquot_srcu){....}-{0:0}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:279 stack backtrace: CPU: 0 PID: 12036 Comm: syz-executor.0 Not tainted 6.0.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022 Call Trace: __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:2175 check_prev_add kernel/locking/lockdep.c:3095 [inline] check_prevs_add kernel/locking/lockdep.c:3214 [inline] validate_chain+0x1873/0x6c00 kernel/locking/lockdep.c:3829 __lock_acquire+0x1292/0x1f60 kernel/locking/lockdep.c:5053 lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5666 __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:6596 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+0x106f/0x3e80 fs/ext4/mballoc.c:5573 ext4_ext_map_blocks+0x17b4/0x65b0 fs/ext4/extents.c:4285 ext4_map_blocks+0xa49/0x1cc0 fs/ext4/inode.c:645 _ext4_get_block+0x233/0x660 fs/ext4/inode.c:802 ext4_block_write_begin+0x6a8/0x2290 fs/ext4/inode.c:1092 ext4_write_begin+0x4dc/0xc60 ext4_da_write_begin+0x326/0x760 fs/ext4/inode.c:2972 generic_perform_write+0x2a8/0x5b0 mm/filemap.c:3738 ext4_buffered_write_iter+0x122/0x3a0 fs/ext4/file.c:270 ext4_file_write_iter+0xabb/0x1ad0 call_write_iter include/linux/fs.h:2187 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x7dc/0xc50 fs/read_write.c:584 ksys_write+0x177/0x2a0 fs/read_write.c:637 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:0x7fc92108a5a9 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fc922250168 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007fc9211abf80 RCX: 00007fc92108a5a9 RDX: 000000006db6e559 RSI: 0000000020000300 RDI: 0000000000000003 RBP: 00007fc9210e5580 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fffa903c67f R14: 00007fc922250300 R15: 0000000000022000