EXT4-fs error (device loop0): ext4_mb_generate_buddy:1099: group 0, block bitmap and bg descriptor inconsistent: 7554 vs 23 free clusters ====================================================== WARNING: possible circular locking dependency detected 6.0.0-rc7-syzkaller-18095-gbbed346d5a96 #0 Not tainted ------------------------------------------------------ syz-executor158/3159 is trying to acquire lock: ffff0000c74889a8 (&dquot->dq_lock){+.+.}-{3:3}, at: dquot_commit+0x34/0x1e4 fs/quota/dquot.c:479 but task is already holding lock: ffff0000ca904578 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_truncate+0x52c/0x72c fs/ext4/inode.c:4252 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+0x5c/0x78 kernel/locking/rwsem.c:1499 ext4_map_blocks+0x15c/0xaec fs/ext4/inode.c:568 ext4_getblk+0xc4/0x448 fs/ext4/inode.c:858 ext4_bread+0x3c/0x164 fs/ext4/inode.c:914 ext4_quota_write+0x120/0x31c fs/ext4/super.c:6956 write_blk fs/quota/quota_tree.c:64 [inline] get_free_dqblk+0xec/0x1a0 fs/quota/quota_tree.c:93 do_insert_tree+0xdc/0x838 fs/quota/quota_tree.c:300 do_insert_tree+0x24c/0x838 fs/quota/quota_tree.c:331 do_insert_tree+0x24c/0x838 fs/quota/quota_tree.c:331 dq_insert_tree fs/quota/quota_tree.c:357 [inline] qtree_write_dquot+0x188/0x204 fs/quota/quota_tree.c:376 v2_write_dquot+0x70/0xb0 fs/quota/quota_v2.c:358 dquot_acquire+0x158/0x23c fs/quota/dquot.c:444 ext4_acquire_dquot+0xd4/0x11c fs/ext4/super.c:6612 dqget+0x44c/0x5c0 fs/quota/dquot.c:914 __dquot_initialize+0x15c/0x588 fs/quota/dquot.c:1492 dquot_initialize+0x24/0x34 fs/quota/dquot.c:1550 ext4_process_orphan+0x34/0x16c fs/ext4/orphan.c:329 ext4_orphan_cleanup+0x584/0x8ec fs/ext4/orphan.c:474 __ext4_fill_super+0x34a4/0x36d4 fs/ext4/super.c:5378 ext4_fill_super+0x100/0x2d8 fs/ext4/super.c:5517 get_tree_bdev+0x1e8/0x2a0 fs/super.c:1323 ext4_get_tree+0x28/0x38 fs/ext4/super.c:5547 vfs_get_tree+0x40/0x140 fs/super.c:1530 do_new_mount+0x1dc/0x4e4 fs/namespace.c:3040 path_mount+0x358/0x914 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] __arm64_sys_mount+0x2c4/0x3c4 fs/namespace.c:3568 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall arch/arm64/kernel/syscall.c:52 [inline] el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206 el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581 -> #1 (&s->s_dquot.dqio_sem){++++}-{3:3}: down_read+0x5c/0x78 kernel/locking/rwsem.c:1499 v2_read_dquot+0x28/0x64 fs/quota/quota_v2.c:332 dquot_acquire+0x74/0x23c fs/quota/dquot.c:435 ext4_acquire_dquot+0xd4/0x11c fs/ext4/super.c:6612 dqget+0x44c/0x5c0 fs/quota/dquot.c:914 __dquot_initialize+0x1b8/0x588 fs/quota/dquot.c:1492 dquot_initialize+0x24/0x34 fs/quota/dquot.c:1550 ext4_process_orphan+0x34/0x16c fs/ext4/orphan.c:329 ext4_orphan_cleanup+0x584/0x8ec fs/ext4/orphan.c:474 __ext4_fill_super+0x34a4/0x36d4 fs/ext4/super.c:5378 ext4_fill_super+0x100/0x2d8 fs/ext4/super.c:5517 get_tree_bdev+0x1e8/0x2a0 fs/super.c:1323 ext4_get_tree+0x28/0x38 fs/ext4/super.c:5547 vfs_get_tree+0x40/0x140 fs/super.c:1530 do_new_mount+0x1dc/0x4e4 fs/namespace.c:3040 path_mount+0x358/0x914 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] __arm64_sys_mount+0x2c4/0x3c4 fs/namespace.c:3568 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall arch/arm64/kernel/syscall.c:52 [inline] el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206 el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581 -> #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 kernel/locking/lockdep.c:3829 [inline] __lock_acquire+0x1530/0x30a4 kernel/locking/lockdep.c:5053 lock_acquire+0x100/0x1f8 kernel/locking/lockdep.c:5666 __mutex_lock_common+0xd4/0xca8 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799 dquot_commit+0x34/0x1e4 fs/quota/dquot.c:479 ext4_write_dquot fs/ext4/super.c:6596 [inline] ext4_mark_dquot_dirty+0xdc/0x148 fs/ext4/super.c:6644 mark_dquot_dirty fs/quota/dquot.c:346 [inline] mark_all_dquot_dirty fs/quota/dquot.c:384 [inline] __dquot_free_space+0x374/0x594 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+0xa84/0xd90 fs/ext4/mballoc.c:6051 ext4_free_blocks+0x5c8/0x638 fs/ext4/mballoc.c:6180 ext4_remove_blocks fs/ext4/extents.c:2524 [inline] ext4_ext_rm_leaf+0xb54/0x10c4 fs/ext4/extents.c:2708 ext4_ext_remove_space+0x404/0xacc fs/ext4/extents.c:2956 ext4_ext_truncate+0xd4/0x144 fs/ext4/extents.c:4416 ext4_truncate+0x620/0x72c fs/ext4/inode.c:4257 ext4_evict_inode+0x67c/0x7ec fs/ext4/inode.c:286 evict+0xec/0x334 fs/inode.c:665 iput_final fs/inode.c:1748 [inline] iput+0x2c4/0x324 fs/inode.c:1774 dentry_unlink_inode+0x204/0x21c fs/dcache.c:401 __dentry_kill+0x15c/0x37c fs/dcache.c:607 dentry_kill+0x8c/0x194 dput+0x194/0x2e0 fs/dcache.c:913 do_renameat2+0x49c/0x758 fs/namei.c:4909 __do_sys_renameat2 fs/namei.c:4940 [inline] __se_sys_renameat2 fs/namei.c:4937 [inline] __arm64_sys_renameat2+0x6c/0x88 fs/namei.c:4937 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall arch/arm64/kernel/syscall.c:52 [inline] el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206 el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581 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-executor158/3159: #0: ffff0000c907f460 (sb_writers#3){.+.+}-{0:0}, at: mnt_want_write+0x20/0x64 fs/namespace.c:393 #1: ffff0000ca901720 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:791 [inline] #1: ffff0000ca901720 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: lock_rename+0x84/0xec fs/namei.c:2990 #2: ffff0000c907f650 (sb_internal){.+.+}-{0:0}, at: __sb_start_write include/linux/fs.h:1826 [inline] #2: ffff0000c907f650 (sb_internal){.+.+}-{0:0}, at: sb_start_intwrite include/linux/fs.h:1948 [inline] #2: ffff0000c907f650 (sb_internal){.+.+}-{0:0}, at: ext4_evict_inode+0x22c/0x7ec fs/ext4/inode.c:240 #3: ffff0000ca904578 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_truncate+0x52c/0x72c fs/ext4/inode.c:4252 #4: ffff80000d47ee98 (dquot_srcu){....}-{0:0}, at: rcu_lock_acquire+0x10/0x4c include/linux/rcupdate.h:279 stack backtrace: CPU: 0 PID: 3159 Comm: syz-executor158 Not tainted 6.0.0-rc7-syzkaller-18095-gbbed346d5a96 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/30/2022 Call trace: dump_backtrace+0x1c4/0x1f0 arch/arm64/kernel/stacktrace.c:156 show_stack+0x2c/0x54 arch/arm64/kernel/stacktrace.c:163 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x104/0x16c lib/dump_stack.c:106 dump_stack+0x1c/0x58 lib/dump_stack.c:113 print_circular_bug+0x2c4/0x2c8 kernel/locking/lockdep.c:2053 check_noncircular+0x14c/0x154 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 kernel/locking/lockdep.c:3829 [inline] __lock_acquire+0x1530/0x30a4 kernel/locking/lockdep.c:5053 lock_acquire+0x100/0x1f8 kernel/locking/lockdep.c:5666 __mutex_lock_common+0xd4/0xca8 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799 dquot_commit+0x34/0x1e4 fs/quota/dquot.c:479 ext4_write_dquot fs/ext4/super.c:6596 [inline] ext4_mark_dquot_dirty+0xdc/0x148 fs/ext4/super.c:6644 mark_dquot_dirty fs/quota/dquot.c:346 [inline] mark_all_dquot_dirty fs/quota/dquot.c:384 [inline] __dquot_free_space+0x374/0x594 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+0xa84/0xd90 fs/ext4/mballoc.c:6051 ext4_free_blocks+0x5c8/0x638 fs/ext4/mballoc.c:6180 ext4_remove_blocks fs/ext4/extents.c:2524 [inline] ext4_ext_rm_leaf+0xb54/0x10c4 fs/ext4/extents.c:2708 ext4_ext_remove_space+0x404/0xacc fs/ext4/extents.c:2956 ext4_ext_truncate+0xd4/0x144 fs/ext4/extents.c:4416 ext4_truncate+0x620/0x72c fs/ext4/inode.c:4257 ext4_evict_inode+0x67c/0x7ec fs/ext4/inode.c:286 evict+0xec/0x334 fs/inode.c:665 iput_final fs/inode.c:1748 [inline] iput+0x2c4/0x324 fs/inode.c:1774 dentry_unlink_inode+0x204/0x21c fs/dcache.c:401 __dentry_kill+0x15c/0x37c fs/dcache.c:607 dentry_kill+0x8c/0x194 dput+0x194/0x2e0 fs/dcache.c:913 do_renameat2+0x49c/0x758 fs/namei.c:4909 __do_sys_renameat2 fs/namei.c:4940 [inline] __se_sys_renameat2 fs/namei.c:4937 [inline] __arm64_sys_renameat2+0x6c/0x88 fs/namei.c:4937 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall arch/arm64/kernel/syscall.c:52 [inline] el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206 el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581 EXT4-fs error (device loop0): ext4_free_inode:355: comm syz-executor158: bit already cleared for inode 13