RBP: 00007fa38afdc120 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 000000000000000b R14: 00007fa38a39bf80 R15: 00007ffdf6c36318 ====================================================== WARNING: possible circular locking dependency detected 6.7.0-rc4-syzkaller-00141-g1ae4cd3cbdd0 #0 Not tainted ------------------------------------------------------ syz-executor.4/1916 is trying to acquire lock: ffffffff8d11c9e0 (fs_reclaim){+.+.}-{0:0}, at: might_alloc include/linux/sched/mm.h:303 [inline] ffffffff8d11c9e0 (fs_reclaim){+.+.}-{0:0}, at: slab_pre_alloc_hook mm/slab.h:710 [inline] ffffffff8d11c9e0 (fs_reclaim){+.+.}-{0:0}, at: slab_alloc_node mm/slub.c:3460 [inline] ffffffff8d11c9e0 (fs_reclaim){+.+.}-{0:0}, at: slab_alloc mm/slub.c:3486 [inline] ffffffff8d11c9e0 (fs_reclaim){+.+.}-{0:0}, at: __kmem_cache_alloc_lru mm/slub.c:3493 [inline] ffffffff8d11c9e0 (fs_reclaim){+.+.}-{0:0}, at: kmem_cache_alloc+0x4f/0x2f0 mm/slub.c:3502 but task is already holding lock: ffff8880b0b82a88 (&ei->i_data_sem){++++}-{3:3}, at: ext4_da_map_blocks fs/ext4/inode.c:1745 [inline] ffff8880b0b82a88 (&ei->i_data_sem){++++}-{3:3}, at: ext4_da_get_block_prep+0x6c9/0x1340 fs/ext4/inode.c:1823 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&ei->i_data_sem){++++}-{3:3}: down_write+0x3a/0x50 kernel/locking/rwsem.c:1579 ext4_map_blocks+0x5a7/0x1770 fs/ext4/inode.c:614 mpage_map_one_extent fs/ext4/inode.c:2169 [inline] mpage_map_and_submit_extent fs/ext4/inode.c:2222 [inline] ext4_do_writepages+0x184e/0x3350 fs/ext4/inode.c:2685 ext4_writepages+0x30c/0x780 fs/ext4/inode.c:2774 do_writepages+0x1b4/0x690 mm/page-writeback.c:2553 __writeback_single_inode+0x158/0xe90 fs/fs-writeback.c:1625 writeback_sb_inodes+0x599/0x1080 fs/fs-writeback.c:1916 __writeback_inodes_wb+0xff/0x2d0 fs/fs-writeback.c:1987 wb_writeback+0x7f8/0xaa0 fs/fs-writeback.c:2094 wb_check_background_flush fs/fs-writeback.c:2164 [inline] wb_do_writeback fs/fs-writeback.c:2252 [inline] wb_workfn+0x87c/0xfe0 fs/fs-writeback.c:2279 process_one_work+0x886/0x15d0 kernel/workqueue.c:2627 process_scheduled_works kernel/workqueue.c:2700 [inline] worker_thread+0x8b9/0x1290 kernel/workqueue.c:2781 kthread+0x2c6/0x3a0 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 -> #2 (jbd2_handle){++++}-{0:0}: start_this_handle+0x10ff/0x15e0 fs/jbd2/transaction.c:463 jbd2__journal_start+0x391/0x840 fs/jbd2/transaction.c:520 __ext4_journal_start_sb+0x343/0x5d0 fs/ext4/ext4_jbd2.c:112 ext4_sample_last_mounted fs/ext4/file.c:835 [inline] ext4_file_open+0x632/0xc80 fs/ext4/file.c:864 do_dentry_open+0x8d6/0x18c0 fs/open.c:948 do_open fs/namei.c:3622 [inline] path_openat+0x1e5a/0x2c50 fs/namei.c:3779 do_filp_open+0x1de/0x430 fs/namei.c:3809 do_sys_openat2+0x176/0x1e0 fs/open.c:1440 do_sys_open fs/open.c:1455 [inline] __do_sys_openat fs/open.c:1471 [inline] __se_sys_openat fs/open.c:1466 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1466 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b -> #1 (sb_internal){.+.+}-{0:0}: percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1635 [inline] sb_start_intwrite include/linux/fs.h:1757 [inline] ext4_evict_inode+0xe5b/0x1a40 fs/ext4/inode.c:212 evict+0x2ed/0x6b0 fs/inode.c:666 iput_final fs/inode.c:1777 [inline] iput.part.0+0x560/0x7b0 fs/inode.c:1803 iput+0x5c/0x80 fs/inode.c:1793 dentry_unlink_inode+0x292/0x430 fs/dcache.c:401 __dentry_kill+0x3b8/0x640 fs/dcache.c:607 shrink_dentry_list+0x11e/0x4a0 fs/dcache.c:1201 prune_dcache_sb+0xeb/0x150 fs/dcache.c:1282 super_cache_scan+0x327/0x540 fs/super.c:228 do_shrink_slab+0x428/0x1120 mm/shrinker.c:435 shrink_slab_memcg mm/shrinker.c:548 [inline] shrink_slab+0xa83/0x1310 mm/shrinker.c:626 shrink_one+0x4f7/0x700 mm/vmscan.c:4724 shrink_many mm/vmscan.c:4776 [inline] lru_gen_shrink_node mm/vmscan.c:4893 [inline] shrink_node+0x20cd/0x3790 mm/vmscan.c:5833 kswapd_shrink_node mm/vmscan.c:6638 [inline] balance_pgdat+0x9d2/0x1a90 mm/vmscan.c:6828 kswapd+0x5be/0xbf0 mm/vmscan.c:7088 kthread+0x2c6/0x3a0 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 -> #0 (fs_reclaim){+.+.}-{0:0}: 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+0x2433/0x3b20 kernel/locking/lockdep.c:5137 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1ae/0x520 kernel/locking/lockdep.c:5719 __fs_reclaim_acquire mm/page_alloc.c:3693 [inline] fs_reclaim_acquire+0x100/0x150 mm/page_alloc.c:3707 might_alloc include/linux/sched/mm.h:303 [inline] slab_pre_alloc_hook mm/slab.h:710 [inline] slab_alloc_node mm/slub.c:3460 [inline] slab_alloc mm/slub.c:3486 [inline] __kmem_cache_alloc_lru mm/slub.c:3493 [inline] kmem_cache_alloc+0x4f/0x2f0 mm/slub.c:3502 kmem_cache_zalloc include/linux/slab.h:711 [inline] __es_alloc_extent fs/ext4/extents_status.c:483 [inline] ext4_es_insert_delayed_block+0x542/0x760 fs/ext4/extents_status.c:2090 ext4_insert_delayed_block fs/ext4/inode.c:1674 [inline] ext4_da_map_blocks fs/ext4/inode.c:1762 [inline] ext4_da_get_block_prep+0x850/0x1340 fs/ext4/inode.c:1823 ext4_block_write_begin+0x3da/0xee0 fs/ext4/inode.c:1053 ext4_da_write_begin+0x40a/0x8c0 fs/ext4/inode.c:2900 generic_perform_write+0x278/0x600 mm/filemap.c:3918 ext4_buffered_write_iter+0x11f/0x3c0 fs/ext4/file.c:299 ext4_file_write_iter+0x819/0x1950 fs/ext4/file.c:696 call_write_iter include/linux/fs.h:2020 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x64f/0xdf0 fs/read_write.c:584 ksys_write+0x12f/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b other info that might help us debug this: Chain exists of: fs_reclaim --> jbd2_handle --> &ei->i_data_sem Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(&ei->i_data_sem); lock(jbd2_handle); lock(&ei->i_data_sem); lock(fs_reclaim); *** DEADLOCK *** 4 locks held by syz-executor.4/1916: #0: ffff88819c0d05c8 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0xe7/0x170 fs/file.c:1177 #1: ffff88814cb9c418 (sb_writers#4){.+.+}-{0:0}, at: ksys_write+0x12f/0x250 fs/read_write.c:637 #2: ffff8880b0b82c00 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: inode_lock include/linux/fs.h:802 [inline] #2: ffff8880b0b82c00 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: ext4_buffered_write_iter+0xb0/0x3c0 fs/ext4/file.c:294 #3: ffff8880b0b82a88 (&ei->i_data_sem){++++}-{3:3}, at: ext4_da_map_blocks fs/ext4/inode.c:1745 [inline] #3: ffff8880b0b82a88 (&ei->i_data_sem){++++}-{3:3}, at: ext4_da_get_block_prep+0x6c9/0x1340 fs/ext4/inode.c:1823 stack backtrace: CPU: 1 PID: 1916 Comm: syz-executor.4 Not tainted 6.7.0-rc4-syzkaller-00141-g1ae4cd3cbdd0 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 check_noncircular+0x317/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+0x2433/0x3b20 kernel/locking/lockdep.c:5137 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1ae/0x520 kernel/locking/lockdep.c:5719 __fs_reclaim_acquire mm/page_alloc.c:3693 [inline] fs_reclaim_acquire+0x100/0x150 mm/page_alloc.c:3707 might_alloc include/linux/sched/mm.h:303 [inline] slab_pre_alloc_hook mm/slab.h:710 [inline] slab_alloc_node mm/slub.c:3460 [inline] slab_alloc mm/slub.c:3486 [inline] __kmem_cache_alloc_lru mm/slub.c:3493 [inline] kmem_cache_alloc+0x4f/0x2f0 mm/slub.c:3502 kmem_cache_zalloc include/linux/slab.h:711 [inline] __es_alloc_extent fs/ext4/extents_status.c:483 [inline] ext4_es_insert_delayed_block+0x542/0x760 fs/ext4/extents_status.c:2090 ext4_insert_delayed_block fs/ext4/inode.c:1674 [inline] ext4_da_map_blocks fs/ext4/inode.c:1762 [inline] ext4_da_get_block_prep+0x850/0x1340 fs/ext4/inode.c:1823 ext4_block_write_begin+0x3da/0xee0 fs/ext4/inode.c:1053 ext4_da_write_begin+0x40a/0x8c0 fs/ext4/inode.c:2900 generic_perform_write+0x278/0x600 mm/filemap.c:3918 ext4_buffered_write_iter+0x11f/0x3c0 fs/ext4/file.c:299 ext4_file_write_iter+0x819/0x1950 fs/ext4/file.c:696 call_write_iter include/linux/fs.h:2020 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x64f/0xdf0 fs/read_write.c:584 ksys_write+0x12f/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7fa38a27cba9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fa38afdc0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007fa38a39bf80 RCX: 00007fa38a27cba9 RDX: 000000000001a51a RSI: 0000000020000180 RDI: 0000000000000004 RBP: 00007fa38afdc120 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 000000000000000b R14: 00007fa38a39bf80 R15: 00007ffdf6c36318