warning: checkpointing journal with EXT4_IOC_CHECKPOINT_FLAG_ZEROOUT can be slow ====================================================== WARNING: possible circular locking dependency detected 6.2.0-syzkaller-13534-gb01fe98d34f3 #0 Not tainted ------------------------------------------------------ syz-executor.3/6803 is trying to acquire lock: ffff88801c698400 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: inode_lock_shared include/linux/fs.h:768 [inline] ffff88801c698400 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: ext4_bmap+0x52/0x470 fs/ext4/inode.c:3242 but task is already holding lock: ffff88804846a3f8 (&journal->j_checkpoint_mutex){+.+.}-{3:3}, at: jbd2_journal_flush+0x47f/0xc90 fs/jbd2/journal.c:2473 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&journal->j_checkpoint_mutex){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] mutex_lock_io_nested+0x143/0x11a0 kernel/locking/mutex.c:833 jbd2_journal_flush+0x19e/0xc90 fs/jbd2/journal.c:2463 ext4_change_inode_journal_flag+0x397/0x550 fs/ext4/inode.c:6169 ext4_ioctl_setflags fs/ext4/ioctl.c:684 [inline] ext4_fileattr_set+0xe78/0x1a50 fs/ext4/ioctl.c:1001 vfs_fileattr_set+0x7ff/0xc40 fs/ioctl.c:696 ioctl_fssetxattr fs/ioctl.c:758 [inline] do_vfs_ioctl+0xfa8/0x1670 fs/ioctl.c:845 __do_compat_sys_ioctl+0x131/0x2b0 fs/ioctl.c:962 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 -> #2 (&journal->j_barrier){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1350 kernel/locking/mutex.c:747 jbd2_journal_lock_updates+0x162/0x310 fs/jbd2/transaction.c:904 ext4_change_inode_journal_flag+0x188/0x550 fs/ext4/inode.c:6156 ext4_ioctl_setflags fs/ext4/ioctl.c:684 [inline] ext4_fileattr_set+0xe78/0x1a50 fs/ext4/ioctl.c:1001 vfs_fileattr_set+0x7ff/0xc40 fs/ioctl.c:696 ioctl_fssetxattr fs/ioctl.c:758 [inline] do_vfs_ioctl+0xfa8/0x1670 fs/ioctl.c:845 __do_compat_sys_ioctl+0x131/0x2b0 fs/ioctl.c:962 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 -> #1 (&sbi->s_writepages_rwsem){++++}-{0:0}: 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 filemap_fdatawrite_wbc mm/filemap.c:390 [inline] filemap_fdatawrite_wbc+0x147/0x1b0 mm/filemap.c:380 __filemap_fdatawrite_range+0xb8/0xf0 mm/filemap.c:423 filemap_write_and_wait_range mm/filemap.c:678 [inline] filemap_write_and_wait_range+0xa1/0x120 mm/filemap.c:669 __iomap_dio_rw+0x5ea/0x1d80 fs/iomap/direct-io.c:566 iomap_dio_rw+0x40/0xa0 fs/iomap/direct-io.c:683 ext4_dio_read_iter fs/ext4/file.c:94 [inline] ext4_file_read_iter+0x4be/0x690 fs/ext4/file.c:145 call_read_iter include/linux/fs.h:1845 [inline] generic_file_splice_read+0x182/0x4b0 fs/splice.c:402 do_splice_to+0x1b9/0x240 fs/splice.c:885 splice_direct_to_actor+0x2ab/0x8a0 fs/splice.c:957 do_splice_direct+0x1ab/0x280 fs/splice.c:1066 do_sendfile+0xb19/0x12c0 fs/read_write.c:1255 __do_compat_sys_sendfile fs/read_write.c:1344 [inline] __se_compat_sys_sendfile fs/read_write.c:1327 [inline] __ia32_compat_sys_sendfile+0x1e1/0x220 fs/read_write.c:1327 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 -> #0 (&sb->s_type->i_mutex_key#8){++++}-{3:3}: 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+0x1e3/0x670 kernel/locking/lockdep.c:5634 down_read+0x3d/0x50 kernel/locking/rwsem.c:1520 inode_lock_shared include/linux/fs.h:768 [inline] ext4_bmap+0x52/0x470 fs/ext4/inode.c:3242 bmap+0xae/0x120 fs/inode.c:1799 jbd2_journal_bmap+0xac/0x1c0 fs/jbd2/journal.c:976 __jbd2_journal_erase fs/jbd2/journal.c:1788 [inline] jbd2_journal_flush+0x87b/0xc90 fs/jbd2/journal.c:2491 ext4_ioctl_checkpoint fs/ext4/ioctl.c:1079 [inline] __ext4_ioctl+0xb3f/0x4c90 fs/ext4/ioctl.c:1587 ext4_ioctl fs/ext4/ioctl.c:1607 [inline] ext4_compat_ioctl+0xca/0x430 fs/ext4/ioctl.c:1683 __do_compat_sys_ioctl+0x255/0x2b0 fs/ioctl.c:968 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 other info that might help us debug this: Chain exists of: &sb->s_type->i_mutex_key#8 --> &journal->j_barrier --> &journal->j_checkpoint_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&journal->j_checkpoint_mutex); lock(&journal->j_barrier); lock(&journal->j_checkpoint_mutex); lock(&sb->s_type->i_mutex_key#8); *** DEADLOCK *** 2 locks held by syz-executor.3/6803: #0: ffff88804846a170 (&journal->j_barrier){+.+.}-{3:3}, at: jbd2_journal_lock_updates+0x162/0x310 fs/jbd2/transaction.c:904 #1: ffff88804846a3f8 (&journal->j_checkpoint_mutex){+.+.}-{3:3}, at: jbd2_journal_flush+0x47f/0xc90 fs/jbd2/journal.c:2473 stack backtrace: CPU: 3 PID: 6803 Comm: syz-executor.3 Not tainted 6.2.0-syzkaller-13534-gb01fe98d34f3 #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+0x1e3/0x670 kernel/locking/lockdep.c:5634 down_read+0x3d/0x50 kernel/locking/rwsem.c:1520 inode_lock_shared include/linux/fs.h:768 [inline] ext4_bmap+0x52/0x470 fs/ext4/inode.c:3242 bmap+0xae/0x120 fs/inode.c:1799 jbd2_journal_bmap+0xac/0x1c0 fs/jbd2/journal.c:976 __jbd2_journal_erase fs/jbd2/journal.c:1788 [inline] jbd2_journal_flush+0x87b/0xc90 fs/jbd2/journal.c:2491 ext4_ioctl_checkpoint fs/ext4/ioctl.c:1079 [inline] __ext4_ioctl+0xb3f/0x4c90 fs/ext4/ioctl.c:1587 ext4_ioctl fs/ext4/ioctl.c:1607 [inline] ext4_compat_ioctl+0xca/0x430 fs/ext4/ioctl.c:1683 __do_compat_sys_ioctl+0x255/0x2b0 fs/ioctl.c:968 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 RIP: 0023:0xf7f2a579 Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f7f255cc EFLAGS: 00000296 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 000000004004662b RDX: 0000000020000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 ---------------- Code disassembly (best guess), 2 bytes skipped: 0: 10 06 adc %al,(%rsi) 2: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi 6: 10 07 adc %al,(%rdi) 8: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi c: 10 08 adc %cl,(%rax) e: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi 1e: 00 51 52 add %dl,0x52(%rcx) 21: 55 push %rbp 22: 89 e5 mov %esp,%ebp 24: 0f 34 sysenter 26: cd 80 int $0x80 * 28: 5d pop %rbp <-- trapping instruction 29: 5a pop %rdx 2a: 59 pop %rcx 2b: c3 retq 2c: 90 nop 2d: 90 nop 2e: 90 nop 2f: 90 nop 30: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 37: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi