EXT4-fs error (device loop0): ext4_mb_generate_buddy:1095: group 0, block bitmap and bg descriptor inconsistent: 7554 vs 23 free clusters ====================================================== WARNING: possible circular locking dependency detected 6.1.0-rc5-syzkaller-00008-ge01d50cbd6ee #0 Not tainted ------------------------------------------------------ syz-executor412/4039 is trying to acquire lock: ffff88806f951068 (&dquot->dq_lock){+.+.}-{3:3}, at: dquot_commit+0x4d/0x560 fs/quota/dquot.c:479 but task is already holding lock: ffff88806f9e48c0 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_truncate+0x689/0x1530 fs/ext4/inode.c:4259 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+0x98/0x450 kernel/locking/rwsem.c:1509 ext4_map_blocks+0x263/0x18d0 fs/ext4/inode.c:568 ext4_getblk+0x5f2/0x7a0 fs/ext4/inode.c:858 ext4_bread+0x2a/0x190 fs/ext4/inode.c:914 ext4_quota_write+0x214/0x620 fs/ext4/super.c:7082 write_blk+0x12e/0x220 fs/quota/quota_tree.c:64 get_free_dqblk+0x1ab/0x2f0 fs/quota/quota_tree.c:130 do_insert_tree+0x3c5/0x12d0 fs/quota/quota_tree.c:340 do_insert_tree+0x696/0x12d0 fs/quota/quota_tree.c:375 do_insert_tree+0x488/0x12d0 fs/quota/quota_tree.c:375 dq_insert_tree fs/quota/quota_tree.c:401 [inline] qtree_write_dquot+0x3b0/0x570 fs/quota/quota_tree.c:420 v2_write_dquot+0x11c/0x250 fs/quota/quota_v2.c:358 dquot_acquire+0x3cd/0x6c0 fs/quota/dquot.c:444 ext4_acquire_dquot+0x254/0x3b0 fs/ext4/super.c:6738 dqget+0x679/0x1080 fs/quota/dquot.c:914 __dquot_initialize+0x560/0xbe0 fs/quota/dquot.c:1492 ext4_process_orphan+0x47/0x410 fs/ext4/orphan.c:329 ext4_orphan_cleanup+0x6f7/0x10f0 fs/ext4/orphan.c:474 __ext4_fill_super fs/ext4/super.c:5515 [inline] ext4_fill_super+0x9ec9/0xb1c0 fs/ext4/super.c:5643 get_tree_bdev+0x440/0x760 fs/super.c:1324 vfs_get_tree+0x89/0x2f0 fs/super.c:1531 do_new_mount fs/namespace.c:3040 [inline] path_mount+0x1326/0x1e20 fs/namespace.c:3370 do_mount fs/namespace.c:3383 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount fs/namespace.c:3568 [inline] __x64_sys_mount+0x27f/0x300 fs/namespace.c:3568 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #1 (&s->s_dquot.dqio_sem){++++}-{3:3}: down_read+0x98/0x450 kernel/locking/rwsem.c:1509 v2_read_dquot+0x49/0x120 fs/quota/quota_v2.c:332 dquot_acquire+0x1af/0x6c0 fs/quota/dquot.c:435 ext4_acquire_dquot+0x254/0x3b0 fs/ext4/super.c:6738 dqget+0x679/0x1080 fs/quota/dquot.c:914 __dquot_initialize+0x560/0xbe0 fs/quota/dquot.c:1492 ext4_process_orphan+0x47/0x410 fs/ext4/orphan.c:329 ext4_orphan_cleanup+0x6f7/0x10f0 fs/ext4/orphan.c:474 __ext4_fill_super fs/ext4/super.c:5515 [inline] ext4_fill_super+0x9ec9/0xb1c0 fs/ext4/super.c:5643 get_tree_bdev+0x440/0x760 fs/super.c:1324 vfs_get_tree+0x89/0x2f0 fs/super.c:1531 do_new_mount fs/namespace.c:3040 [inline] path_mount+0x1326/0x1e20 fs/namespace.c:3370 do_mount fs/namespace.c:3383 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount fs/namespace.c:3568 [inline] __x64_sys_mount+0x27f/0x300 fs/namespace.c:3568 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/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:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain kernel/locking/lockdep.c:3831 [inline] __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055 lock_acquire kernel/locking/lockdep.c:5668 [inline] lock_acquire+0x1df/0x630 kernel/locking/lockdep.c:5633 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1350 kernel/locking/mutex.c:747 dquot_commit+0x4d/0x560 fs/quota/dquot.c:479 ext4_write_dquot+0x24e/0x310 fs/ext4/super.c:6722 ext4_mark_dquot_dirty fs/ext4/super.c:6770 [inline] ext4_mark_dquot_dirty+0x111/0x1b0 fs/ext4/super.c:6764 mark_dquot_dirty fs/quota/dquot.c:346 [inline] mark_all_dquot_dirty fs/quota/dquot.c:384 [inline] __dquot_free_space+0x74e/0xac0 fs/quota/dquot.c:1907 dquot_free_space_nodirty include/linux/quotaops.h:379 [inline] dquot_free_space include/linux/quotaops.h:384 [inline] dquot_free_block include/linux/quotaops.h:395 [inline] ext4_mb_clear_bb fs/ext4/mballoc.c:6050 [inline] ext4_free_blocks+0x11c6/0x22f0 fs/ext4/mballoc.c:6179 ext4_remove_blocks fs/ext4/extents.c:2527 [inline] ext4_ext_rm_leaf fs/ext4/extents.c:2711 [inline] ext4_ext_remove_space+0x3486/0x46c0 fs/ext4/extents.c:2959 ext4_ext_truncate+0x33f/0x400 fs/ext4/extents.c:4417 ext4_truncate+0xf79/0x1530 fs/ext4/inode.c:4264 ext4_evict_inode+0xbd2/0x1e30 fs/ext4/inode.c:286 evict+0x2ed/0x6b0 fs/inode.c:664 iput_final fs/inode.c:1747 [inline] iput.part.0+0x59b/0x880 fs/inode.c:1773 iput+0x58/0x70 fs/inode.c:1763 dentry_unlink_inode+0x2b1/0x460 fs/dcache.c:401 __dentry_kill+0x3c0/0x640 fs/dcache.c:607 dentry_kill fs/dcache.c:745 [inline] dput+0x64d/0xdb0 fs/dcache.c:913 do_renameat2+0xb6e/0xc80 fs/namei.c:4931 __do_sys_renameat2 fs/namei.c:4962 [inline] __se_sys_renameat2 fs/namei.c:4959 [inline] __x64_sys_renameat2+0xe4/0x120 fs/namei.c:4959 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/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-executor412/4039: #0: ffff888079b10460 (sb_writers#4){.+.+}-{0:0}, at: do_renameat2+0x37b/0xc80 fs/namei.c:4865 #1: ffff88806f9e2218 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:791 [inline] #1: ffff88806f9e2218 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: lock_rename+0x225/0x280 fs/namei.c:2990 #2: ffff888079b10650 (sb_internal){.+.+}-{0:0}, at: evict+0x2ed/0x6b0 fs/inode.c:664 #3: ffff88806f9e48c0 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_truncate+0x689/0x1530 fs/ext4/inode.c:4259 #4: ffffffff8c169148 (dquot_srcu){....}-{0:0}, at: i_dquot fs/quota/dquot.c:939 [inline] #4: ffffffff8c169148 (dquot_srcu){....}-{0:0}, at: __dquot_free_space+0x1a4/0xac0 fs/quota/dquot.c:1880 stack backtrace: CPU: 0 PID: 4039 Comm: syz-executor412 Not tainted 6.1.0-rc5-syzkaller-00008-ge01d50cbd6ee #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2177 check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain kernel/locking/lockdep.c:3831 [inline] __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055 lock_acquire kernel/locking/lockdep.c:5668 [inline] lock_acquire+0x1df/0x630 kernel/locking/lockdep.c:5633 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1350 kernel/locking/mutex.c:747 dquot_commit+0x4d/0x560 fs/quota/dquot.c:479 ext4_write_dquot+0x24e/0x310 fs/ext4/super.c:6722 ext4_mark_dquot_dirty fs/ext4/super.c:6770 [inline] ext4_mark_dquot_dirty+0x111/0x1b0 fs/ext4/super.c:6764 mark_dquot_dirty fs/quota/dquot.c:346 [inline] mark_all_dquot_dirty fs/quota/dquot.c:384 [inline] __dquot_free_space+0x74e/0xac0 fs/quota/dquot.c:1907 dquot_free_space_nodirty include/linux/quotaops.h:379 [inline] dquot_free_space include/linux/quotaops.h:384 [inline] dquot_free_block include/linux/quotaops.h:395 [inline] ext4_mb_clear_bb fs/ext4/mballoc.c:6050 [inline] ext4_free_blocks+0x11c6/0x22f0 fs/ext4/mballoc.c:6179 ext4_remove_blocks fs/ext4/extents.c:2527 [inline] ext4_ext_rm_leaf fs/ext4/extents.c:2711 [inline] ext4_ext_remove_space+0x3486/0x46c0 fs/ext4/extents.c:2959 ext4_ext_truncate+0x33f/0x400 fs/ext4/extents.c:4417 ext4_truncate+0xf79/0x1530 fs/ext4/inode.c:4264 ext4_evict_inode+0xbd2/0x1e30 fs/ext4/inode.c:286 evict+0x2ed/0x6b0 fs/inode.c:664 iput_final fs/inode.c:1747 [inline] iput.part.0+0x59b/0x880 fs/inode.c:1773 iput+0x58/0x70 fs/inode.c:1763 dentry_unlink_inode+0x2b1/0x460 fs/dcache.c:401 __dentry_kill+0x3c0/0x640 fs/dcache.c:607 dentry_kill fs/dcache.c:745 [inline] dput+0x64d/0xdb0 fs/dcache.c:913 do_renameat2+0xb6e/0xc80 fs/namei.c:4931 __do_sys_renameat2 fs/namei.c:4962 [inline] __se_sys_renameat2 fs/namei.c:4959 [inline] __x64_sys_renameat2+0xe4/0x120 fs/namei.c:4959 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f5b2c6e2309 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:00007fff30fe5ab8 EFLAGS: 00000246 ORIG_RAX: 000000000000013c RAX: ffffffffffffffda RBX: 00007f5b2c726cb8 RCX: 00007f5b2c6e2309 RDX: 0000000000000003 RSI: 0000000020000080 RDI: 0000000000000004 RBP: 0030656c69662f2e R08: 0000000000000000 R09: 00000000200100c0 R10: 00000000200000c0 R11: 0000000000000246 R12: 0000000020000640 R13: 0000000020010ec0 R14: 0000000020000140 R15: 0000000020000040 EXT4-fs error (device loop0): ext4_free_inode:355: comm syz-executor412: bit already cleared for inode 13