possible deadlock in ocfs2_page_mkwrite (2)

Status: upstream: reported on 2026/12/05 01:43
Reported-by: syzbot+27303bf98a925a199aa3@syzkaller.appspotmail.com
First crash: 17h51m, last: 17h51m
▶ ▼ Similar bugs (5)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ocfs2_page_mkwrite ocfs2 4 syz, C done done 1373 445d 814d 0/30 auto-obsoleted due to no activity on 2025/11/25 04:57
linux-6.1 possible deadlock in ocfs2_page_mkwrite 4 6 677d 761d 0/3 auto-obsoleted due to no activity on 2025/05/07 01:52
linux-5.15 possible deadlock in ocfs2_page_mkwrite 4 21 453d 809d 0/3 auto-obsoleted due to no activity on 2025/12/17 04:32
linux-6.1 possible deadlock in ocfs2_page_mkwrite (2) 4 10 447d 530d 0/3 auto-obsoleted due to no activity on 2025/12/23 12:01
linux-6.6 possible deadlock in ocfs2_page_mkwrite 4 6 473d 513d 0/2 auto-obsoleted due to no activity on 2025/11/27 11:12

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.4.1436/9654 is trying to acquire lock:
ffff88805a8594a0 (&ocfs2_file_ip_alloc_sem_key){++++}-{3:3}, at: ocfs2_page_mkwrite+0x2c4/0xaa0 fs/ocfs2/mmap.c:141

but task is already holding lock:
ffff8880253d6558 (sb_pagefaults#5){.+.+}-{0:0}, at: do_page_mkwrite+0x168/0x3c0 mm/memory.c:2929

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #5 (sb_pagefaults#5
){.+.+}-{0:0}
:
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1829 [inline]
       sb_start_pagefault include/linux/fs.h:1928 [inline]
       ocfs2_page_mkwrite+0x1a7/0xaa0 fs/ocfs2/mmap.c:121
       do_page_mkwrite+0x168/0x3c0 mm/memory.c:2929
       do_shared_fault mm/memory.c:4337 [inline]
       do_fault mm/memory.c:4405 [inline]
       handle_pte_fault mm/memory.c:4659 [inline]
       __handle_mm_fault mm/memory.c:4794 [inline]
       handle_mm_fault+0x1e47/0x4440 mm/memory.c:4892
       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

