syzbot


possible deadlock in xfs_ilock

Status: fixed on 2024/04/10 03:59
Subsystems: xfs
[Documentation on labels]
Reported-by: syzbot+d247769793ec169e4bf9@syzkaller.appspotmail.com
Fix commit: 0c6ca06aad84 xfs: quota radix tree allocations need to be NOFS on insert
First crash: 69d, last: 42d
Discussions (2)
Title Replies (including bot) Last reply
[syzbot] Monthly xfs report (Mar 2024) 0 (1) 2024/03/21 15:10
[syzbot] [xfs?] possible deadlock in xfs_ilock 0 (1) 2024/03/14 09:31
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in xfs_ilock (2) xfs 680 1h38m 37d 0/26 upstream: reported on 2024/04/15 00:11

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.8.0-syzkaller-11752-gdba89d1b81df #0 Not tainted
------------------------------------------------------
kswapd0/110 is trying to acquire lock:
ffff8880123588d8 (&xfs_nondir_ilock_class#3){++++}-{3:3}, at: xfs_ilock+0x2ef/0x420 fs/xfs/xfs_inode.c:206

but task is already holding lock:
ffffffff8db32460 (fs_reclaim){+.+.}-{0:0}, at: balance_pgdat+0x166/0x19a0 mm/vmscan.c:6782

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (fs_reclaim){+.+.}-{0:0}:
       __fs_reclaim_acquire mm/page_alloc.c:3698 [inline]
       fs_reclaim_acquire+0x102/0x160 mm/page_alloc.c:3712
       might_alloc include/linux/sched/mm.h:312 [inline]
       slab_pre_alloc_hook mm/slub.c:3746 [inline]
       slab_alloc_node mm/slub.c:3827 [inline]
       __do_kmalloc_node mm/slub.c:3965 [inline]
       __kmalloc+0xb5/0x440 mm/slub.c:3979
       kmalloc include/linux/slab.h:632 [inline]
       xfs_attr_shortform_list fs/xfs/xfs_attr_list.c:115 [inline]
       xfs_attr_list_ilocked+0x8b7/0x1740 fs/xfs/xfs_attr_list.c:527
       xfs_attr_list+0x1f9/0x2b0 fs/xfs/xfs_attr_list.c:547
       xfs_vn_listxattr+0x11f/0x1c0 fs/xfs/xfs_xattr.c:314
       vfs_listxattr+0xb7/0x140 fs/xattr.c:493
       listxattr+0x69/0x190 fs/xattr.c:840
       path_listxattr+0xc3/0x160 fs/xattr.c:864
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x6d/0x75

-> #0 (&xfs_nondir_ilock_class#3){++++}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3134 [inline]
       check_prevs_add kernel/locking/lockdep.c:3253 [inline]
       validate_chain kernel/locking/lockdep.c:3869 [inline]
       __lock_acquire+0x2478/0x3b30 kernel/locking/lockdep.c:5137
       lock_acquire kernel/locking/lockdep.c:5754 [inline]
       lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5719
       down_write_nested+0x3d/0x50 kernel/locking/rwsem.c:1695
       xfs_ilock+0x2ef/0x420 fs/xfs/xfs_inode.c:206
       xfs_reclaim_inode fs/xfs/xfs_icache.c:945 [inline]
       xfs_icwalk_process_inode fs/xfs/xfs_icache.c:1631 [inline]
       xfs_icwalk_ag+0xca6/0x1780 fs/xfs/xfs_icache.c:1713
       xfs_icwalk+0x57/0x100 fs/xfs/xfs_icache.c:1762
       xfs_reclaim_inodes_nr+0x182/0x250 fs/xfs/xfs_icache.c:1011
       super_cache_scan+0x409/0x550 fs/super.c:227
       do_shrink_slab+0x44f/0x11c0 mm/shrinker.c:435
       shrink_slab+0x18a/0x1310 mm/shrinker.c:662
       shrink_one+0x493/0x7c0 mm/vmscan.c:4774
       shrink_many mm/vmscan.c:4835 [inline]
       lru_gen_shrink_node mm/vmscan.c:4935 [inline]
       shrink_node+0x231f/0x3a80 mm/vmscan.c:5894
       kswapd_shrink_node mm/vmscan.c:6704 [inline]
       balance_pgdat+0x9a0/0x19a0 mm/vmscan.c:6895
       kswapd+0x5ea/0xbf0 mm/vmscan.c:7164
       kthread+0x2c1/0x3a0 kernel/kthread.c:388
       ret_from_fork+0x45/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:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(fs_reclaim);
                               lock(&xfs_nondir_ilock_class#3);
                               lock(fs_reclaim);
  lock(&xfs_nondir_ilock_class#3);

 *** DEADLOCK ***

2 locks held by kswapd0/110:
 #0: ffffffff8db32460 (fs_reclaim){+.+.}-{0:0}, at: balance_pgdat+0x166/0x19a0 mm/vmscan.c:6782
 #1: ffff88801f8300e0 (&type->s_umount_key#92){++++}-{3:3}, at: super_trylock_shared fs/super.c:561 [inline]
 #1: ffff88801f8300e0 (&type->s_umount_key#92){++++}-{3:3}, at: super_cache_scan+0x96/0x550 fs/super.c:196

stack backtrace:
CPU: 3 PID: 110 Comm: kswapd0 Not tainted 6.8.0-syzkaller-11752-gdba89d1b81df #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114
 check_noncircular+0x31a/0x400 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 kernel/locking/lockdep.c:3869 [inline]
 __lock_acquire+0x2478/0x3b30 kernel/locking/lockdep.c:5137
 lock_acquire kernel/locking/lockdep.c:5754 [inline]
 lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5719
 down_write_nested+0x3d/0x50 kernel/locking/rwsem.c:1695
 xfs_ilock+0x2ef/0x420 fs/xfs/xfs_inode.c:206
 xfs_reclaim_inode fs/xfs/xfs_icache.c:945 [inline]
 xfs_icwalk_process_inode fs/xfs/xfs_icache.c:1631 [inline]
 xfs_icwalk_ag+0xca6/0x1780 fs/xfs/xfs_icache.c:1713
 xfs_icwalk+0x57/0x100 fs/xfs/xfs_icache.c:1762
 xfs_reclaim_inodes_nr+0x182/0x250 fs/xfs/xfs_icache.c:1011
 super_cache_scan+0x409/0x550 fs/super.c:227
 do_shrink_slab+0x44f/0x11c0 mm/shrinker.c:435
 shrink_slab+0x18a/0x1310 mm/shrinker.c:662
 shrink_one+0x493/0x7c0 mm/vmscan.c:4774
 shrink_many mm/vmscan.c:4835 [inline]
 lru_gen_shrink_node mm/vmscan.c:4935 [inline]
 shrink_node+0x231f/0x3a80 mm/vmscan.c:5894
 kswapd_shrink_node mm/vmscan.c:6704 [inline]
 balance_pgdat+0x9a0/0x19a0 mm/vmscan.c:6895
 kswapd+0x5ea/0xbf0 mm/vmscan.c:7164
 kthread+0x2c1/0x3a0 kernel/kthread.c:388
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243
 </TASK>

Crashes (30):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/03/21 01:13 upstream dba89d1b81df 6753db5c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in xfs_ilock
2024/03/20 19:14 upstream a4145ce1e7bc 5b7d42ae .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in xfs_ilock
2024/03/19 12:21 upstream b3603fcb79b1 e104824c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in xfs_ilock
2024/03/17 21:03 upstream 906a93befec8 d615901c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in xfs_ilock
2024/03/14 17:00 upstream e5e038b7ae9d 8d8ee116 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in xfs_ilock
2024/04/10 03:37 upstream 2c71fdf02a95 171ec371 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/04/10 03:02 upstream 2c71fdf02a95 171ec371 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/04/09 09:45 upstream 20cb38a7af88 56086b24 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/04/08 22:27 upstream fec50db7033e f3234354 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/04/08 07:30 upstream fec50db7033e ca620dd8 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/04/08 01:45 upstream 9fe30842a90b ca620dd8 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/04/07 18:26 upstream 9fe30842a90b ca620dd8 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/04/07 17:29 upstream 9fe30842a90b ca620dd8 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/04/07 13:16 upstream f2f80ac80987 ca620dd8 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/04/07 06:58 upstream f2f80ac80987 ca620dd8 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/04/06 18:32 upstream 6c6e47d69d82 ca620dd8 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/04/06 15:53 upstream 6c6e47d69d82 ca620dd8 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/04/06 03:51 upstream e8b0ccb2a787 ca620dd8 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/04/03 06:17 upstream b1e6ec0a0fd0 7925100d .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/03/30 09:35 upstream 4535e1a4174c 6baf5069 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/03/27 02:23 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/03/19 00:48 upstream b3603fcb79b1 baa80228 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/03/18 10:13 upstream f6cef5f8c37f d615901c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/03/18 00:43 upstream 906a93befec8 d615901c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/03/17 20:19 upstream 906a93befec8 d615901c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/03/16 06:43 upstream 82affc97affb d615901c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/03/15 08:06 upstream fe46a7dd189e d615901c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/03/15 05:30 upstream fe46a7dd189e d615901c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/03/14 14:13 upstream e5e038b7ae9d 8d8ee116 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
2024/03/14 07:53 upstream e5e038b7ae9d 8d8ee116 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in xfs_ilock
* Struck through repros no longer work on HEAD.