possible deadlock in ext4_buffered_write_iter (2)

Status: upstream: reported on 2026/11/04 17:51
Reported-by: syzbot+dfbbc40a8b360ab6884d@syzkaller.appspotmail.com
First crash: 16d, last: 1d20h
▶ ▼ Similar bugs (2)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.6 possible deadlock in ext4_buffered_write_iter 4 2 472d 472d 0/2 auto-obsoleted due to no activity on 2025/11/13 17:52
linux-5.15 possible deadlock in ext4_buffered_write_iter 4 1 757d 757d 0/3 auto-obsoleted due to no activity on 2025/02/01 18:25

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.4.3307/19909 is trying to acquire lock:
ffff88802d15aca8 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_lock+0x1c/0x50 include/linux/mmap_lock.h:117

but task is already holding lock:
ffff8880498c53b0 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: inode_lock include/linux/fs.h:793 [inline]
ffff8880498c53b0 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: ext4_buffered_write_iter+0xa1/0x3a0 fs/ext4/file.c:262

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #6 (&sb->s_type->i_mutex_key#9){++++}-{3:3}:
       down_read+0x44/0x2e0 kernel/locking/rwsem.c:1498
       inode_lock_shared include/linux/fs.h:803 [inline]
       ext4_bmap+0x4f/0x3f0 fs/ext4/inode.c:3166
       bmap+0xa2/0xd0 fs/inode.c:1817
       jbd2_journal_bmap fs/jbd2/journal.c:981 [inline]
       jbd2_fc_get_buf+0x1ab/0x390 fs/jbd2/journal.c:895
       ext4_fc_reserve_space+0x4fa/0x890 fs/ext4/fast_commit.c:705
       ext4_fc_add_tlv+0xab/0x570 fs/ext4/fast_commit.c:797
       ext4_fc_perform_commit fs/ext4/fast_commit.c:1122 [inline]
       ext4_fc_commit+0xb08/0x1380 fs/ext4/fast_commit.c:1235
       ext4_fsync_journal fs/ext4/fsync.c:115 [inline]
       ext4_sync_file+0x550/0xb10 fs/ext4/fsync.c:174
       generic_write_sync include/linux/fs.h:3001 [inline]
       ext4_buffered_write_iter+0x32b/0x3a0 fs/ext4/file.c:282
       ext4_file_write_iter+0x73f/0x1720 fs/ext4/file.c:-1
       do_iter_readv_writev+0x47d/0x5f0 fs/read_write.c:-1
       do_iter_write+0x1f8/0x7a0 fs/read_write.c:855
       iter_file_splice_write+0x6be/0xcf0 fs/splice.c:689
       do_splice_from fs/splice.c:767 [inline]
       direct_splice_actor+0xe1/0x130 fs/splice.c:956
       splice_direct_to_actor+0x4e8/0xc00 fs/splice.c:902
       do_splice_direct+0x1d4/0x2f0 fs/splice.c:1008
       do_sendfile+0x524/0xe30 fs/read_write.c:1249
       __do_sys_sendfile64 fs/read_write.c:1317 [inline]
       __se_sys_sendfile64+0x141/0x1a0 fs/read_write.c:1303
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #5 (&journal->j_barrier){+.+.}-{3:3}:
       __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596
       __mutex_lock kernel/locking/mutex.c:729 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
       jbd2_journal_lock_updates+0x2ce/0x390 fs/jbd2/transaction.c:905
       __ocfs2_flush_truncate_log+0x2b4/0x1110 fs/ocfs2/alloc.c:6027
       ocfs2_flush_truncate_log+0x4b/0x60 fs/ocfs2/alloc.c:6074
       ocfs2_sync_fs+0x119/0x330 fs/ocfs2/super.c:403
       sync_filesystem+0x1be/0x220 fs/sync.c:66
       generic_shutdown_super+0x6b/0x300 fs/super.c:448
       kill_block_super+0x7c/0xe0 fs/super.c:1438
       deactivate_locked_super+0x93/0xf0 fs/super.c:335
       cleanup_mnt+0x426/0x4d0 fs/namespace.c:1148
       task_work_run+0x125/0x1a0 kernel/task_work.c:188
       tracehook_notify_resume include/linux/tracehook.h:189 [inline]
       exit_to_user_mode_loop+0x10f/0x130 kernel/entry/common.c:184
       exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:217
       __syscall_exit_to_user_mode_work kernel/entry/common.c:299 [inline]
       syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:310
       do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #4 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#6){+.+.}-{3:3}:
       down_write+0x38/0x60 kernel/locking/rwsem.c:1551
       inode_lock include/linux/fs.h:793 [inline]
       ocfs2_remove_btree_range+0x64f/0x15e0 fs/ocfs2/alloc.c:5742
       ocfs2_remove_inode_range+0xf4a/0x2610 fs/ocfs2/file.c:1910
       ocfs2_reflink_remap_extent fs/ocfs2/refcounttree.c:4595 [inline]
       ocfs2_reflink_remap_blocks+0xc6b/0x1ab0 fs/ocfs2/refcounttree.c:4742
       ocfs2_remap_file_range+0x4a7/0x740 fs/ocfs2/file.c:2706
       vfs_copy_file_range+0xcce/0x1430 fs/read_write.c:1510
       __do_sys_copy_file_range fs/read_write.c:1588 [inline]
       __se_sys_copy_file_range+0x320/0x470 fs/read_write.c:1551
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #3 (&oi->ip_alloc_sem/1){+.+.}-{3:3}:
       down_write_nested+0x3b/0x60 kernel/locking/rwsem.c:1667
       ocfs2_remap_file_range+0x3f0/0x740 fs/ocfs2/file.c:2698
       vfs_copy_file_range+0xcce/0x1430 fs/read_write.c:1510
       __do_sys_copy_file_range fs/read_write.c:1588 [inline]
       __se_sys_copy_file_range+0x320/0x470 fs/read_write.c:1551
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #2 (&oi->ip_alloc_sem){++++}-{3:3}:
       down_write+0x38/0x60 kernel/locking/rwsem.c:1551
       ocfs2_page_mkwrite+0x2c4/0xaa0 fs/ocfs2/mmap.c:141
       do_page_mkwrite+0x168/0x3c0 mm/memory.c:2922
       do_shared_fault mm/memory.c:4328 [inline]
       do_fault mm/memory.c:4396 [inline]
       handle_pte_fault mm/memory.c:4650 [inline]
       __handle_mm_fault mm/memory.c:4785 [inline]
       handle_mm_fault+0x1e47/0x4440 mm/memory.c:4883
       do_user_addr_fault+0x494/0xc90 arch/x86/mm/fault.c:1355
       handle_page_fault arch/x86/mm/fault.c:1443 [inline]
       exc_page_fault+0x60/0x100 arch/x86/mm/fault.c:1496
       asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:606

-> #1 (sb_pagefaults#4){.+.+}-{0:0}:
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1817 [inline]
       sb_start_pagefault include/linux/fs.h:1916 [inline]
       ocfs2_page_mkwrite+0x1a7/0xaa0 fs/ocfs2/mmap.c:121
       do_page_mkwrite+0x168/0x3c0 mm/memory.c:2922
       do_shared_fault mm/memory.c:4328 [inline]
       do_fault mm/memory.c:4396 [inline]
       handle_pte_fault mm/memory.c:4650 [inline]
       __handle_mm_fault mm/memory.c:4785 [inline]
       handle_mm_fault+0x1e47/0x4440 mm/memory.c:4883
       do_user_addr_fault+0x494/0xc90 arch/x86/mm/fault.c:1355
       handle_page_fault arch/x86/mm/fault.c:1443 [inline]
       exc_page_fault+0x60/0x100 arch/x86/mm/fault.c:1496
       asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:606

-> #0 (&mm->mmap_lock){++++}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3120 [inline]
       check_prevs_add kernel/locking/lockdep.c:3239 [inline]
       validate_chain kernel/locking/lockdep.c:3855 [inline]
       __lock_acquire+0x38f7/0x7d40 kernel/locking/lockdep.c:5120
       lock_acquire+0x19f/0x400 kernel/locking/lockdep.c:5737
       down_read+0x44/0x2e0 kernel/locking/rwsem.c:1498
       mmap_read_lock+0x1c/0x50 include/linux/mmap_lock.h:117
       do_user_addr_fault+0xc3f/0xc90 arch/x86/mm/fault.c:1306
       handle_page_fault arch/x86/mm/fault.c:1443 [inline]
       exc_page_fault+0x60/0x100 arch/x86/mm/fault.c:1496
       asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:606
       __get_user_nocheck_1+0x6/0x10 arch/x86/lib/getuser.S:103
       fault_in_readable+0xc5/0x150 mm/gup.c:1801
       fault_in_iov_iter_readable+0x128/0x270 lib/iov_iter.c:460
       generic_perform_write+0x1a5/0x550 mm/filemap.c:3775
       ext4_buffered_write_iter+0x256/0x3a0 fs/ext4/file.c:275
       ext4_file_write_iter+0x73f/0x1720 fs/ext4/file.c:-1
       call_write_iter include/linux/fs.h:2179 [inline]
       new_sync_write fs/read_write.c:507 [inline]
       vfs_write+0x748/0xd70 fs/read_write.c:594
       ksys_write+0x153/0x260 fs/read_write.c:647
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

other info that might help us debug this:

