======================================================
WARNING: possible circular locking dependency detected
6.2.0-rc5-next-20230127 #1 Not tainted
------------------------------------------------------
syz-executor.4/11876 is trying to acquire lock:
ffff88800ffc4170 (&journal->j_barrier){+.+.}-{3:3}, at: jbd2_journal_lock_updates+0x162/0x310
but task is already holding lock:
ffff88800ffc2b90 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: ext4_change_inode_journal_flag+0x17f/0x550
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #3 (&sbi->s_writepages_rwsem){++++}-{0:0}:
percpu_down_write+0x51/0x350
ext4_ind_migrate+0x23b/0x840
ext4_fileattr_set+0x1521/0x19f0
vfs_fileattr_set+0x7a2/0xbd0
do_vfs_ioctl+0xfc1/0x1690
__x64_sys_ioctl+0x110/0x210
do_syscall_64+0x3f/0x90
entry_SYSCALL_64_after_hwframe+0x72/0xdc
-> #2 (&sb->s_type->i_mutex_key#6){++++}-{3:3}:
down_read+0x3d/0x50
ext4_bmap+0x52/0x470
bmap+0xb0/0x130
jbd2_journal_bmap+0xac/0x1d0
jbd2_journal_flush+0x87f/0xc90
__ext4_ioctl+0x9fd/0x4330
__x64_sys_ioctl+0x19e/0x210
do_syscall_64+0x3f/0x90
entry_SYSCALL_64_after_hwframe+0x72/0xdc
-> #1 (&journal->j_checkpoint_mutex){+.+.}-{3:3}:
mutex_lock_io_nested+0x149/0x1300
jbd2_journal_flush+0x19e/0xc90
__ext4_ioctl+0x9fd/0x4330
__x64_sys_ioctl+0x19e/0x210
do_syscall_64+0x3f/0x90
entry_SYSCALL_64_after_hwframe+0x72/0xdc
-> #0 (&journal->j_barrier){+.+.}-{3:3}:
__lock_acquire+0x2da7/0x63b0
lock_acquire.part.0+0xec/0x320
__mutex_lock+0x133/0x14a0
jbd2_journal_lock_updates+0x162/0x310
ext4_change_inode_journal_flag+0x187/0x550
ext4_fileattr_set+0x14fa/0x19f0
vfs_fileattr_set+0x7a2/0xbd0
do_vfs_ioctl+0xfc1/0x1690
__x64_sys_ioctl+0x110/0x210
do_syscall_64+0x3f/0x90
entry_SYSCALL_64_after_hwframe+0x72/0xdc
other info that might help us debug this:
Chain exists of:
&journal->j_barrier --> &sb->s_type->i_mutex_key#6 --> &sbi->s_writepages_rwsem
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&sbi->s_writepages_rwsem);
lock(&sb->s_type->i_mutex_key#6);
lock(&sbi->s_writepages_rwsem);
lock(&journal->j_barrier);
*** DEADLOCK ***
4 locks held by syz-executor.4/11876:
#0: ffff88800ffc0438 (sb_writers#3){.+.+}-{0:0}, at: do_vfs_ioctl+0xf86/0x1690
#1: ffff88801b27e760 (&sb->s_type->i_mutex_key#6){++++}-{3:3}, at: vfs_fileattr_set+0x14c/0xbd0
#2: ffff88801b27e900 (mapping.invalidate_lock){++++}-{3:3}, at: ext4_change_inode_journal_flag+0x126/0x550
#3: ffff88800ffc2b90 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: ext4_change_inode_journal_flag+0x17f/0x550
stack backtrace:
CPU: 1 PID: 11876 Comm: syz-executor.4 Not tainted 6.2.0-rc5-next-20230127 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
Call Trace:
dump_stack_lvl+0x91/0xf0
check_noncircular+0x263/0x2e0
__lock_acquire+0x2da7/0x63b0
lock_acquire.part.0+0xec/0x320
__mutex_lock+0x133/0x14a0
jbd2_journal_lock_updates+0x162/0x310
ext4_change_inode_journal_flag+0x187/0x550
ext4_fileattr_set+0x14fa/0x19f0
vfs_fileattr_set+0x7a2/0xbd0
do_vfs_ioctl+0xfc1/0x1690
__x64_sys_ioctl+0x110/0x210
do_syscall_64+0x3f/0x90
entry_SYSCALL_64_after_hwframe+0x72/0xdc
RIP: 0033:0x7fe64d2e8b19
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe64a85e188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fe64d3fbf60 RCX: 00007fe64d2e8b19
RDX: 0000000020000040 RSI: 0000000040086602 RDI: 0000000000000003
RBP: 00007fe64d342f6d R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fff99c8741f R14: 00007fe64a85e300 R15: 0000000000022000
mmap: syz-executor.6 (11887) uses deprecated remap_file_pages() syscall. See Documentation/mm/remap_file_pages.rst.
Bluetooth: hci7: command 0x0406 tx timeout
sg_write: data in/out 912/1 bytes for SCSI command 0x10-- guessing data in;
program syz-executor.1 not setting count and/or reply_len properly
------------[ cut here ]------------
WARNING: CPU: 0 PID: 12356 at lib/iov_iter.c:629 _copy_from_iter+0x2b2/0x1140
Modules linked in:
CPU: 0 PID: 12356 Comm: syz-executor.1 Not tainted 6.2.0-rc5-next-20230127 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
RIP: 0010:_copy_from_iter+0x2b2/0x1140
Code: 5d 41 5e 41 5f e9 c2 55 32 02 e8 29 04 36 ff be 79 02 00 00 48 c7 c7 40 c4 9e 84 e8 a8 b2 59 ff e9 51 fe ff ff e8 0e 04 36 ff <0f> 0b 45 31 f6 eb 87 e8 02 04 36 ff 31 ff 89 ee e8 69 ff 35 ff 40
RSP: 0018:ffff888034777608 EFLAGS: 00010212
RAX: 00000000000015a5 RBX: 0000000000000000 RCX: ffffc9000e83f000
RDX: 0000000000040000 RSI: ffffffff82155922 RDI: 0000000000000001
RBP: 0000000000000390 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
R13: ffff888034777838 R14: 0000000000000390 R15: ffff888034777838
FS: 00007fca7ee70700(0000) GS:ffff88806ce00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000555555dee3bc CR3: 0000000045382000 CR4: 0000000000350ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff4ff0 DR7: 0000000000000400
Call Trace:
copy_page_from_iter+0x251/0x430
blk_rq_map_user_iov+0xb41/0x16c0
blk_rq_map_user_io+0x1d1/0x200
sg_common_write.constprop.0+0xd8d/0x15f0
sg_write.part.0+0x698/0xac0
sg_write+0x8d/0xe0
vfs_write+0x2cf/0xdc0
ksys_write+0x12b/0x260
do_syscall_64+0x3f/0x90
entry_SYSCALL_64_after_hwframe+0x72/0xdc
RIP: 0033:0x7fca818fab19
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fca7ee70188 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007fca81a0df60 RCX: 00007fca818fab19
RDX: 000000000000002b RSI: 0000000020000380 RDI: 0000000000000007
RBP: 00007fca81954f6d R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffca562156f R14: 00007fca7ee70300 R15: 0000000000022000
irq event stamp: 0
hardirqs last enabled at (0): [<0000000000000000>] 0x0
hardirqs last disabled at (0): [] copy_process+0x1b78/0x7390
softirqs last enabled at (0): [] copy_process+0x1bbc/0x7390
softirqs last disabled at (0): [<0000000000000000>] 0x0
---[ end trace 0000000000000000 ]---