====================================================== WARNING: possible circular locking dependency detected 6.13.0-rc3-syzkaller-00136-g8faabc041a00 #0 Not tainted ------------------------------------------------------ kswapd1/81 is trying to acquire lock: ffff8880511d1030 (&lp->qli_lock){+.+.}-{3:3}, at: spin_lock include/linux/spinlock.h:351 [inline] ffff8880511d1030 (&lp->qli_lock){+.+.}-{3:3}, at: xfs_dquot_detach_buf+0x2f/0x1a0 fs/xfs/xfs_dquot.c:83 but task is already holding lock: ffff8880118d6cb0 (&l->lock){+.+.}-{3:3}, at: spin_lock include/linux/spinlock.h:351 [inline] ffff8880118d6cb0 (&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: -> #3 (&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_add+0x59/0x270 mm/list_lru.c:164 xfs_buf_rele_cached fs/xfs/xfs_buf.c:1106 [inline] xfs_buf_rele+0x4ca/0x15b0 fs/xfs/xfs_buf.c:1151 xfs_imap_lookup+0x26a/0x750 fs/xfs/libxfs/xfs_ialloc.c:2431 xfs_imap+0x54d/0x1090 fs/xfs/libxfs/xfs_ialloc.c:2514 xfs_iget_cache_miss fs/xfs/xfs_icache.c:644 [inline] xfs_iget+0xaf6/0x2ec0 fs/xfs/xfs_icache.c:806 xfs_mountfs+0x13df/0x2410 fs/xfs/xfs_mount.c:919 xfs_fs_fill_super+0x12db/0x1590 fs/xfs/xfs_super.c:1791 get_tree_bdev_flags+0x48c/0x5c0 fs/super.c:1636 vfs_get_tree+0x90/0x2b0 fs/super.c:1814 do_new_mount+0x2be/0xb40 fs/namespace.c:3507 do_mount fs/namespace.c:3847 [inline] __do_sys_mount fs/namespace.c:4057 [inline] __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:4034 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 -> #2 (&bch->bc_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] _atomic_dec_and_lock+0xb8/0x130 lib/dec_and_lock.c:28 xfs_buf_rele_cached fs/xfs/xfs_buf.c:1085 [inline] xfs_buf_rele+0x178/0x15b0 fs/xfs/xfs_buf.c:1151 xfs_imap_lookup+0x26a/0x750 fs/xfs/libxfs/xfs_ialloc.c:2431 xfs_imap+0x54d/0x1090 fs/xfs/libxfs/xfs_ialloc.c:2514 xfs_iget_cache_miss fs/xfs/xfs_icache.c:644 [inline] xfs_iget+0xaf6/0x2ec0 fs/xfs/xfs_icache.c:806 xfs_mountfs+0x13df/0x2410 fs/xfs/xfs_mount.c:919 xfs_fs_fill_super+0x12db/0x1590 fs/xfs/xfs_super.c:1791 get_tree_bdev_flags+0x48c/0x5c0 fs/super.c:1636 vfs_get_tree+0x90/0x2b0 fs/super.c:1814 do_new_mount+0x2be/0xb40 fs/namespace.c:3507 do_mount fs/namespace.c:3847 [inline] __do_sys_mount fs/namespace.c:4057 [inline] __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:4034 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 -> #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+0x5e1/0x850 fs/xfs/xfs_qm.c:1457 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 shrink_one+0x43b/0x850 mm/vmscan.c:4836 shrink_many mm/vmscan.c:4897 [inline] lru_gen_shrink_node mm/vmscan.c:4975 [inline] shrink_node+0x37c5/0x3e50 mm/vmscan.c:5956 kswapd_shrink_node mm/vmscan.c:6785 [inline] balance_pgdat mm/vmscan.c:6977 [inline] kswapd+0x1ca9/0x36f0 mm/vmscan.c:7246 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 other info that might help us debug this: Chain exists of: &lp->qli_lock --> &bch->bc_lock --> &l->lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&l->lock); lock(&bch->bc_lock); lock(&l->lock); lock(&lp->qli_lock); *** DEADLOCK *** 3 locks held by kswapd1/81: #0: ffffffff8ea36e80 (fs_reclaim){+.+.}-{0:0}, at: balance_pgdat mm/vmscan.c:6864 [inline] #0: ffffffff8ea36e80 (fs_reclaim){+.+.}-{0:0}, at: kswapd+0xbf1/0x36f0 mm/vmscan.c:7246 #1: ffff8880118d6cb0 (&l->lock){+.+.}-{3:3}, at: spin_lock include/linux/spinlock.h:351 [inline] #1: ffff8880118d6cb0 (&l->lock){+.+.}-{3:3}, at: lock_list_lru_of_memcg+0x24b/0x4e0 mm/list_lru.c:77 #2: ffff8880511d1118 (&dqp->q_qlock){+.+.}-{4:4}, at: xfs_dqlock_nowait fs/xfs/xfs_dquot.h:126 [inline] #2: ffff8880511d1118 (&dqp->q_qlock){+.+.}-{4:4}, at: xfs_qm_dquot_isolate+0x8d/0x1420 fs/xfs/xfs_qm.c:467 stack backtrace: CPU: 0 UID: 0 PID: 81 Comm: kswapd1 Not tainted 6.13.0-rc3-syzkaller-00136-g8faabc041a00 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 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 shrink_one+0x43b/0x850 mm/vmscan.c:4836 shrink_many mm/vmscan.c:4897 [inline] lru_gen_shrink_node mm/vmscan.c:4975 [inline] shrink_node+0x37c5/0x3e50 mm/vmscan.c:5956 kswapd_shrink_node mm/vmscan.c:6785 [inline] balance_pgdat mm/vmscan.c:6977 [inline] kswapd+0x1ca9/0x36f0 mm/vmscan.c:7246 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