Chain exists of:
  &mm->mmap_lock --> &journal->j_barrier --> &sb->s_type->i_mutex_key#9

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&sb->s_type->i_mutex_key#9);
                               lock(&journal->j_barrier);
                               lock(&sb->s_type->i_mutex_key#9);
  rlock(&mm->mmap_lock);

 *** DEADLOCK ***

3 locks held by syz.4.3307/19909:
 #0: ffff888059d26af0 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x2bf/0x370 fs/file.c:1056
 #1: ffff88814cbaa460 (sb_writers#5){.+.+}-{0:0}, at: vfs_write+0x296/0xd70 fs/read_write.c:590
 #2: ffff8880498c53b0 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: inode_lock include/linux/fs.h:793 [inline]
 #2: ffff8880498c53b0 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: ext4_buffered_write_iter+0xa1/0x3a0 fs/ext4/file.c:262

stack backtrace:
CPU: 0 PID: 19909 Comm: syz.4.3307 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x188/0x250 lib/dump_stack.c:106
 check_noncircular+0x2f8/0x400 kernel/locking/lockdep.c:2178
 check_prev_add kernel/locking/lockdep.c:3120 [inline]
 check_prevs_add kernel/locking/lockdep.c:3239 [inline]
 validate_chain kernel/locking/lockdep.c:3855 [inline]
 __lock_acquire+0x38f7/0x7d40 kernel/locking/lockdep.c:5120
 lock_acquire+0x19f/0x400 kernel/locking/lockdep.c:5737
 down_read+0x44/0x2e0 kernel/locking/rwsem.c:1498
 mmap_read_lock+0x1c/0x50 include/linux/mmap_lock.h:117
 do_user_addr_fault+0xc3f/0xc90 arch/x86/mm/fault.c:1306
 handle_page_fault arch/x86/mm/fault.c:1443 [inline]
 exc_page_fault+0x60/0x100 arch/x86/mm/fault.c:1496
 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:606
RIP: 0010:__get_user_nocheck_1+0x6/0x10 arch/x86/lib/getuser.S:124
Code: d0 73 64 48 19 d2 48 21 d0 0f 01 cb 48 8b 10 31 c0 0f 01 ca c3 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 01 cb 0f ae e8 <0f> b6 10 31 c0 0f 01 ca c3 90 0f 01 cb 0f ae e8 0f b7 10 31 c0 0f
RSP: 0000:ffffc900031478e0 EFLAGS: 00050287
RAX: 00002000000b3000 RBX: 0000000000001000 RCX: 0000000000080000
RDX: ffffc90012e9b000 RSI: 000000000002b6dc RDI: 000000000002b6dd
RBP: 00000000ffffffff R08: ffffffff8e6d322f R09: 1ffffffff1cda645
R10: dffffc0000000000 R11: fffffbfff1cda646 R12: 0000000000001000
R13: 00002000000b4000 R14: 00002000000b3000 R15: 00002000000b3000
 fault_in_readable+0xc5/0x150 mm/gup.c:1801
 fault_in_iov_iter_readable+0x128/0x270 lib/iov_iter.c:460
 generic_perform_write+0x1a5/0x550 mm/filemap.c:3775
 ext4_buffered_write_iter+0x256/0x3a0 fs/ext4/file.c:275
 ext4_file_write_iter+0x73f/0x1720 fs/ext4/file.c:-1
 call_write_iter include/linux/fs.h:2179 [inline]
 new_sync_write fs/read_write.c:507 [inline]
 vfs_write+0x748/0xd70 fs/read_write.c:594
 ksys_write+0x153/0x260 fs/read_write.c:647
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f5fc8db5559
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f5fc7002028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f5fc9031fa0 RCX: 00007f5fc8db5559
RDX: 000000000208e24b RSI: 0000200000000000 RDI: 0000000000000004
RBP: 00007f5fc8e44136 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f5fc9032038 R14: 00007f5fc9031fa0 R15: 00007ffcfcb00188
 </TASK>
kcov: kcov_task_exit: t = ffff88807af71dc0, kcov->t = ffff88807af71dc0
----------------
Code disassembly (best guess):
   0:	d0 73 64             	shlb   $1,0x64(%rbx)
   3:	48 19 d2             	sbb    %rdx,%rdx
   6:	48 21 d0             	and    %rdx,%rax
   9:	0f 01 cb             	stac
   c:	48 8b 10             	mov    (%rax),%rdx
   f:	31 c0                	xor    %eax,%eax
  11:	0f 01 ca             	clac
  14:	c3                   	ret
  15:	90                   	nop
  16:	90                   	nop
  17:	90                   	nop
  18:	90                   	nop
  19:	90                   	nop
  1a:	90                   	nop
  1b:	90                   	nop
  1c:	90                   	nop
  1d:	90                   	nop
  1e:	90                   	nop
  1f:	90                   	nop
  20:	90                   	nop
  21:	90                   	nop
  22:	90                   	nop
  23:	90                   	nop
  24:	0f 01 cb             	stac
  27:	0f ae e8             	lfence
* 2a:	0f b6 10             	movzbl (%rax),%edx <-- trapping instruction
  2d:	31 c0                	xor    %eax,%eax
  2f:	0f 01 ca             	clac
  32:	c3                   	ret
  33:	90                   	nop
  34:	0f 01 cb             	stac
  37:	0f ae e8             	lfence
  3a:	0f b7 10             	movzwl (%rax),%edx
  3d:	31 c0                	xor    %eax,%eax
  3f:	0f                   	.byte 0xf

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/18 23:29 linux-5.15.y 29c6cdaac04a 2006bdcc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ext4_buffered_write_iter
2026/11/15 09:16 linux-5.15.y 29c6cdaac04a 819ebe34 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ext4_buffered_write_iter
2026/11/04 17:50 linux-5.15.y 700e62ea909a 73438ed0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ext4_buffered_write_iter
* Struck through repros no longer work on HEAD.