-> #4
 (&mm->mmap_lock
){++++}-{3:3}
:
       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:3783
       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:2191 [inline]
       new_sync_write fs/read_write.c:511 [inline]
       vfs_write+0x748/0xd70 fs/read_write.c:598
       ksys_write+0x153/0x260 fs/read_write.c:651
       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 (
&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:810 [inline]
       ext4_bmap+0x4f/0x3f0 fs/ext4/inode.c:3167
       bmap+0xa2/0xd0 fs/inode.c:1828
       jbd2_journal_bmap fs/jbd2/journal.c:981 [inline]
       jbd2_fc_get_buf+0x17b/0x350 fs/jbd2/journal.c:894
       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:3013 [inline]
       ext4_buffered_write_iter+0x32b/0x3a0 fs/ext4/file.c:282
       ext4_file_write_iter+0x73f/0x1720 fs/ext4/file.c:-1
       call_write_iter include/linux/fs.h:2191 [inline]
       new_sync_write fs/read_write.c:511 [inline]
       vfs_write+0x748/0xd70 fs/read_write.c:598
       ksys_pwrite64 fs/read_write.c:705 [inline]
       __do_sys_pwrite64 fs/read_write.c:715 [inline]
       __se_sys_pwrite64 fs/read_write.c:712 [inline]
       __x64_sys_pwrite64+0x197/0x220 fs/read_write.c:712
       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 (&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:6031
       ocfs2_flush_truncate_log+0x4b/0x60 fs/ocfs2/alloc.c:6078
       ocfs2_sync_fs+0x119/0x330 fs/ocfs2/super.c:404
       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

-> #1 (&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:795 [inline]
       ocfs2_free_cached_clusters fs/ocfs2/alloc.c:6497 [inline]
       ocfs2_run_deallocs+0xdfc/0x1560 fs/ocfs2/alloc.c:6571
       ocfs2_commit_truncate+0x162b/0x1d30 fs/ocfs2/alloc.c:7372
       ocfs2_truncate_file+0xd89/0x1540 fs/ocfs2/file.c:526
       ocfs2_setattr+0x12f8/0x1b50 fs/ocfs2/file.c:1240
       notify_change+0xbc6/0xee0 fs/attr.c:505
       do_truncate+0x1ac/0x240 fs/open.c:65
       handle_truncate fs/namei.c:3316 [inline]
       do_open fs/namei.c:3663 [inline]
       path_openat+0x293b/0x2fb0 fs/namei.c:3793
       do_filp_open+0x1df/0x400 fs/namei.c:3820
       do_sys_openat2+0x14b/0x500 fs/open.c:1255
       do_sys_open fs/open.c:1271 [inline]
       __do_sys_creat fs/open.c:1347 [inline]
       __se_sys_creat fs/open.c:1341 [inline]
       __x64_sys_creat+0x8c/0xb0 fs/open.c:1341
       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

-> #0 (
&ocfs2_file_ip_alloc_sem_key){++++}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3125 [inline]
       check_prevs_add kernel/locking/lockdep.c:3244 [inline]
       validate_chain kernel/locking/lockdep.c:3860 [inline]
       __lock_acquire+0x39b7/0x7e20 kernel/locking/lockdep.c:5134
       lock_acquire+0x19f/0x400 kernel/locking/lockdep.c:5751
       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:2929
       do_shared_fault mm/memory.c:4337 [inline]
       do_fault mm/memory.c:4405 [inline]
       handle_pte_fault mm/memory.c:4659 [inline]
       __handle_mm_fault mm/memory.c:4794 [inline]
       handle_mm_fault+0x1e47/0x4440 mm/memory.c:4892
       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

other info that might help us debug this:

Chain exists of:
  
&ocfs2_file_ip_alloc_sem_key --> &mm->mmap_lock --> sb_pagefaults#5


 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  rlock(sb_pagefaults#5
);
                               lock(&mm->mmap_lock);
                               lock(sb_pagefaults
#5);
  lock(&ocfs2_file_ip_alloc_sem_key);

 *** DEADLOCK ***

2 locks held by syz.4.1436/9654:
 #0: ffff88807cd016e8 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_lock+0x1c/0x50 include/linux/mmap_lock.h:117
 #1: ffff8880253d6558 (sb_pagefaults#5
){.+.+}-{0:0}, at: do_page_mkwrite+0x168/0x3c0 mm/memory.c:2929

stack backtrace:
CPU: 0 PID: 9654 Comm: syz.4.1436 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:3125 [inline]
 check_prevs_add kernel/locking/lockdep.c:3244 [inline]
 validate_chain kernel/locking/lockdep.c:3860 [inline]
 __lock_acquire+0x39b7/0x7e20 kernel/locking/lockdep.c:5134
 lock_acquire+0x19f/0x400 kernel/locking/lockdep.c:5751
 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:2929
 do_shared_fault mm/memory.c:4337 [inline]
 do_fault mm/memory.c:4405 [inline]
 handle_pte_fault mm/memory.c:4659 [inline]
 __handle_mm_fault mm/memory.c:4794 [inline]
 handle_mm_fault+0x1e47/0x4440 mm/memory.c:4892
 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
RIP: 0033:0x7f366049ab82
Code: 30 48 8b 14 24 48 85 d2 74 17 8b 44 24 10 0f c8 89 c0 48 89 44 24 10 48 83 fa 01 0f 85 aa 02 00 00 48 8b 44 24 18 8b 74 24 10 <89> 30 e9 1e fe ff ff 48 8b 44 24 18 8b 10 48 8b 04 24 48 85 c0 0f
RSP: 002b:00007ffceac75430 EFLAGS: 00010246

RAX: 0000200000000000 RBX: 0000000000000004 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 000055555ac253d8
RBP: 00007ffceac75558 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000000 R12: 00007f3660867fac
R13: 00007ffceac75590 R14: 000000000005da08 R15: 00007f3660867fa0
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/12/05 01:42 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-5.15.y 9bdc23a21e3d 3a4d724d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ocfs2_page_mkwrite
* Struck through repros no longer work on HEAD.