======================================================
WARNING: possible circular locking dependency detected
6.3.0-rc7-syzkaller #0 Not tainted
------------------------------------------------------
kswapd0/111 is trying to acquire lock:
ffff88804006eb98 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: do_writepages+0x1a8/0x640 mm/page-writeback.c:2551
but task is already holding lock:
ffffffff8c8e7420 (fs_reclaim){+.+.}-{0:0}, at: set_task_reclaim_state mm/vmscan.c:200 [inline]
ffffffff8c8e7420 (fs_reclaim){+.+.}-{0:0}, at: balance_pgdat+0x170/0x1ac0 mm/vmscan.c:7338
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:4717 [inline]
fs_reclaim_acquire+0x11d/0x160 mm/page_alloc.c:4731
might_alloc include/linux/sched/mm.h:271 [inline]
slab_pre_alloc_hook mm/slab.h:728 [inline]
slab_alloc_node mm/slub.c:3434 [inline]
slab_alloc mm/slub.c:3460 [inline]
__kmem_cache_alloc_lru mm/slub.c:3467 [inline]
kmem_cache_alloc+0x43/0x3b0 mm/slub.c:3476
kmem_cache_zalloc include/linux/slab.h:710 [inline]
ext4_init_io_end+0x27/0x180 fs/ext4/page-io.c:278
ext4_do_writepages+0xbea/0x31e0 fs/ext4/inode.c:2824
ext4_writepages+0x27c/0x5e0 fs/ext4/inode.c:2964
do_writepages+0x1a8/0x640 mm/page-writeback.c:2551
__writeback_single_inode+0x121/0xdc0 fs/fs-writeback.c:1600
writeback_sb_inodes+0x54d/0xe70 fs/fs-writeback.c:1891
__writeback_inodes_wb+0xc6/0x280 fs/fs-writeback.c:1962
wb_writeback+0x7e9/0xa50 fs/fs-writeback.c:2067
wb_check_background_flush fs/fs-writeback.c:2133 [inline]
wb_do_writeback fs/fs-writeback.c:2221 [inline]
wb_workfn+0x8b0/0xfc0 fs/fs-writeback.c:2248
process_one_work+0x991/0x15c0 kernel/workqueue.c:2390
worker_thread+0x669/0x1090 kernel/workqueue.c:2537
kthread+0x2e8/0x3a0 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
-> #0 (&sbi->s_writepages_rwsem){++++}-{0:0}:
check_prev_add kernel/locking/lockdep.c:3098 [inline]
check_prevs_add kernel/locking/lockdep.c:3217 [inline]
validate_chain kernel/locking/lockdep.c:3832 [inline]
__lock_acquire+0x2ec7/0x5d40 kernel/locking/lockdep.c:5056
lock_acquire kernel/locking/lockdep.c:5669 [inline]
lock_acquire+0x1af/0x520 kernel/locking/lockdep.c:5634
percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
ext4_writepages+0x1a9/0x5e0 fs/ext4/inode.c:2963
do_writepages+0x1a8/0x640 mm/page-writeback.c:2551
__writeback_single_inode+0x121/0xdc0 fs/fs-writeback.c:1600
writeback_single_inode+0x2ad/0x590 fs/fs-writeback.c:1721
write_inode_now+0x16e/0x1e0 fs/fs-writeback.c:2757
iput_final fs/inode.c:1735 [inline]
iput.part.0+0x408/0x740 fs/inode.c:1774
iput+0x5c/0x80 fs/inode.c:1764
dentry_unlink_inode+0x2b1/0x460 fs/dcache.c:401
__dentry_kill+0x3c0/0x640 fs/dcache.c:607
shrink_dentry_list+0x12c/0x4f0 fs/dcache.c:1201
prune_dcache_sb+0xeb/0x150 fs/dcache.c:1282
super_cache_scan+0x33a/0x590 fs/super.c:104
do_shrink_slab+0x428/0xaa0 mm/vmscan.c:853
shrink_slab_memcg mm/vmscan.c:922 [inline]
shrink_slab+0x388/0x660 mm/vmscan.c:1001
shrink_one+0x502/0x810 mm/vmscan.c:5343
shrink_many mm/vmscan.c:5394 [inline]
lru_gen_shrink_node mm/vmscan.c:5511 [inline]
shrink_node+0x2064/0x35f0 mm/vmscan.c:6459
kswapd_shrink_node mm/vmscan.c:7262 [inline]
balance_pgdat+0xa02/0x1ac0 mm/vmscan.c:7452
kswapd+0x677/0xd60 mm/vmscan.c:7712
kthread+0x2e8/0x3a0 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(fs_reclaim);
lock(&sbi->s_writepages_rwsem);
lock(fs_reclaim);
lock(&sbi->s_writepages_rwsem);
*** DEADLOCK ***
3 locks held by kswapd0/111:
#0: ffffffff8c8e7420 (fs_reclaim){+.+.}-{0:0}, at: set_task_reclaim_state mm/vmscan.c:200 [inline]
#0: ffffffff8c8e7420 (fs_reclaim){+.+.}-{0:0}, at: balance_pgdat+0x170/0x1ac0 mm/vmscan.c:7338
#1: ffffffff8c89e190 (shrinker_rwsem){++++}-{3:3}, at: shrink_slab_memcg mm/vmscan.c:895 [inline]
#1: ffffffff8c89e190 (shrinker_rwsem){++++}-{3:3}, at: shrink_slab+0x2a0/0x660 mm/vmscan.c:1001
#2: ffff8880400680e0 (&type->s_umount_key#31){++++}-{3:3}, at: trylock_super fs/super.c:414 [inline]
#2: ffff8880400680e0 (&type->s_umount_key#31){++++}-{3:3}, at: super_cache_scan+0x70/0x590 fs/super.c:79
stack backtrace:
CPU: 2 PID: 111 Comm: kswapd0 Not tainted 6.3.0-rc7-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:88 [inline]
dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2178
check_prev_add kernel/locking/lockdep.c:3098 [inline]
check_prevs_add kernel/locking/lockdep.c:3217 [inline]
validate_chain kernel/locking/lockdep.c:3832 [inline]
__lock_acquire+0x2ec7/0x5d40 kernel/locking/lockdep.c:5056
lock_acquire kernel/locking/lockdep.c:5669 [inline]
lock_acquire+0x1af/0x520 kernel/locking/lockdep.c:5634
percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
ext4_writepages+0x1a9/0x5e0 fs/ext4/inode.c:2963
do_writepages+0x1a8/0x640 mm/page-writeback.c:2551
__writeback_single_inode+0x121/0xdc0 fs/fs-writeback.c:1600
writeback_single_inode+0x2ad/0x590 fs/fs-writeback.c:1721
write_inode_now+0x16e/0x1e0 fs/fs-writeback.c:2757
iput_final fs/inode.c:1735 [inline]
iput.part.0+0x408/0x740 fs/inode.c:1774
iput+0x5c/0x80 fs/inode.c:1764
dentry_unlink_inode+0x2b1/0x460 fs/dcache.c:401
__dentry_kill+0x3c0/0x640 fs/dcache.c:607
shrink_dentry_list+0x12c/0x4f0 fs/dcache.c:1201
prune_dcache_sb+0xeb/0x150 fs/dcache.c:1282
super_cache_scan+0x33a/0x590 fs/super.c:104
do_shrink_slab+0x428/0xaa0 mm/vmscan.c:853
shrink_slab_memcg mm/vmscan.c:922 [inline]
shrink_slab+0x388/0x660 mm/vmscan.c:1001
shrink_one+0x502/0x810 mm/vmscan.c:5343
shrink_many mm/vmscan.c:5394 [inline]
lru_gen_shrink_node mm/vmscan.c:5511 [inline]
shrink_node+0x2064/0x35f0 mm/vmscan.c:6459
kswapd_shrink_node mm/vmscan.c:7262 [inline]
balance_pgdat+0xa02/0x1ac0 mm/vmscan.c:7452
kswapd+0x677/0xd60 mm/vmscan.c:7712
kthread+0x2e8/0x3a0 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
------------[ cut here ]------------
WARNING: CPU: 2 PID: 111 at fs/ext4/inode.c:5325 ext4_write_inode+0x337/0x590 fs/ext4/inode.c:5325
Modules linked in:
CPU: 2 PID: 111 Comm: kswapd0 Not tainted 6.3.0-rc7-syzkaller #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014
RIP: 0010:ext4_write_inode+0x337/0x590 fs/ext4/inode.c:5325
Code: b6 04 02 84 c0 74 08 3c 03 0f 8e 3d 02 00 00 8b b5 b0 06 00 00 4c 89 f7 e8 86 95 12 00 41 89 c4 e9 ed fd ff ff e8 d9 52 59 ff <0f> 0b 45 31 e4 e9 de fd ff ff e8 ca 52 59 ff 48 89 ef 48 8d 74 24
RSP: 0018:ffffc90000e47360 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 1ffff920001c8e6c RCX: 0000000000000000
RDX: ffff8880161ed7c0 RSI: ffffffff82299887 RDI: 0000000000000005
RBP: ffff888027850cb8 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000800 R11: 3e4b5341542f3c20 R12: 0000000000000800
R13: ffffc90000e474e0 R14: dffffc0000000000 R15: ffff888027850ce0
FS: 0000000000000000(0000) GS:ffff88802c800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fdeba7eab60 CR3: 0000000022da6000 CR4: 0000000000150ee0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
write_inode fs/fs-writeback.c:1453 [inline]
__writeback_single_inode+0x9f8/0xdc0 fs/fs-writeback.c:1665
writeback_single_inode+0x2ad/0x590 fs/fs-writeback.c:1721
write_inode_now+0x16e/0x1e0 fs/fs-writeback.c:2757
iput_final fs/inode.c:1735 [inline]
iput.part.0+0x408/0x740 fs/inode.c:1774
iput+0x5c/0x80 fs/inode.c:1764
dentry_unlink_inode+0x2b1/0x460 fs/dcache.c:401
__dentry_kill+0x3c0/0x640 fs/dcache.c:607
shrink_dentry_list+0x12c/0x4f0 fs/dcache.c:1201
prune_dcache_sb+0xeb/0x150 fs/dcache.c:1282
super_cache_scan+0x33a/0x590 fs/super.c:104
do_shrink_slab+0x428/0xaa0 mm/vmscan.c:853
shrink_slab_memcg mm/vmscan.c:922 [inline]
shrink_slab+0x388/0x660 mm/vmscan.c:1001
shrink_one+0x502/0x810 mm/vmscan.c:5343
shrink_many mm/vmscan.c:5394 [inline]
lru_gen_shrink_node mm/vmscan.c:5511 [inline]
shrink_node+0x2064/0x35f0 mm/vmscan.c:6459
kswapd_shrink_node mm/vmscan.c:7262 [inline]
balance_pgdat+0xa02/0x1ac0 mm/vmscan.c:7452
kswapd+0x677/0xd60 mm/vmscan.c:7712
kthread+0x2e8/0x3a0 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308