====================================================== WARNING: possible circular locking dependency detected 6.13.0-rc3-syzkaller-00136-g8faabc041a00 #0 Not tainted ------------------------------------------------------ syz.1.362/9728 is trying to acquire lock: ffff888021f7b510 (&lp->qli_lock){+.+.}-{3:3}, at: spin_lock include/linux/spinlock.h:351 [inline] ffff888021f7b510 (&lp->qli_lock){+.+.}-{3:3}, at: xfs_dquot_detach_buf+0x2f/0x1a0 fs/xfs/xfs_dquot.c:83 but task is already holding lock: ffff888022a9ae30 (&l->lock){+.+.}-{3:3}, at: spin_lock include/linux/spinlock.h:351 [inline] ffff888022a9ae30 (&l->lock){+.+.}-{3:3}, at: lock_list_lru_of_memcg+0x24b/0x4e0 mm/list_lru.c:77 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&l->lock){+.+.}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154 spin_lock include/linux/spinlock.h:351 [inline] lock_list_lru_of_memcg+0x24b/0x4e0 mm/list_lru.c:77 list_lru_del+0x58/0x1f0 mm/list_lru.c:203 xfs_buf_stale+0x1f5/0x320 fs/xfs/xfs_buf.c:178 xfs_buf_read_map+0x68d/0xa50 fs/xfs/xfs_buf.c:915 xfs_trans_read_buf_map+0x260/0xab0 fs/xfs/xfs_trans_buf.c:304 xfs_trans_read_buf fs/xfs/xfs_trans.h:213 [inline] xfs_btree_read_buf_block+0x36f/0x5b0 fs/xfs/libxfs/xfs_btree.c:1396 xfs_btree_lookup_get_block+0x316/0x5b0 fs/xfs/libxfs/xfs_btree.c:1897 xfs_btree_lookup+0x4eb/0x15f0 fs/xfs/libxfs/xfs_btree.c:2008 xfs_alloc_lookup fs/xfs/libxfs/xfs_alloc.c:168 [inline] xfs_alloc_lookup_ge fs/xfs/libxfs/xfs_alloc.c:200 [inline] xfs_alloc_cur_setup fs/xfs/libxfs/xfs_alloc.c:968 [inline] xfs_alloc_ag_vextent_near+0x533/0x1960 fs/xfs/libxfs/xfs_alloc.c:1707 xfs_alloc_vextent_iterate_ags+0x5ed/0x950 fs/xfs/libxfs/xfs_alloc.c:3741 xfs_alloc_vextent_start_ag+0x3f6/0x950 fs/xfs/libxfs/xfs_alloc.c:3816 xfs_bmap_btalloc_best_length fs/xfs/libxfs/xfs_bmap.c:3766 [inline] xfs_bmap_btalloc fs/xfs/libxfs/xfs_bmap.c:3811 [inline] xfs_bmapi_allocate+0x18fa/0x3450 fs/xfs/libxfs/xfs_bmap.c:4224 xfs_bmapi_write+0xbac/0x1b40 fs/xfs/libxfs/xfs_bmap.c:4553 xfs_dquot_disk_alloc+0x5f4/0xe20 fs/xfs/xfs_dquot.c:380 xfs_qm_dqread+0x1a3/0x630 fs/xfs/xfs_dquot.c:719 xfs_qm_dqget+0x2bb/0x6f0 fs/xfs/xfs_dquot.c:931 xfs_qm_quotacheck_dqadjust+0xeb/0x5e0 fs/xfs/xfs_qm.c:1331 xfs_qm_dqusage_adjust+0x778/0x850 fs/xfs/xfs_qm.c:1471 xfs_iwalk_ag_recs+0x4e3/0x820 fs/xfs/xfs_iwalk.c:209 xfs_iwalk_run_callbacks+0x218/0x470 fs/xfs/xfs_iwalk.c:370 xfs_iwalk_ag+0xa9a/0xbb0 fs/xfs/xfs_iwalk.c:476 xfs_iwalk_ag_work+0xfb/0x1b0 fs/xfs/xfs_iwalk.c:625 xfs_pwork_work+0x7f/0x190 fs/xfs/xfs_pwork.c:47 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0xa66/0x1840 kernel/workqueue.c:3310 worker_thread+0x870/0xd30 kernel/workqueue.c:3391 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 -> #1 (&bp->b_lock){+.+.}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154 spin_lock include/linux/spinlock.h:351 [inline] xfs_buf_rele_cached fs/xfs/xfs_buf.c:1084 [inline] xfs_buf_rele+0x164/0x15b0 fs/xfs/xfs_buf.c:1151 xfs_dquot_attach_buf+0x33e/0x560 fs/xfs/xfs_dquot.c:1345 xfs_qm_quotacheck_dqadjust+0x13f/0x5e0 fs/xfs/xfs_qm.c:1341 xfs_qm_dqusage_adjust+0x778/0x850 fs/xfs/xfs_qm.c:1471 xfs_iwalk_ag_recs+0x4e3/0x820 fs/xfs/xfs_iwalk.c:209 xfs_iwalk_run_callbacks+0x218/0x470 fs/xfs/xfs_iwalk.c:370 xfs_iwalk_ag+0xa9a/0xbb0 fs/xfs/xfs_iwalk.c:476 xfs_iwalk_ag_work+0xfb/0x1b0 fs/xfs/xfs_iwalk.c:625 xfs_pwork_work+0x7f/0x190 fs/xfs/xfs_pwork.c:47 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0xa66/0x1840 kernel/workqueue.c:3310 worker_thread+0x870/0xd30 kernel/workqueue.c:3391 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 -> #0 (&lp->qli_lock){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904 __lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5226 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154 spin_lock include/linux/spinlock.h:351 [inline] xfs_dquot_detach_buf+0x2f/0x1a0 fs/xfs/xfs_dquot.c:83 xfs_qm_dquot_isolate+0x49d/0x1420 fs/xfs/xfs_qm.c:528 __list_lru_walk_one+0x170/0x470 mm/list_lru.c:301 list_lru_walk_one+0x3c/0x50 mm/list_lru.c:338 list_lru_shrink_walk include/linux/list_lru.h:240 [inline] xfs_qm_shrink_scan+0x1e1/0x400 fs/xfs/xfs_qm.c:574 do_shrink_slab+0x72d/0x1160 mm/shrinker.c:437 shrink_slab+0x1093/0x14d0 mm/shrinker.c:664 drop_slab_node mm/vmscan.c:414 [inline] drop_slab+0x142/0x280 mm/vmscan.c:432 drop_caches_sysctl_handler+0xbc/0x160 fs/drop_caches.c:68 proc_sys_call_handler+0x5ec/0x920 fs/proc/proc_sysctl.c:601 do_iter_readv_writev+0x600/0x880 vfs_writev+0x376/0xba0 fs/read_write.c:1050 do_writev+0x1b6/0x360 fs/read_write.c:1096 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Chain exists of: &lp->qli_lock --> &bp->b_lock --> &l->lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&l->lock); lock(&bp->b_lock); lock(&l->lock); lock(&lp->qli_lock); *** DEADLOCK *** 4 locks held by syz.1.362/9728: #0: ffff88807e412d38 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x254/0x320 fs/file.c:1191 #1: ffff888054782420 (sb_writers#3){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2964 [inline] #1: ffff888054782420 (sb_writers#3){.+.+}-{0:0}, at: vfs_writev+0x2d1/0xba0 fs/read_write.c:1048 #2: ffff888022a9ae30 (&l->lock){+.+.}-{3:3}, at: spin_lock include/linux/spinlock.h:351 [inline] #2: ffff888022a9ae30 (&l->lock){+.+.}-{3:3}, at: lock_list_lru_of_memcg+0x24b/0x4e0 mm/list_lru.c:77 #3: ffff888021f7b5f8 (&dqp->q_qlock){+.+.}-{4:4}, at: xfs_dqlock_nowait fs/xfs/xfs_dquot.h:126 [inline] #3: ffff888021f7b5f8 (&dqp->q_qlock){+.+.}-{4:4}, at: xfs_qm_dquot_isolate+0x8d/0x1420 fs/xfs/xfs_qm.c:467 stack backtrace: CPU: 1 UID: 0 PID: 9728 Comm: syz.1.362 Not tainted 6.13.0-rc3-syzkaller-00136-g8faabc041a00 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/25/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_circular_bug+0x13a/0x1b0 kernel/locking/lockdep.c:2074 check_noncircular+0x36a/0x4a0 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+0x18ef/0x5920 kernel/locking/lockdep.c:3904 __lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5226 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154 spin_lock include/linux/spinlock.h:351 [inline] xfs_dquot_detach_buf+0x2f/0x1a0 fs/xfs/xfs_dquot.c:83 xfs_qm_dquot_isolate+0x49d/0x1420 fs/xfs/xfs_qm.c:528 __list_lru_walk_one+0x170/0x470 mm/list_lru.c:301 list_lru_walk_one+0x3c/0x50 mm/list_lru.c:338 list_lru_shrink_walk include/linux/list_lru.h:240 [inline] xfs_qm_shrink_scan+0x1e1/0x400 fs/xfs/xfs_qm.c:574 do_shrink_slab+0x72d/0x1160 mm/shrinker.c:437 shrink_slab+0x1093/0x14d0 mm/shrinker.c:664 drop_slab_node mm/vmscan.c:414 [inline] drop_slab+0x142/0x280 mm/vmscan.c:432 drop_caches_sysctl_handler+0xbc/0x160 fs/drop_caches.c:68 proc_sys_call_handler+0x5ec/0x920 fs/proc/proc_sysctl.c:601 do_iter_readv_writev+0x600/0x880 vfs_writev+0x376/0xba0 fs/read_write.c:1050 do_writev+0x1b6/0x360 fs/read_write.c:1096 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f8e0d185d29 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f8e0e016038 EFLAGS: 00000246 ORIG_RAX: 0000000000000014 RAX: ffffffffffffffda RBX: 00007f8e0d375fa0 RCX: 00007f8e0d185d29 RDX: 0000000000000001 RSI: 00000000200000c0 RDI: 0000000000000006 RBP: 00007f8e0d201aa8 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f8e0d375fa0 R15: 00007ffe9894a9e8