syzbot


possible deadlock in xfs_icwalk_ag

Status: closed as dup on 2024/03/23 08:37
Subsystems: xfs
[Documentation on labels]
Reported-by: syzbot+7766d4a620956dfe7070@syzkaller.appspotmail.com
First crash: 266d, last: 245d
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
possible deadlock in xfs_qm_dqget_cache_insert xfs 8 270d 271d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [xfs?] possible deadlock in xfs_icwalk_ag 2 (3) 2024/04/28 21:58
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in xfs_icwalk_ag (2) xfs C 352 3h46m 238d 24/28 upstream: reported C repro on 2024/04/16 12:02

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.8.0-syzkaller-08951-gfe46a7dd189e #0 Not tainted
------------------------------------------------------
kswapd0/88 is trying to acquire lock:
ffff88814c326d98 (&xfs_dir_ilock_class){++++}-{3:3}, at: xfs_reclaim_inode fs/xfs/xfs_icache.c:945 [inline]
ffff88814c326d98 (&xfs_dir_ilock_class){++++}-{3:3}, at: xfs_icwalk_process_inode fs/xfs/xfs_icache.c:1631 [inline]
ffff88814c326d98 (&xfs_dir_ilock_class){++++}-{3:3}, at: xfs_icwalk_ag+0x1216/0x1aa0 fs/xfs/xfs_icache.c:1713

but task is already holding lock:
ffffffff8e21f720 (fs_reclaim){+.+.}-{0:0}, at: balance_pgdat mm/vmscan.c:6774 [inline]
ffffffff8e21f720 (fs_reclaim){+.+.}-{0:0}, at: kswapd+0xb3f/0x36e0 mm/vmscan.c:7146

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (fs_reclaim){+.+.}-{0:0}:
       lock_acquire+0x1e4/0x530 kernel/locking/lockdep.c:5754
       __fs_reclaim_acquire mm/page_alloc.c:3692 [inline]
       fs_reclaim_acquire+0x88/0x130 mm/page_alloc.c:3706
       might_alloc include/linux/sched/mm.h:303 [inline]
       slab_pre_alloc_hook mm/slub.c:3746 [inline]
       slab_alloc_node mm/slub.c:3827 [inline]
       kmem_cache_alloc+0x48/0x340 mm/slub.c:3852
       radix_tree_node_alloc+0x8b/0x3c0 lib/radix-tree.c:276
       radix_tree_extend+0x148/0x5c0 lib/radix-tree.c:425
       __radix_tree_create lib/radix-tree.c:613 [inline]
       radix_tree_insert+0x15c/0x680 lib/radix-tree.c:712
       xfs_qm_dqget_cache_insert fs/xfs/xfs_dquot.c:826 [inline]
       xfs_qm_dqget+0x2d4/0x640 fs/xfs/xfs_dquot.c:901
       xfs_qm_vop_dqalloc+0x913/0xef0 fs/xfs/xfs_qm.c:1773
       xfs_fileattr_set+0x3ff/0x1920 fs/xfs/xfs_ioctl.c:1347
       vfs_fileattr_set+0x901/0xd50 fs/ioctl.c:697
       ioctl_fssetxattr fs/ioctl.c:759 [inline]
       do_vfs_ioctl+0x1a9c/0x2e50 fs/ioctl.c:873
       __do_sys_ioctl fs/ioctl.c:902 [inline]
       __se_sys_ioctl+0x81/0x170 fs/ioctl.c:890
       do_syscall_64+0xfd/0x240
       entry_SYSCALL_64_after_hwframe+0x6d/0x75

-> #1 (&qinf->qi_tree_lock){+.+.}-{3:3}:
       lock_acquire+0x1e4/0x530 kernel/locking/lockdep.c:5754
       __mutex_lock_common kernel/locking/mutex.c:608 [inline]
       __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
       xfs_qm_dqget_cache_lookup+0x30/0x870 fs/xfs/xfs_dquot.c:784
       xfs_qm_dqget_inode+0x353/0xaa0 fs/xfs/xfs_dquot.c:986
       xfs_qm_dqattach_one+0x185/0x5e0 fs/xfs/xfs_qm.c:278
       xfs_qm_dqattach_locked+0x3d1/0x4e0 fs/xfs/xfs_qm.c:329
       xfs_qm_vop_dqalloc+0x3fd/0xef0 fs/xfs/xfs_qm.c:1710
       xfs_fileattr_set+0x3ff/0x1920 fs/xfs/xfs_ioctl.c:1347
       vfs_fileattr_set+0x901/0xd50 fs/ioctl.c:697
       ioctl_fssetxattr fs/ioctl.c:759 [inline]
       do_vfs_ioctl+0x1a9c/0x2e50 fs/ioctl.c:873
       __do_sys_ioctl fs/ioctl.c:902 [inline]
       __se_sys_ioctl+0x81/0x170 fs/ioctl.c:890
       do_syscall_64+0xfd/0x240
       entry_SYSCALL_64_after_hwframe+0x6d/0x75

-> #0 (&xfs_dir_ilock_class){++++}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3134 [inline]
       check_prevs_add kernel/locking/lockdep.c:3253 [inline]
       validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869
       __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
       lock_acquire+0x1e4/0x530 kernel/locking/lockdep.c:5754
       down_write_nested+0x3d/0x50 kernel/locking/rwsem.c:1695
       xfs_reclaim_inode fs/xfs/xfs_icache.c:945 [inline]
       xfs_icwalk_process_inode fs/xfs/xfs_icache.c:1631 [inline]
       xfs_icwalk_ag+0x1216/0x1aa0 fs/xfs/xfs_icache.c:1713
       xfs_icwalk fs/xfs/xfs_icache.c:1762 [inline]
       xfs_reclaim_inodes_nr+0x257/0x360 fs/xfs/xfs_icache.c:1011
       super_cache_scan+0x411/0x4b0 fs/super.c:227
       do_shrink_slab+0x6d2/0x1140 mm/shrinker.c:435
       shrink_slab+0x1092/0x14d0 mm/shrinker.c:662
       shrink_one+0x423/0x7f0 mm/vmscan.c:4767
       shrink_many mm/vmscan.c:4828 [inline]
       lru_gen_shrink_node mm/vmscan.c:4929 [inline]
       shrink_node+0x37b8/0x3e70 mm/vmscan.c:5888
       kswapd_shrink_node mm/vmscan.c:6696 [inline]
       balance_pgdat mm/vmscan.c:6886 [inline]
       kswapd+0x17d1/0x36e0 mm/vmscan.c:7146
       kthread+0x2f2/0x390 kernel/kthread.c:388
       ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243

other info that might help us debug this:

Chain exists of:
  &xfs_dir_ilock_class --> &qinf->qi_tree_lock --> fs_reclaim

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(fs_reclaim);
                               lock(&qinf->qi_tree_lock);
                               lock(fs_reclaim);
  lock(&xfs_dir_ilock_class);

 *** DEADLOCK ***

2 locks held by kswapd0/88:
 #0: ffffffff8e21f720 (fs_reclaim){+.+.}-{0:0}, at: balance_pgdat mm/vmscan.c:6774 [inline]
 #0: ffffffff8e21f720 (fs_reclaim){+.+.}-{0:0}, at: kswapd+0xb3f/0x36e0 mm/vmscan.c:7146
 #1: ffff888078b540e0 (&type->s_umount_key#60){++++}-{3:3}, at: super_trylock_shared fs/super.c:561 [inline]
 #1: ffff888078b540e0 (&type->s_umount_key#60){++++}-{3:3}, at: super_cache_scan+0x94/0x4b0 fs/super.c:196

stack backtrace:
CPU: 0 PID: 88 Comm: kswapd0 Not tainted 6.8.0-syzkaller-08951-gfe46a7dd189e #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2187
 check_prev_add kernel/locking/lockdep.c:3134 [inline]
 check_prevs_add kernel/locking/lockdep.c:3253 [inline]
 validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869
 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
 lock_acquire+0x1e4/0x530 kernel/locking/lockdep.c:5754
 down_write_nested+0x3d/0x50 kernel/locking/rwsem.c:1695
 xfs_reclaim_inode fs/xfs/xfs_icache.c:945 [inline]
 xfs_icwalk_process_inode fs/xfs/xfs_icache.c:1631 [inline]
 xfs_icwalk_ag+0x1216/0x1aa0 fs/xfs/xfs_icache.c:1713
 xfs_icwalk fs/xfs/xfs_icache.c:1762 [inline]
 xfs_reclaim_inodes_nr+0x257/0x360 fs/xfs/xfs_icache.c:1011
 super_cache_scan+0x411/0x4b0 fs/super.c:227
 do_shrink_slab+0x6d2/0x1140 mm/shrinker.c:435
 shrink_slab+0x1092/0x14d0 mm/shrinker.c:662
 shrink_one+0x423/0x7f0 mm/vmscan.c:4767
 shrink_many mm/vmscan.c:4828 [inline]
 lru_gen_shrink_node mm/vmscan.c:4929 [inline]
 shrink_node+0x37b8/0x3e70 mm/vmscan.c:5888
 kswapd_shrink_node mm/vmscan.c:6696 [inline]
 balance_pgdat mm/vmscan.c:6886 [inline]
 kswapd+0x17d1/0x36e0 mm/vmscan.c:7146
 kthread+0x2f2/0x390 kernel/kthread.c:388
 ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243
 </TASK>

Crashes (14):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/03/25 20:34 upstream fe46a7dd189e 0ea90952 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in xfs_icwalk_ag
2024/03/25 15:38 upstream fe46a7dd189e 0ea90952 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in xfs_icwalk_ag
2024/03/24 15:16 upstream fe46a7dd189e 0ea90952 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in xfs_icwalk_ag
2024/03/22 18:05 upstream fe46a7dd189e 7a239ce7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in xfs_icwalk_ag
2024/03/21 14:23 upstream fe46a7dd189e 6753db5c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in xfs_icwalk_ag
2024/03/21 02:30 upstream fe46a7dd189e 5b7d42ae .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in xfs_icwalk_ag
2024/03/20 06:22 upstream fe46a7dd189e a485f239 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in xfs_icwalk_ag
2024/03/19 18:57 upstream fe46a7dd189e baa80228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in xfs_icwalk_ag
2024/03/19 08:01 upstream fe46a7dd189e baa80228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in xfs_icwalk_ag
2024/04/09 09:52 linux-next a053fd3ca5d1 53df08b6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in xfs_icwalk_ag
2024/04/09 09:52 linux-next a053fd3ca5d1 53df08b6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in xfs_icwalk_ag
2024/04/09 09:50 linux-next a053fd3ca5d1 53df08b6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in xfs_icwalk_ag
2024/04/09 09:24 linux-next a053fd3ca5d1 53df08b6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in xfs_icwalk_ag
2024/04/09 09:19 linux-next a053fd3ca5d1 53df08b6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in xfs_icwalk_ag
* Struck through repros no longer work on HEAD.