EXT4-fs warning (device loop4): ext4_empty_dir:3013: inode #12: comm syz-executor.4: directory missing '.' EXT4-fs warning (device loop5): ext4_empty_dir:3013: inode #12: comm syz-executor.5: directory missing '.' ====================================================== WARNING: possible circular locking dependency detected 5.16.0-rc5-next-20211213 #1 Not tainted ------------------------------------------------------ syz-executor.5/24147 is trying to acquire lock: ffff88802cf08b28 (&dquot->dq_lock){+.+.}-{3:3}, at: dquot_commit+0x4d/0x380 fs/quota/dquot.c:474 but task is already holding lock: ffff88802cebb388 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_truncate+0x74e/0x1330 fs/ext4/inode.c:4196 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/0x440 kernel/locking/rwsem.c:1461 ext4_map_blocks+0x380/0x18d0 fs/ext4/inode.c:560 ext4_getblk+0x144/0x6b0 fs/ext4/inode.c:847 ext4_bread+0x2a/0x1c0 fs/ext4/inode.c:900 ext4_quota_write+0x237/0x640 fs/ext4/super.c:6973 write_blk+0x10c/0x200 fs/quota/quota_tree.c:64 get_free_dqblk+0x104/0x2c0 fs/quota/quota_tree.c:93 do_insert_tree+0x63a/0x11d0 fs/quota/quota_tree.c:300 do_insert_tree+0xd71/0x11d0 fs/quota/quota_tree.c:331 do_insert_tree+0x6fd/0x11d0 fs/quota/quota_tree.c:331 do_insert_tree+0x6fd/0x11d0 fs/quota/quota_tree.c:331 dq_insert_tree fs/quota/quota_tree.c:357 [inline] qtree_write_dquot+0x3b8/0x580 fs/quota/quota_tree.c:376 v2_write_dquot+0x11c/0x250 fs/quota/quota_v2.c:358 dquot_acquire+0x2cf/0x570 fs/quota/dquot.c:441 ext4_acquire_dquot+0x240/0x340 fs/ext4/super.c:6642 dqget+0x623/0xf10 fs/quota/dquot.c:899 __dquot_initialize+0x3c3/0xb80 fs/quota/dquot.c:1477 ext4_rmdir+0x12b/0xf60 fs/ext4/namei.c:3070 vfs_rmdir.part.0+0x1af/0x550 fs/namei.c:4019 vfs_rmdir fs/namei.c:4004 [inline] do_rmdir+0x333/0x400 fs/namei.c:4081 __do_sys_rmdir fs/namei.c:4100 [inline] __se_sys_rmdir fs/namei.c:4098 [inline] __x64_sys_rmdir+0xc6/0x110 fs/namei.c:4098 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #1 (&s->s_dquot.dqio_sem){++++}-{3:3}: down_read+0x98/0x440 kernel/locking/rwsem.c:1461 v2_read_dquot+0x49/0x120 fs/quota/quota_v2.c:332 dquot_acquire+0x133/0x570 fs/quota/dquot.c:432 ext4_acquire_dquot+0x240/0x340 fs/ext4/super.c:6642 dqget+0x623/0xf10 fs/quota/dquot.c:899 __dquot_initialize+0x3c3/0xb80 fs/quota/dquot.c:1477 ext4_xattr_set+0xbd/0x340 fs/ext4/xattr.c:2464 __vfs_setxattr+0x115/0x180 fs/xattr.c:180 __vfs_setxattr_noperm+0x125/0x5f0 fs/xattr.c:214 __vfs_setxattr_locked+0x1cf/0x260 fs/xattr.c:275 vfs_setxattr+0x13f/0x330 fs/xattr.c:301 setxattr+0x218/0x2b0 fs/xattr.c:575 path_setxattr+0x197/0x1c0 fs/xattr.c:595 __do_sys_lsetxattr fs/xattr.c:618 [inline] __se_sys_lsetxattr fs/xattr.c:614 [inline] __x64_sys_lsetxattr+0xbd/0x150 fs/xattr.c:614 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0x90 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:3063 [inline] check_prevs_add kernel/locking/lockdep.c:3186 [inline] validate_chain kernel/locking/lockdep.c:3801 [inline] __lock_acquire+0x2a14/0x5b70 kernel/locking/lockdep.c:5027 lock_acquire kernel/locking/lockdep.c:5639 [inline] lock_acquire+0x1a2/0x4d0 kernel/locking/lockdep.c:5604 __mutex_lock_common kernel/locking/mutex.c:600 [inline] __mutex_lock+0x136/0x1480 kernel/locking/mutex.c:733 dquot_commit+0x4d/0x380 fs/quota/dquot.c:474 ext4_write_dquot+0x243/0x2f0 fs/ext4/super.c:6626 ext4_mark_dquot_dirty fs/ext4/super.c:6674 [inline] ext4_mark_dquot_dirty+0x111/0x1b0 fs/ext4/super.c:6668 mark_dquot_dirty fs/quota/dquot.c:345 [inline] mark_all_dquot_dirty fs/quota/dquot.c:383 [inline] __dquot_free_space+0x736/0xa50 fs/quota/dquot.c:1892 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+0x1ada/0x2170 fs/ext4/mballoc.c:6084 ext4_remove_blocks fs/ext4/extents.c:2523 [inline] ext4_ext_rm_leaf fs/ext4/extents.c:2707 [inline] ext4_ext_remove_space+0x309c/0x40b0 fs/ext4/extents.c:2955 ext4_ext_truncate+0x324/0x3e0 fs/ext4/extents.c:4416 ext4_truncate+0xddb/0x1330 fs/ext4/inode.c:4201 ext4_evict_inode+0xa19/0x1890 fs/ext4/inode.c:287 evict+0x284/0x610 fs/inode.c:664 iput_final fs/inode.c:1744 [inline] iput.part.0+0x4ec/0x7f0 fs/inode.c:1770 iput+0x58/0x70 fs/inode.c:1760 dentry_unlink_inode+0x2b4/0x460 fs/dcache.c:401 d_delete fs/dcache.c:2530 [inline] d_delete+0x16b/0x1c0 fs/dcache.c:2519 vfs_rmdir.part.0+0x441/0x550 fs/namei.c:4033 vfs_rmdir fs/namei.c:4004 [inline] do_rmdir+0x333/0x400 fs/namei.c:4081 __do_sys_rmdir fs/namei.c:4100 [inline] __se_sys_rmdir fs/namei.c:4098 [inline] __x64_sys_rmdir+0xc6/0x110 fs/namei.c:4098 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0x90 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.5/24147: #0: ffff88803665e438 (sb_writers#3){.+.+}-{0:0}, at: do_rmdir+0x1d0/0x400 fs/namei.c:4064 #1: ffff88802ce548a0 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:812 [inline] #1: ffff88802ce548a0 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: do_rmdir+0x219/0x400 fs/namei.c:4068 #2: ffff88803665e628 (sb_internal){.+.+}-{0:0}, at: evict+0x284/0x610 fs/inode.c:664 #3: ffff88802cebb388 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_truncate+0x74e/0x1330 fs/ext4/inode.c:4196 #4: ffffffff852ec360 (dquot_srcu){....}-{0:0}, at: i_dquot fs/quota/dquot.c:924 [inline] #4: ffffffff852ec360 (dquot_srcu){....}-{0:0}, at: __dquot_free_space+0x190/0xa50 fs/quota/dquot.c:1865 stack backtrace: CPU: 1 PID: 24147 Comm: syz-executor.5 Not tainted 5.16.0-rc5-next-20211213 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x8b/0xb3 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2143 check_prev_add kernel/locking/lockdep.c:3063 [inline] check_prevs_add kernel/locking/lockdep.c:3186 [inline] validate_chain kernel/locking/lockdep.c:3801 [inline] __lock_acquire+0x2a14/0x5b70 kernel/locking/lockdep.c:5027 lock_acquire kernel/locking/lockdep.c:5639 [inline] lock_acquire+0x1a2/0x4d0 kernel/locking/lockdep.c:5604 __mutex_lock_common kernel/locking/mutex.c:600 [inline] __mutex_lock+0x136/0x1480 kernel/locking/mutex.c:733 dquot_commit+0x4d/0x380 fs/quota/dquot.c:474 ext4_write_dquot+0x243/0x2f0 fs/ext4/super.c:6626 ext4_mark_dquot_dirty fs/ext4/super.c:6674 [inline] ext4_mark_dquot_dirty+0x111/0x1b0 fs/ext4/super.c:6668 mark_dquot_dirty fs/quota/dquot.c:345 [inline] mark_all_dquot_dirty fs/quota/dquot.c:383 [inline] __dquot_free_space+0x736/0xa50 fs/quota/dquot.c:1892 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+0x1ada/0x2170 fs/ext4/mballoc.c:6084 ext4_remove_blocks fs/ext4/extents.c:2523 [inline] ext4_ext_rm_leaf fs/ext4/extents.c:2707 [inline] ext4_ext_remove_space+0x309c/0x40b0 fs/ext4/extents.c:2955 ext4_ext_truncate+0x324/0x3e0 fs/ext4/extents.c:4416 ext4_truncate+0xddb/0x1330 fs/ext4/inode.c:4201 ext4_evict_inode+0xa19/0x1890 fs/ext4/inode.c:287 evict+0x284/0x610 fs/inode.c:664 iput_final fs/inode.c:1744 [inline] iput.part.0+0x4ec/0x7f0 fs/inode.c:1770 iput+0x58/0x70 fs/inode.c:1760 dentry_unlink_inode+0x2b4/0x460 fs/dcache.c:401 d_delete fs/dcache.c:2530 [inline] d_delete+0x16b/0x1c0 fs/dcache.c:2519 vfs_rmdir.part.0+0x441/0x550 fs/namei.c:4033 vfs_rmdir fs/namei.c:4004 [inline] do_rmdir+0x333/0x400 fs/namei.c:4081 __do_sys_rmdir fs/namei.c:4100 [inline] __se_sys_rmdir fs/namei.c:4098 [inline] __x64_sys_rmdir+0xc6/0x110 fs/namei.c:4098 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f6f7455eb19 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:00007f6f71ad4188 EFLAGS: 00000246 ORIG_RAX: 0000000000000054 RAX: ffffffffffffffda RBX: 00007f6f74671f60 RCX: 00007f6f7455eb19 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000000 RBP: 00007f6f745b8f6d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc0a6163ef R14: 00007f6f71ad4300 R15: 0000000000022000 loop3: detected capacity change from 0 to 1024 EXT4-fs (loop3): mounted filesystem without journal. Quota mode: writeback. EXT4-fs error (device loop3): ext4_empty_dir:3010: inode #12: block 80: comm syz-executor.3: bad entry in directory: rec_len is smaller than minimal - offset=0, inode=0, rec_len=0, size=1024 fake=0 EXT4-fs warning (device loop3): ext4_empty_dir:3013: inode #12: comm syz-executor.3: directory missing '.' loop6: detected capacity change from 0 to 1024 loop4: detected capacity change from 0 to 1024 loop7: detected capacity change from 0 to 1024 loop5: detected capacity change from 0 to 1024 loop3: detected capacity change from 0 to 1024 EXT4-fs warning (device loop6): ext4_enable_quotas:6846: Failed to enable quota tracking (type=1, err=-22). Please run e2fsck to fix. EXT4-fs (loop7): mounted filesystem without journal. Quota mode: writeback. EXT4-fs (loop4): mounted filesystem without journal. Quota mode: writeback. EXT4-fs (loop6): mount failed EXT4-fs (loop5): mounted filesystem without journal. Quota mode: writeback. EXT4-fs (loop3): mounted filesystem without journal. Quota mode: writeback. EXT4-fs error (device loop4): ext4_empty_dir:3010: inode #12: block 80: comm syz-executor.4: bad entry in directory: rec_len is smaller than minimal - offset=0, inode=0, rec_len=0, size=1024 fake=0 EXT4-fs error (device loop7): ext4_empty_dir:3010: inode #12: block 80: comm syz-executor.7: bad entry in directory: rec_len is smaller than minimal - offset=0, inode=0, rec_len=0, size=1024 fake=0 EXT4-fs warning (device loop4): ext4_empty_dir:3013: inode #12: comm syz-executor.4: directory missing '.' EXT4-fs error (device loop5): ext4_empty_dir:3010: inode #12: block 80: comm syz-executor.5: bad entry in directory: rec_len is smaller than minimal - offset=0, inode=0, rec_len=0, size=1024 fake=0 EXT4-fs warning (device loop7): ext4_empty_dir:3013: inode #12: comm syz-executor.7: directory missing '.' EXT4-fs error (device loop3): ext4_empty_dir:3010: inode #12: block 80: comm syz-executor.3: bad entry in directory: rec_len is smaller than minimal - offset=0, inode=0, rec_len=0, size=1024 fake=0 EXT4-fs warning (device loop5): ext4_empty_dir:3013: inode #12: comm syz-executor.5: directory missing '.' EXT4-fs warning (device loop3): ext4_empty_dir:3013: inode #12: comm syz-executor.3: directory missing '.' loop7: detected capacity change from 0 to 1024