loop0: detected capacity change from 1024 to 0 EXT4-fs error (device loop0): ext4_mb_generate_buddy:802: group 0, block bitmap and bg descriptor inconsistent: 7554 vs 23 free clusters ====================================================== WARNING: possible circular locking dependency detected 5.11.0-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/9296 is trying to acquire lock: ffff888034cc4428 (&dquot->dq_lock){+.+.}-{3:3}, at: dquot_commit+0x48/0x390 fs/quota/dquot.c:476 but task is already holding lock: ffff88802f33c878 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_truncate+0x4bb/0x10c0 fs/ext4/inode.c:4258 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+0x95/0x440 kernel/locking/rwsem.c:1353 ext4_map_blocks+0x2d1/0x1340 fs/ext4/inode.c:560 ext4_getblk+0x111/0x550 fs/ext4/inode.c:847 ext4_bread+0x8/0x160 fs/ext4/inode.c:899 ext4_quota_write+0x21d/0x590 fs/ext4/super.c:6557 write_blk+0x108/0x1e0 fs/quota/quota_tree.c:73 get_free_dqblk+0xe4/0x270 fs/quota/quota_tree.c:102 do_insert_tree+0x460/0xed0 fs/quota/quota_tree.c:309 do_insert_tree+0xc28/0xed0 fs/quota/quota_tree.c:340 do_insert_tree+0x4f0/0xed0 fs/quota/quota_tree.c:340 dq_insert_tree fs/quota/quota_tree.c:366 [inline] qtree_write_dquot+0x360/0x4f0 fs/quota/quota_tree.c:385 v2_write_dquot+0x105/0x230 fs/quota/quota_v2.c:353 dquot_acquire+0x25b/0x500 fs/quota/dquot.c:443 ext4_acquire_dquot+0x23c/0x360 fs/ext4/super.c:6216 dqget+0x55a/0xeb0 fs/quota/dquot.c:901 __dquot_initialize+0x416/0x1060 fs/quota/dquot.c:1479 ext4_orphan_cleanup fs/ext4/super.c:3077 [inline] ext4_fill_super+0x7467/0xbc40 fs/ext4/super.c:5049 mount_bdev+0x2cb/0x3b0 fs/super.c:1366 legacy_get_tree+0xfa/0x1f0 fs/fs_context.c:592 vfs_get_tree+0x7f/0x2c0 fs/super.c:1496 do_new_mount fs/namespace.c:2881 [inline] path_mount+0x7f3/0x1b30 fs/namespace.c:3211 do_mount fs/namespace.c:3224 [inline] __do_sys_mount fs/namespace.c:3432 [inline] __se_sys_mount fs/namespace.c:3409 [inline] __x64_sys_mount+0x1f5/0x260 fs/namespace.c:3409 do_syscall_64+0x2d/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 -> #1 (&s->s_dquot.dqio_sem){++++}-{3:3}: down_read+0x95/0x440 kernel/locking/rwsem.c:1353 v2_read_dquot+0x44/0x110 fs/quota/quota_v2.c:327 dquot_acquire+0x111/0x500 fs/quota/dquot.c:434 ext4_acquire_dquot+0x23c/0x360 fs/ext4/super.c:6216 dqget+0x55a/0xeb0 fs/quota/dquot.c:901 __dquot_initialize+0x416/0x1060 fs/quota/dquot.c:1479 ext4_orphan_cleanup fs/ext4/super.c:3077 [inline] ext4_fill_super+0x7467/0xbc40 fs/ext4/super.c:5049 mount_bdev+0x2cb/0x3b0 fs/super.c:1366 legacy_get_tree+0xfa/0x1f0 fs/fs_context.c:592 vfs_get_tree+0x7f/0x2c0 fs/super.c:1496 do_new_mount fs/namespace.c:2881 [inline] path_mount+0x7f3/0x1b30 fs/namespace.c:3211 do_mount fs/namespace.c:3224 [inline] __do_sys_mount fs/namespace.c:3432 [inline] __se_sys_mount fs/namespace.c:3409 [inline] __x64_sys_mount+0x1f5/0x260 fs/namespace.c:3409 do_syscall_64+0x2d/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 -> #0 (&dquot->dq_lock){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:2868 [inline] check_prevs_add kernel/locking/lockdep.c:2993 [inline] validate_chain kernel/locking/lockdep.c:3608 [inline] __lock_acquire+0x2b2a/0x5500 kernel/locking/lockdep.c:4832 lock_acquire kernel/locking/lockdep.c:5442 [inline] lock_acquire+0x1a8/0x720 kernel/locking/lockdep.c:5407 __mutex_lock_common kernel/locking/mutex.c:956 [inline] __mutex_lock+0x134/0x1110 kernel/locking/mutex.c:1103 dquot_commit+0x48/0x390 fs/quota/dquot.c:476 ext4_write_dquot+0x201/0x2d0 fs/ext4/super.c:6200 mark_dquot_dirty fs/quota/dquot.c:347 [inline] mark_all_dquot_dirty fs/quota/dquot.c:385 [inline] __dquot_free_space+0x5fb/0x910 fs/quota/dquot.c:1894 dquot_free_space_nodirty include/linux/quotaops.h:376 [inline] dquot_free_space include/linux/quotaops.h:381 [inline] dquot_free_block include/linux/quotaops.h:392 [inline] ext4_free_blocks+0x952/0x16f0 fs/ext4/mballoc.c:5472 ext4_remove_blocks fs/ext4/extents.c:2480 [inline] ext4_ext_rm_leaf fs/ext4/extents.c:2664 [inline] ext4_ext_remove_space+0x2b4c/0x3fe0 fs/ext4/extents.c:2912 ext4_ext_truncate+0x19e/0x210 fs/ext4/extents.c:4370 ext4_truncate+0x7fe/0x10c0 fs/ext4/inode.c:4263 ext4_evict_inode+0x7fe/0x1560 fs/ext4/inode.c:287 evict+0x296/0x5d0 fs/inode.c:577 __dentry_kill+0x315/0x550 fs/dcache.c:579 dentry_kill fs/dcache.c:705 [inline] dput+0x410/0x880 fs/dcache.c:885 do_renameat2+0x534/0x980 fs/namei.c:4461 __do_sys_renameat2 fs/namei.c:4495 [inline] __se_sys_renameat2 fs/namei.c:4492 [inline] __x64_sys_renameat2+0xdf/0x120 fs/namei.c:4492 do_syscall_64+0x2d/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 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/9296: #0: ffff88802a0a2460 (sb_writers#5){.+.+}-{0:0}, at: do_renameat2+0x2ae/0x980 fs/namei.c:4402 #1: ffff88802f338e88 (&type->i_mutex_dir_key#4/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:808 [inline] #1: ffff88802f338e88 (&type->i_mutex_dir_key#4/1){+.+.}-{3:3}, at: lock_rename+0x1de/0x230 fs/namei.c:2758 #2: ffff88802a0a2650 (sb_internal){.+.+}-{0:0}, at: evict+0x296/0x5d0 fs/inode.c:577 #3: ffff88802f33c878 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_truncate+0x4bb/0x10c0 fs/ext4/inode.c:4258 #4: ffffffff8a90a238 (dquot_srcu){....}-{0:0}, at: i_dquot fs/quota/dquot.c:926 [inline] #4: ffffffff8a90a238 (dquot_srcu){....}-{0:0}, at: __dquot_free_space+0x163/0x910 fs/quota/dquot.c:1867 stack backtrace: CPU: 0 PID: 9296 Comm: syz-executor.0 Not tainted 5.11.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x9a/0xcc lib/dump_stack.c:120 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2117 check_prev_add kernel/locking/lockdep.c:2868 [inline] check_prevs_add kernel/locking/lockdep.c:2993 [inline] validate_chain kernel/locking/lockdep.c:3608 [inline] __lock_acquire+0x2b2a/0x5500 kernel/locking/lockdep.c:4832 lock_acquire kernel/locking/lockdep.c:5442 [inline] lock_acquire+0x1a8/0x720 kernel/locking/lockdep.c:5407 __mutex_lock_common kernel/locking/mutex.c:956 [inline] __mutex_lock+0x134/0x1110 kernel/locking/mutex.c:1103 dquot_commit+0x48/0x390 fs/quota/dquot.c:476 ext4_write_dquot+0x201/0x2d0 fs/ext4/super.c:6200 mark_dquot_dirty fs/quota/dquot.c:347 [inline] mark_all_dquot_dirty fs/quota/dquot.c:385 [inline] __dquot_free_space+0x5fb/0x910 fs/quota/dquot.c:1894 dquot_free_space_nodirty include/linux/quotaops.h:376 [inline] dquot_free_space include/linux/quotaops.h:381 [inline] dquot_free_block include/linux/quotaops.h:392 [inline] ext4_free_blocks+0x952/0x16f0 fs/ext4/mballoc.c:5472 ext4_remove_blocks fs/ext4/extents.c:2480 [inline] ext4_ext_rm_leaf fs/ext4/extents.c:2664 [inline] ext4_ext_remove_space+0x2b4c/0x3fe0 fs/ext4/extents.c:2912 ext4_ext_truncate+0x19e/0x210 fs/ext4/extents.c:4370 ext4_truncate+0x7fe/0x10c0 fs/ext4/inode.c:4263 ext4_evict_inode+0x7fe/0x1560 fs/ext4/inode.c:287 evict+0x296/0x5d0 fs/inode.c:577 __dentry_kill+0x315/0x550 fs/dcache.c:579 dentry_kill fs/dcache.c:705 [inline] dput+0x410/0x880 fs/dcache.c:885 do_renameat2+0x534/0x980 fs/namei.c:4461 __do_sys_renameat2 fs/namei.c:4495 [inline] __se_sys_renameat2 fs/namei.c:4492 [inline] __x64_sys_renameat2+0xdf/0x120 fs/namei.c:4492 do_syscall_64+0x2d/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7fd663220639 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:00007fd662593168 EFLAGS: 00000246 ORIG_RAX: 000000000000013c RAX: ffffffffffffffda RBX: 00007fd663340f80 RCX: 00007fd663220639 RDX: 0000000000000003 RSI: 0000000020000080 RDI: 0000000000000004 RBP: 00007fd66327bae9 R08: 0000000000000000 R09: 0000000000000000 R10: 00000000200000c0 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe71719d1f R14: 00007fd662593300 R15: 0000000000022000 EXT4-fs error (device loop0): ext4_free_inode:351: comm syz-executor.0: bit already cleared for inode 13