syzbot


possible deadlock in fs_reclaim_acquire (2)

Status: auto-closed as invalid on 2021/06/26 23:23
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+a7ab8df042baaf42ae3c@syzkaller.appspotmail.com
First crash: 1117d, last: 1097d
Discussions (4)
Title Replies (including bot) Last reply
possible deadlock in start_this_handle (2) 29 (30) 2021/03/20 10:02
Re: possible deadlock in fs_reclaim_acquire (2) 4 (4) 2021/02/11 12:43
Re: possible deadlock in fs_reclaim_acquire (2) 1 (1) 2021/02/11 12:12
possible deadlock in fs_reclaim_acquire (2) 0 (1) 2021/02/11 01:25
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in fs_reclaim_acquire (3) kernel C error 10538 940d 970d 0/26 closed as dup on 2021/07/07 11:37
upstream possible deadlock in fs_reclaim_acquire perf 1 1880d 1879d 0/26 auto-closed as invalid on 2019/07/04 21:33
upstream possible deadlock in fs_reclaim_acquire (4) reiserfs 3 374d 449d 0/26 auto-obsoleted due to no activity on 2023/06/19 22:26

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.11.0-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.3/28819 is trying to acquire lock:
ffffffff8c08c3c0 (fs_reclaim){+.+.}-{0:0}, at: fs_reclaim_acquire+0xf7/0x150 mm/page_alloc.c:4349

but task is already holding lock:
ffff88802011e4c8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_write_lock_xattr fs/ext4/xattr.h:142 [inline]
ffff88802011e4c8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_xattr_set_handle+0x15c/0x13e0 fs/ext4/xattr.c:2308

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&ei->xattr_sem){++++}-{3:3}:
       down_read+0x9a/0x440 kernel/locking/rwsem.c:1353
       ext4_setattr+0x57a/0x1fe0 fs/ext4/inode.c:5373
       notify_change+0xb28/0x10f0 fs/attr.c:398
       chown_common+0x501/0x5c0 fs/open.c:682
       vfs_fchown fs/open.c:750 [inline]
       vfs_fchown fs/open.c:742 [inline]
       ksys_fchown+0x111/0x170 fs/open.c:761
       __do_sys_fchown fs/open.c:769 [inline]
       __se_sys_fchown fs/open.c:767 [inline]
       __x64_sys_fchown+0x6f/0xb0 fs/open.c:767
       do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xae

-> #2 (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

-> #1 (sb_internal){.+.+}-{0:0}:
       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:577
       iput_final fs/inode.c:1653 [inline]
       iput.part.0+0x57e/0x810 fs/inode.c:1679
       iput fs/inode.c:1669 [inline]
       inode_lru_isolate+0x301/0x4f0 fs/inode.c:778
       __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:803
       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

-> #0 (fs_reclaim){+.+.}-{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
       __fs_reclaim_acquire mm/page_alloc.c:4327 [inline]
       fs_reclaim_acquire+0x117/0x150 mm/page_alloc.c:4341
       prepare_alloc_pages mm/page_alloc.c:4939 [inline]
       __alloc_pages_nodemask+0x169/0x730 mm/page_alloc.c:4986
       __alloc_pages include/linux/gfp.h:525 [inline]
       __alloc_pages_node include/linux/gfp.h:538 [inline]
       alloc_pages_node include/linux/gfp.h:552 [inline]
       kmalloc_large_node+0x5e/0x110 mm/slub.c:4069
       __kmalloc_node+0x2c6/0x370 mm/slub.c:4085
       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]
       __ia32_sys_setxattr+0xbc/0x150 fs/xattr.c:605
       do_syscall_32_irqs_on arch/x86/entry/common.c:77 [inline]
       __do_fast_syscall_32+0x56/0x80 arch/x86/entry/common.c:139
       do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:164
       entry_SYSENTER_compat_after_hwframe+0x4d/0x5c

other info that might help us debug this:

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

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

3 locks held by syz-executor.3/28819:
 #0: ffff888028a98460 (sb_writers#5){.+.+}-{0:0}, at: path_setxattr+0xb2/0x1c0 fs/xattr.c:591
 #1: ffff88802011e888 (&type->i_mutex_dir_key#4){++++}-{3:3}, at: inode_lock include/linux/fs.h:775 [inline]
 #1: ffff88802011e888 (&type->i_mutex_dir_key#4){++++}-{3:3}, at: vfs_setxattr+0x11c/0x330 fs/xattr.c:299
 #2: ffff88802011e4c8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_write_lock_xattr fs/ext4/xattr.h:142 [inline]
 #2: ffff88802011e4c8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_xattr_set_handle+0x15c/0x13e0 fs/ext4/xattr.c:2308

stack backtrace:
CPU: 2 PID: 28819 Comm: syz-executor.3 Not tainted 5.11.0-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
 __fs_reclaim_acquire mm/page_alloc.c:4327 [inline]
 fs_reclaim_acquire+0x117/0x150 mm/page_alloc.c:4341
 prepare_alloc_pages mm/page_alloc.c:4939 [inline]
 __alloc_pages_nodemask+0x169/0x730 mm/page_alloc.c:4986
 __alloc_pages include/linux/gfp.h:525 [inline]
 __alloc_pages_node include/linux/gfp.h:538 [inline]
 alloc_pages_node include/linux/gfp.h:552 [inline]
 kmalloc_large_node+0x5e/0x110 mm/slub.c:4069
 __kmalloc_node+0x2c6/0x370 mm/slub.c:4085
 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]
 __ia32_sys_setxattr+0xbc/0x150 fs/xattr.c:605
 do_syscall_32_irqs_on arch/x86/entry/common.c:77 [inline]
 __do_fast_syscall_32+0x56/0x80 arch/x86/entry/common.c:139
 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:164
 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c
RIP: 0023:0xf7f59549
Code: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00
RSP: 002b:00000000f55535fc EFLAGS: 00000296 ORIG_RAX: 00000000000000e2
RAX: ffffffffffffffda RBX: 0000000020000080 RCX: 00000000200000c0
RDX: 0000000020000380 RSI: 000000000000c001 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/02/26 23:22 upstream 3fb6d0e00efc 4c37c133 .config console log report info ci-qemu-upstream-386 possible deadlock in fs_reclaim_acquire
2021/02/23 17:43 upstream 3b9cdafb5358 fcc6d71b .config console log report info ci-qemu-upstream-386 possible deadlock in fs_reclaim_acquire
2021/02/07 01:15 upstream 825b5991a46e 0655e081 .config console log report info ci-qemu-upstream-386 possible deadlock in fs_reclaim_acquire
* Struck through repros no longer work on HEAD.