====================================================== WARNING: possible circular locking dependency detected 6.12.0-rc6-syzkaller-g8936d33c1f69 #0 Not tainted ------------------------------------------------------ syz.3.265/8172 is trying to acquire lock: ffff0000f1d6df40 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:815 [inline] ffff0000f1d6df40 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]){+.+.}-{3:3}, at: ocfs2_del_inode_from_orphan+0x134/0x74c fs/ocfs2/namei.c:2726 but task is already holding lock: ffff0000ef5a3f60 (&ocfs2_quota_ip_alloc_sem_key){++++}-{3:3}, at: ocfs2_dio_end_io_write fs/ocfs2/aops.c:2321 [inline] ffff0000ef5a3f60 (&ocfs2_quota_ip_alloc_sem_key){++++}-{3:3}, at: ocfs2_dio_end_io+0x3c0/0x105c fs/ocfs2/aops.c:2427 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&ocfs2_quota_ip_alloc_sem_key){++++}-{3:3}: down_write+0x50/0xc0 kernel/locking/rwsem.c:1577 ocfs2_create_local_dquot+0x1a0/0x1778 fs/ocfs2/quota_local.c:1231 ocfs2_acquire_dquot+0x6fc/0xa8c fs/ocfs2/quota_global.c:878 dqget+0x660/0xcec fs/quota/dquot.c:976 __dquot_initialize+0x344/0xc04 fs/quota/dquot.c:1504 dquot_initialize+0x24/0x34 fs/quota/dquot.c:1566 ocfs2_get_init_inode+0x14c/0x1b8 fs/ocfs2/namei.c:202 ocfs2_mknod+0x878/0x243c fs/ocfs2/namei.c:308 ocfs2_mkdir+0x194/0x4e0 fs/ocfs2/namei.c:655 vfs_mkdir+0x27c/0x410 fs/namei.c:4257 do_mkdirat+0x248/0x574 fs/namei.c:4280 __do_sys_mkdirat fs/namei.c:4295 [inline] __se_sys_mkdirat fs/namei.c:4293 [inline] __arm64_sys_mkdirat+0x8c/0xa4 fs/namei.c:4293 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 -> #2 (&dquot->dq_lock){+.+.}-{3:3}: __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:608 __mutex_lock kernel/locking/mutex.c:752 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:804 wait_on_dquot fs/quota/dquot.c:355 [inline] dqget+0x5f0/0xcec fs/quota/dquot.c:971 __dquot_initialize+0x344/0xc04 fs/quota/dquot.c:1504 dquot_initialize+0x24/0x34 fs/quota/dquot.c:1566 ocfs2_get_init_inode+0x14c/0x1b8 fs/ocfs2/namei.c:202 ocfs2_mknod+0x878/0x243c fs/ocfs2/namei.c:308 ocfs2_mkdir+0x194/0x4e0 fs/ocfs2/namei.c:655 vfs_mkdir+0x27c/0x410 fs/namei.c:4257 do_mkdirat+0x248/0x574 fs/namei.c:4280 __do_sys_mkdirat fs/namei.c:4295 [inline] __se_sys_mkdirat fs/namei.c:4293 [inline] __arm64_sys_mkdirat+0x8c/0xa4 fs/namei.c:4293 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 -> #1 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#4){+.+.}-{3:3}: down_write+0x50/0xc0 kernel/locking/rwsem.c:1577 inode_lock include/linux/fs.h:815 [inline] ocfs2_remove_inode fs/ocfs2/inode.c:655 [inline] ocfs2_wipe_inode fs/ocfs2/inode.c:818 [inline] ocfs2_delete_inode fs/ocfs2/inode.c:1079 [inline] ocfs2_evict_inode+0x1f90/0x468c fs/ocfs2/inode.c:1216 evict+0x444/0x978 fs/inode.c:725 iput_final fs/inode.c:1877 [inline] iput+0x744/0x8ec fs/inode.c:1903 d_delete_notify include/linux/fsnotify.h:332 [inline] vfs_rmdir+0x35c/0x468 fs/namei.c:4353 do_rmdir+0x2e0/0x720 fs/namei.c:4399 __do_sys_unlinkat fs/namei.c:4575 [inline] __se_sys_unlinkat fs/namei.c:4569 [inline] __arm64_sys_unlinkat+0xdc/0xf8 fs/namei.c:4569 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 -> #0 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x33f8/0x77c8 kernel/locking/lockdep.c:5202 lock_acquire+0x240/0x728 kernel/locking/lockdep.c:5825 down_write+0x50/0xc0 kernel/locking/rwsem.c:1577 inode_lock include/linux/fs.h:815 [inline] ocfs2_del_inode_from_orphan+0x134/0x74c fs/ocfs2/namei.c:2726 ocfs2_dio_end_io_write fs/ocfs2/aops.c:2329 [inline] ocfs2_dio_end_io+0x48c/0x105c fs/ocfs2/aops.c:2427 dio_complete+0x234/0x660 fs/direct-io.c:281 __blockdev_direct_IO+0x30a4/0x3940 fs/direct-io.c:1303 ocfs2_direct_IO+0x210/0x280 fs/ocfs2/aops.c:2464 generic_file_direct_write+0x15c/0x30c mm/filemap.c:3977 __generic_file_write_iter+0x110/0x204 mm/filemap.c:4141 ocfs2_file_write_iter+0x1520/0x1e10 fs/ocfs2/file.c:2467 new_sync_write fs/read_write.c:590 [inline] vfs_write+0x920/0xcf4 fs/read_write.c:683 ksys_write+0x15c/0x26c fs/read_write.c:736 __do_sys_write fs/read_write.c:748 [inline] __se_sys_write fs/read_write.c:745 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:745 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 other info that might help us debug this: Chain exists of: &ocfs2_sysfile_lock_key[args->fi_sysfile_type] --> &dquot->dq_lock --> &ocfs2_quota_ip_alloc_sem_key Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&ocfs2_quota_ip_alloc_sem_key); lock(&dquot->dq_lock); lock(&ocfs2_quota_ip_alloc_sem_key); lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]); *** DEADLOCK *** 4 locks held by syz.3.265/8172: #0: ffff0000d92937b8 (&f->f_pos_lock){+.+.}-{3:3}, at: fdget_pos+0x214/0x2a0 fs/file.c:1160 #1: ffff0000f62c0420 (sb_writers#23){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2931 [inline] #1: ffff0000f62c0420 (sb_writers#23){.+.+}-{0:0}, at: vfs_write+0x354/0xcf4 fs/read_write.c:679 #2: ffff0000ef5a42c0 (&sb->s_type->i_mutex_key#29){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:815 [inline] #2: ffff0000ef5a42c0 (&sb->s_type->i_mutex_key#29){+.+.}-{3:3}, at: ocfs2_file_write_iter+0x390/0x1e10 fs/ocfs2/file.c:2399 #3: ffff0000ef5a3f60 (&ocfs2_quota_ip_alloc_sem_key){++++}-{3:3}, at: ocfs2_dio_end_io_write fs/ocfs2/aops.c:2321 [inline] #3: ffff0000ef5a3f60 (&ocfs2_quota_ip_alloc_sem_key){++++}-{3:3}, at: ocfs2_dio_end_io+0x3c0/0x105c fs/ocfs2/aops.c:2427 stack backtrace: CPU: 0 UID: 0 PID: 8172 Comm: syz.3.265 Not tainted 6.12.0-rc6-syzkaller-g8936d33c1f69 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:484 (C) __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:120 dump_stack+0x1c/0x28 lib/dump_stack.c:129 print_circular_bug+0x154/0x1c0 kernel/locking/lockdep.c:2074 check_noncircular+0x310/0x404 kernel/locking/lockdep.c:2206 check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x33f8/0x77c8 kernel/locking/lockdep.c:5202 lock_acquire+0x240/0x728 kernel/locking/lockdep.c:5825 down_write+0x50/0xc0 kernel/locking/rwsem.c:1577 inode_lock include/linux/fs.h:815 [inline] ocfs2_del_inode_from_orphan+0x134/0x74c fs/ocfs2/namei.c:2726 ocfs2_dio_end_io_write fs/ocfs2/aops.c:2329 [inline] ocfs2_dio_end_io+0x48c/0x105c fs/ocfs2/aops.c:2427 dio_complete+0x234/0x660 fs/direct-io.c:281 __blockdev_direct_IO+0x30a4/0x3940 fs/direct-io.c:1303 ocfs2_direct_IO+0x210/0x280 fs/ocfs2/aops.c:2464 generic_file_direct_write+0x15c/0x30c mm/filemap.c:3977 __generic_file_write_iter+0x110/0x204 mm/filemap.c:4141 ocfs2_file_write_iter+0x1520/0x1e10 fs/ocfs2/file.c:2467 new_sync_write fs/read_write.c:590 [inline] vfs_write+0x920/0xcf4 fs/read_write.c:683 ksys_write+0x15c/0x26c fs/read_write.c:736 __do_sys_write fs/read_write.c:748 [inline] __se_sys_write fs/read_write.c:745 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:745 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600