====================================================== WARNING: possible circular locking dependency detected 6.1.0-rc8-next-20221207 #1 Not tainted ------------------------------------------------------ syz-executor.0/12295 is trying to acquire lock: ffff8880109c2170 (&journal->j_barrier){+.+.}-{3:3}, at: jbd2_journal_lock_updates+0x162/0x310 but task is already holding lock: ffff8880109c0b90 (&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}: ext4_writepages+0x1d6/0x36c0 do_writepages+0x1b4/0x6a0 filemap_fdatawrite_wbc+0x14b/0x1b0 __filemap_fdatawrite_range+0xba/0x100 filemap_write_and_wait_range+0xa5/0x130 __iomap_dio_rw+0x5ea/0x1bd0 iomap_dio_rw+0x40/0xa0 ext4_file_read_iter+0x2f4/0x4a0 generic_file_splice_read+0x18b/0x4d0 do_splice_to+0x1bc/0x240 splice_direct_to_actor+0x2b0/0x8c0 do_splice_direct+0x1bc/0x290 do_sendfile+0xb1d/0x1280 __x64_sys_sendfile64+0x248/0x2a0 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc -> #2 (&sb->s_type->i_mutex_key#6){++++}-{3:3}: down_read+0x9c/0x450 ext4_bmap+0x52/0x470 bmap+0xb0/0x130 jbd2_journal_bmap+0xac/0x190 jbd2_journal_flush+0x857/0xc10 __ext4_ioctl+0x9c5/0x4540 __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+0x14c/0x1330 jbd2_journal_flush+0x19e/0xc10 __ext4_ioctl+0x9c5/0x4540 __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+0x2a02/0x5e70 lock_acquire+0x1a6/0x530 __mutex_lock+0x136/0x14e0 jbd2_journal_lock_updates+0x162/0x310 ext4_change_inode_journal_flag+0x187/0x550 ext4_fileattr_set+0x14fb/0x19f0 vfs_fileattr_set+0x780/0xb90 do_vfs_ioctl+0xa6c/0x1af0 __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.0/12295: #0: ffff88801097e438 (sb_writers#3){.+.+}-{0:0}, at: do_vfs_ioctl+0xa2f/0x1af0 #1: ffff88801e67f150 (&type->i_mutex_dir_key#3){++++}-{3:3}, at: vfs_fileattr_set+0x14c/0xb90 #2: ffff88801e67f2f0 (mapping.invalidate_lock){++++}-{3:3}, at: ext4_change_inode_journal_flag+0x126/0x550 #3: ffff8880109c0b90 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: ext4_change_inode_journal_flag+0x17f/0x550 stack backtrace: CPU: 1 PID: 12295 Comm: syz-executor.0 Not tainted 6.1.0-rc8-next-20221207 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Call Trace: dump_stack_lvl+0x8f/0xb7 check_noncircular+0x263/0x2e0 __lock_acquire+0x2a02/0x5e70 lock_acquire+0x1a6/0x530 __mutex_lock+0x136/0x14e0 jbd2_journal_lock_updates+0x162/0x310 ext4_change_inode_journal_flag+0x187/0x550 ext4_fileattr_set+0x14fb/0x19f0 vfs_fileattr_set+0x780/0xb90 do_vfs_ioctl+0xa6c/0x1af0 __x64_sys_ioctl+0x110/0x210 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc RIP: 0033:0x7f54a0313b19 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:00007f549d889188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f54a0426f60 RCX: 00007f54a0313b19 RDX: 0000000020000040 RSI: 0000000040086602 RDI: 0000000000000003 RBP: 00007f54a036df6d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc740c5ccf R14: 00007f549d889300 R15: 0000000000022000 sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.3 not setting count and/or reply_len properly ------------[ cut here ]------------ WARNING: CPU: 1 PID: 12463 at lib/iov_iter.c:629 _copy_from_iter+0x2f1/0x1130 Modules linked in: CPU: 1 PID: 12463 Comm: syz-executor.3 Not tainted 6.1.0-rc8-next-20221207 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 RIP: 0010:_copy_from_iter+0x2f1/0x1130 Code: 37 ff 44 89 f3 e9 2f ff ff ff e8 0a 22 37 ff be 79 02 00 00 48 c7 c7 80 c0 9e 84 e8 79 a1 5a ff e9 13 fe ff ff e8 ef 21 37 ff <0f> 0b 45 31 f6 e9 77 ff ff ff e8 e0 21 37 ff 31 ff 89 ee e8 a7 1d RSP: 0018:ffff88804278f5e8 EFLAGS: 00010212 RAX: 0000000000004b0e RBX: 0000000000000000 RCX: ffffc900019e4000 RDX: 0000000000040000 RSI: ffffffff82122f31 RDI: 0000000000000001 RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000001000 R13: ffffea00010c9000 R14: 0000000000001000 R15: ffff88804278f818 FS: 00007fec80d0a700(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f9529b883a4 CR3: 0000000044406000 CR4: 0000000000350ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000600 Call Trace: copy_page_from_iter+0xe3/0x180 blk_rq_map_user_iov+0xb0c/0x1650 blk_rq_map_user_io+0x1ee/0x220 sg_common_write.constprop.0+0xd84/0x15e0 sg_write.part.0+0x706/0xb20 sg_write+0x88/0xe0 vfs_write+0x358/0xe40 ksys_write+0x12b/0x260 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc RIP: 0033:0x7fec83794b19 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:00007fec80d0a188 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007fec838a7f60 RCX: 00007fec83794b19 RDX: 0000000000000125 RSI: 00000000200003c0 RDI: 0000000000000005 RBP: 00007fec837eef6d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffdbd463ecf R14: 00007fec80d0a300 R15: 0000000000022000 irq event stamp: 0 hardirqs last enabled at (0): [<0000000000000000>] 0x0 hardirqs last disabled at (0): [] copy_process+0x1b05/0x7220 softirqs last enabled at (0): [] copy_process+0x1b49/0x7220 softirqs last disabled at (0): [<0000000000000000>] 0x0 ---[ end trace 0000000000000000 ]--- SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=12467 comm=syz-executor.3 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=12467 comm=syz-executor.3 sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.4 not setting count and/or reply_len properly SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=12480 comm=syz-executor.0 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=12494 comm=syz-executor.3 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=12490 comm=syz-executor.4 sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.3 not setting count and/or reply_len properly sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.6 not setting count and/or reply_len properly SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=12503 comm=syz-executor.0 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=12505 comm=syz-executor.3 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=12509 comm=syz-executor.6 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=12511 comm=syz-executor.4 sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.5 not setting count and/or reply_len properly SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=12517 comm=syz-executor.5 sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.7 not setting count and/or reply_len properly sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.6 not setting count and/or reply_len properly sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.4 not setting count and/or reply_len properly sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.3 not setting count and/or reply_len properly sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.5 not setting count and/or reply_len properly