======================================================
WARNING: possible circular locking dependency detected
6.1.38-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.2/30896 is trying to acquire lock:
ffff888143380650 (sb_internal){.+.+}-{0:0}, at: __sb_start_write include/linux/fs.h:1832 [inline]
ffff888143380650 (sb_internal){.+.+}-{0:0}, at: sb_start_intwrite include/linux/fs.h:1954 [inline]
ffff888143380650 (sb_internal){.+.+}-{0:0}, at: ext4_evict_inode+0x46d/0x1150 fs/ext4/inode.c:240
but task is already holding lock:
ffff888143382b98 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: ext4_ext_migrate+0x314/0x12f0 fs/ext4/migrate.c:437
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #3 (&sbi->s_writepages_rwsem){++++}-{0:0}:
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
percpu_down_read+0x44/0x1a0 include/linux/percpu-rwsem.h:51
ext4_writepages+0x1e5/0x3de0 fs/ext4/inode.c:2701
do_writepages+0x3a2/0x670 mm/page-writeback.c:2469
filemap_fdatawrite_wbc+0x121/0x180 mm/filemap.c:388
__filemap_fdatawrite_range mm/filemap.c:421 [inline]
filemap_write_and_wait_range+0x1a4/0x290 mm/filemap.c:674
__iomap_dio_rw+0xb38/0x2240 fs/iomap/direct-io.c:573
iomap_dio_rw+0x42/0xa0 fs/iomap/direct-io.c:690
ext4_dio_write_iter fs/ext4/file.c:587 [inline]
ext4_file_write_iter+0x14ec/0x18f0 fs/ext4/file.c:698
do_iter_write+0x6e6/0xc50 fs/read_write.c:861
iter_file_splice_write+0x806/0xfa0 fs/splice.c:686
do_splice_from fs/splice.c:764 [inline]
direct_splice_actor+0xe3/0x1c0 fs/splice.c:931
splice_direct_to_actor+0x4c0/0xbd0 fs/splice.c:886
do_splice_direct+0x27f/0x3c0 fs/splice.c:974
do_sendfile+0x61c/0xff0 fs/read_write.c:1255
__do_sys_sendfile64 fs/read_write.c:1323 [inline]
__se_sys_sendfile64+0x178/0x1e0 fs/read_write.c:1309
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
-> #2 (&sb->s_type->i_mutex_key#8){++++}-{3:3}:
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
down_read+0x43/0x2e0 kernel/locking/rwsem.c:1520
inode_lock_shared include/linux/fs.h:766 [inline]
ext4_bmap+0x4b/0x410 fs/ext4/inode.c:3174
bmap+0xa1/0xd0 fs/inode.c:1798
jbd2_journal_bmap fs/jbd2/journal.c:977 [inline]
__jbd2_journal_erase fs/jbd2/journal.c:1789 [inline]
jbd2_journal_flush+0x5b5/0xc40 fs/jbd2/journal.c:2492
ext4_ioctl_checkpoint fs/ext4/ioctl.c:1083 [inline]
__ext4_ioctl fs/ext4/ioctl.c:1591 [inline]
ext4_ioctl+0x39e0/0x5f70 fs/ext4/ioctl.c:1611
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl+0xf1/0x160 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
-> #1 (&journal->j_checkpoint_mutex){+.+.}-{3:3}:
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
__mutex_lock_common+0x1d4/0x2520 kernel/locking/mutex.c:603
mutex_lock_io_nested+0x43/0x60 kernel/locking/mutex.c:833
__jbd2_log_wait_for_space+0x213/0x760 fs/jbd2/checkpoint.c:110
add_transaction_credits+0x94c/0xc00 fs/jbd2/transaction.c:298
start_this_handle+0x747/0x1640 fs/jbd2/transaction.c:422
jbd2__journal_start+0x2d1/0x5c0 fs/jbd2/transaction.c:520
__ext4_journal_start_sb+0x19b/0x410 fs/ext4/ext4_jbd2.c:105
__ext4_journal_start fs/ext4/ext4_jbd2.h:326 [inline]
ext4_evict_inode+0x8dc/0x1150 fs/ext4/inode.c:251
evict+0x2a4/0x620 fs/inode.c:664
__dentry_kill+0x436/0x650 fs/dcache.c:607
dentry_kill+0xbb/0x290
dput+0x1ef/0x420 fs/dcache.c:913
path_put+0x35/0x60 fs/namei.c:558
free_fs_struct fs/fs_struct.c:91 [inline]
exit_fs+0xe1/0x140 fs/fs_struct.c:108
do_exit+0x6e4/0x2300 kernel/exit.c:865
__do_sys_exit kernel/exit.c:986 [inline]
__se_sys_exit kernel/exit.c:984 [inline]
__x64_sys_exit+0x3c/0x40 kernel/exit.c:984
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
-> #0 (sb_internal){.+.+}-{0:0}:
check_prev_add kernel/locking/lockdep.c:3098 [inline]
check_prevs_add kernel/locking/lockdep.c:3217 [inline]
validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832
__lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
percpu_down_read+0x44/0x1a0 include/linux/percpu-rwsem.h:51
__sb_start_write include/linux/fs.h:1832 [inline]
sb_start_intwrite include/linux/fs.h:1954 [inline]
ext4_evict_inode+0x46d/0x1150 fs/ext4/inode.c:240
evict+0x2a4/0x620 fs/inode.c:664
ext4_ext_migrate+0x100b/0x12f0 fs/ext4/migrate.c:587
__ext4_ioctl fs/ext4/ioctl.c:1393 [inline]
ext4_ioctl+0x1dea/0x5f70 fs/ext4/ioctl.c:1611
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl+0xf1/0x160 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
other info that might help us debug this:
Chain exists of:
sb_internal --> &sb->s_type->i_mutex_key#8 --> &sbi->s_writepages_rwsem
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&sbi->s_writepages_rwsem);
lock(&sb->s_type->i_mutex_key#8);
lock(&sbi->s_writepages_rwsem);
lock(sb_internal);
*** DEADLOCK ***
3 locks held by syz-executor.2/30896:
#0: ffff888143380460 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write_file+0x5a/0x1f0 fs/namespace.c:437
#1: ffff8880330eac20 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: inode_lock include/linux/fs.h:756 [inline]
#1: ffff8880330eac20 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: __ext4_ioctl fs/ext4/ioctl.c:1392 [inline]
#1: ffff8880330eac20 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: ext4_ioctl+0x1de2/0x5f70 fs/ext4/ioctl.c:1611
#2: ffff888143382b98 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: ext4_ext_migrate+0x314/0x12f0 fs/ext4/migrate.c:437
stack backtrace:
CPU: 1 PID: 30896 Comm: syz-executor.2 Not tainted 6.1.38-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/03/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
check_noncircular+0x2fa/0x3b0 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+0x1667/0x58e0 kernel/locking/lockdep.c:3832
__lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
percpu_down_read+0x44/0x1a0 include/linux/percpu-rwsem.h:51
__sb_start_write include/linux/fs.h:1832 [inline]
sb_start_intwrite include/linux/fs.h:1954 [inline]
ext4_evict_inode+0x46d/0x1150 fs/ext4/inode.c:240
evict+0x2a4/0x620 fs/inode.c:664
ext4_ext_migrate+0x100b/0x12f0 fs/ext4/migrate.c:587
__ext4_ioctl fs/ext4/ioctl.c:1393 [inline]
ext4_ioctl+0x1dea/0x5f70 fs/ext4/ioctl.c:1611
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl+0xf1/0x160 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fcb5b08c389
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fcb5bd9b168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fcb5b1ac120 RCX: 00007fcb5b08c389
RDX: 0000000000000000 RSI: 0000000000006609 RDI: 0000000000000004
RBP: 00007fcb5b0d7493 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffd9806350f R14: 00007fcb5bd9b300 R15: 0000000000022000
</TASK>