syzbot


possible deadlock in evict

Status: auto-closed as invalid on 2021/07/11 09:40
Reported-by: syzbot+1b2c6989ec12e467d65c@syzkaller.appspotmail.com
First crash: 502d, last: 474d
similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in evict (2) 1 74d 70d 0/22 closed as dup on 2022/04/21 19:37

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.12.0-rc1-syzkaller #0 Not tainted
------------------------------------------------------
kswapd0/2199 is trying to acquire lock:
ffff88801ee08650 (sb_internal){.+.+}-{0:0}, at: evict+0x2ed/0x6b0 fs/inode.c:578

but task is already holding lock:
ffffffff8c08bf40 (fs_reclaim){+.+.}-{0:0}, at: __fs_reclaim_acquire+0x0/0x30 mm/page_alloc.c:5198

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (fs_reclaim){+.+.}-{0:0}:
       __fs_reclaim_acquire mm/page_alloc.c:4327 [inline]
       fs_reclaim_acquire+0x117/0x150 mm/page_alloc.c:4341
       might_alloc include/linux/sched/mm.h:193 [inline]
       slab_pre_alloc_hook mm/slab.h:497 [inline]
       slab_alloc_node mm/slab.c:3221 [inline]
       kmem_cache_alloc_node_trace+0x48/0x550 mm/slab.c:3612
       __do_kmalloc_node mm/slab.c:3634 [inline]
       __kmalloc_node+0x38/0x60 mm/slab.c:3642
       kmalloc_node include/linux/slab.h:577 [inline]
       kvmalloc_node+0xb4/0xf0 mm/util.c:587
       kvmalloc include/linux/mm.h:785 [inline]
       ext4_xattr_inode_cache_find fs/ext4/xattr.c:1465 [inline]
       ext4_xattr_inode_lookup_create fs/ext4/xattr.c:1508 [inline]
       ext4_xattr_set_entry+0x1ce6/0x3750 fs/ext4/xattr.c:1649
       ext4_xattr_ibody_set+0x78/0x2b0 fs/ext4/xattr.c:2224
       ext4_xattr_set_handle+0x8f4/0x13e0 fs/ext4/xattr.c:2380
       ext4_xattr_set+0x13a/0x340 fs/ext4/xattr.c:2493
       __vfs_setxattr+0x115/0x180 fs/xattr.c:180
       __vfs_setxattr_noperm+0x125/0x4c0 fs/xattr.c:214
       __vfs_setxattr_locked+0x1cf/0x260 fs/xattr.c:274
       vfs_setxattr+0x13f/0x330 fs/xattr.c:300
       setxattr+0x218/0x2b0 fs/xattr.c:573
       path_setxattr+0x197/0x1c0 fs/xattr.c:593
       __do_sys_setxattr fs/xattr.c:609 [inline]
       __se_sys_setxattr fs/xattr.c:605 [inline]
       __x64_sys_setxattr+0xc0/0x160 fs/xattr.c:605
       do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xae

-> #2 (&ei->xattr_sem){++++}-{3:3}:
       down_write+0x92/0x150 kernel/locking/rwsem.c:1406
       ext4_write_lock_xattr fs/ext4/xattr.h:142 [inline]
       ext4_xattr_set_handle+0x15c/0x13e0 fs/ext4/xattr.c:2308
       ext4_initxattrs+0xb5/0x120 fs/ext4/xattr_security.c:44
       security_inode_init_security+0x1c4/0x370 security/security.c:1054
       __ext4_new_inode+0x396a/0x5570 fs/ext4/ialloc.c:1318
       ext4_create+0x2d6/0x4d0 fs/ext4/namei.c:2622
       lookup_open.isra.0+0xfef/0x13d0 fs/namei.c:3219
       open_last_lookups fs/namei.c:3289 [inline]
       path_openat+0x9b4/0x27e0 fs/namei.c:3495
       do_filp_open+0x17e/0x3c0 fs/namei.c:3525
       do_sys_openat2+0x16d/0x420 fs/open.c:1187
       do_sys_open fs/open.c:1203 [inline]
       __do_sys_open fs/open.c:1211 [inline]
       __se_sys_open fs/open.c:1207 [inline]
       __x64_sys_open+0x119/0x1c0 fs/open.c:1207
       do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xae

-> #1 (jbd2_handle){++++}-{0:0}:
       start_this_handle+0xfb9/0x1380 fs/jbd2/transaction.c:446
       jbd2__journal_start+0x399/0x930 fs/jbd2/transaction.c:503
       __ext4_journal_start_sb+0x227/0x4a0 fs/ext4/ext4_jbd2.c:105
       ext4_sample_last_mounted fs/ext4/file.c:803 [inline]
       ext4_file_open+0x613/0xb50 fs/ext4/file.c:831
       do_dentry_open+0x4b9/0x11b0 fs/open.c:826
       do_open fs/namei.c:3365 [inline]
       path_openat+0x1c0e/0x27e0 fs/namei.c:3498
       do_filp_open+0x17e/0x3c0 fs/namei.c:3525
       do_sys_openat2+0x16d/0x420 fs/open.c:1187
       do_sys_open fs/open.c:1203 [inline]
       __do_sys_open fs/open.c:1211 [inline]
       __se_sys_open fs/open.c:1207 [inline]
       __x64_sys_open+0x119/0x1c0 fs/open.c:1207
       do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xae

-> #0 (sb_internal){.+.+}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:2936 [inline]
       check_prevs_add kernel/locking/lockdep.c:3059 [inline]
       validate_chain kernel/locking/lockdep.c:3674 [inline]
       __lock_acquire+0x2b14/0x54c0 kernel/locking/lockdep.c:4900
       lock_acquire kernel/locking/lockdep.c:5510 [inline]
       lock_acquire+0x1ab/0x730 kernel/locking/lockdep.c:5475
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1640 [inline]
       sb_start_intwrite include/linux/fs.h:1757 [inline]
       ext4_evict_inode+0xe74/0x1940 fs/ext4/inode.c:242
       evict+0x2ed/0x6b0 fs/inode.c:578
       iput_final fs/inode.c:1654 [inline]
       iput.part.0+0x57e/0x810 fs/inode.c:1680
       iput fs/inode.c:1670 [inline]
       inode_lru_isolate+0x301/0x4f0 fs/inode.c:779
       __list_lru_walk_one+0x178/0x5c0 mm/list_lru.c:222
       list_lru_walk_one+0x99/0xd0 mm/list_lru.c:266
       list_lru_shrink_walk include/linux/list_lru.h:195 [inline]
       prune_icache_sb+0xdc/0x140 fs/inode.c:804
       super_cache_scan+0x38d/0x590 fs/super.c:107
       do_shrink_slab+0x3e4/0x9f0 mm/vmscan.c:512
       shrink_slab+0x16f/0x5d0 mm/vmscan.c:673
       shrink_node_memcgs mm/vmscan.c:2655 [inline]
       shrink_node+0x8d1/0x1de0 mm/vmscan.c:2770
       kswapd_shrink_node mm/vmscan.c:3513 [inline]
       balance_pgdat+0x745/0x1270 mm/vmscan.c:3671
       kswapd+0x5b6/0xdb0 mm/vmscan.c:3928
       kthread+0x3b1/0x4a0 kernel/kthread.c:292
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294

other info that might help us debug this:

Chain exists of:
  sb_internal --> &ei->xattr_sem --> fs_reclaim

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(fs_reclaim);
                               lock(&ei->xattr_sem);
                               lock(fs_reclaim);
  lock(sb_internal);

 *** DEADLOCK ***

3 locks held by kswapd0/2199:
 #0: ffffffff8c08bf40 (fs_reclaim){+.+.}-{0:0}, at: __fs_reclaim_acquire+0x0/0x30 mm/page_alloc.c:5198
 #1: ffffffff8c0531b0 (shrinker_rwsem){++++}-{3:3}, at: shrink_slab+0xc7/0x5d0 mm/vmscan.c:663
 #2: ffff88801ee080e0 (&type->s_umount_key#51){++++}-{3:3}, at: trylock_super fs/super.c:418 [inline]
 #2: ffff88801ee080e0 (&type->s_umount_key#51){++++}-{3:3}, at: super_cache_scan+0x6c/0x590 fs/super.c:80

stack backtrace:
CPU: 2 PID: 2199 Comm: kswapd0 Not tainted 5.12.0-rc1-syzkaller #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014
Call Trace:
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0xfa/0x151 lib/dump_stack.c:120
 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2127
 check_prev_add kernel/locking/lockdep.c:2936 [inline]
 check_prevs_add kernel/locking/lockdep.c:3059 [inline]
 validate_chain kernel/locking/lockdep.c:3674 [inline]
 __lock_acquire+0x2b14/0x54c0 kernel/locking/lockdep.c:4900
 lock_acquire kernel/locking/lockdep.c:5510 [inline]
 lock_acquire+0x1ab/0x730 kernel/locking/lockdep.c:5475
 percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
 __sb_start_write include/linux/fs.h:1640 [inline]
 sb_start_intwrite include/linux/fs.h:1757 [inline]
 ext4_evict_inode+0xe74/0x1940 fs/ext4/inode.c:242
 evict+0x2ed/0x6b0 fs/inode.c:578
 iput_final fs/inode.c:1654 [inline]
 iput.part.0+0x57e/0x810 fs/inode.c:1680
 iput fs/inode.c:1670 [inline]
 inode_lru_isolate+0x301/0x4f0 fs/inode.c:779
 __list_lru_walk_one+0x178/0x5c0 mm/list_lru.c:222
 list_lru_walk_one+0x99/0xd0 mm/list_lru.c:266
 list_lru_shrink_walk include/linux/list_lru.h:195 [inline]
 prune_icache_sb+0xdc/0x140 fs/inode.c:804
 super_cache_scan+0x38d/0x590 fs/super.c:107
 do_shrink_slab+0x3e4/0x9f0 mm/vmscan.c:512
 shrink_slab+0x16f/0x5d0 mm/vmscan.c:673
 shrink_node_memcgs mm/vmscan.c:2655 [inline]
 shrink_node+0x8d1/0x1de0 mm/vmscan.c:2770
 kswapd_shrink_node mm/vmscan.c:3513 [inline]
 balance_pgdat+0x745/0x1270 mm/vmscan.c:3671
 kswapd+0x5b6/0xdb0 mm/vmscan.c:3928
 kthread+0x3b1/0x4a0 kernel/kthread.c:292
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294

Crashes (3):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-qemu-upstream 2021/03/13 09:39 upstream 280d542f6ffa 4a003785 .config log report info possible deadlock in evict
ci-qemu-upstream 2021/02/13 09:42 upstream c6d8570e4d64 98682e5e .config log report info possible deadlock in evict
ci-qemu-upstream-386 2021/03/10 22:34 upstream 280d542f6ffa 764067f3 .config log report info possible deadlock in evict