[BUG] INFO: task hung in f2fs_write_data_pages (fs/f2fs/data.c:3834, v7.4-rc3)

From: Zheng Zheng

Date: Thu Nov 19 2026 - 08:00:43 EST


Hi Jaegeuk, Chao,

We found a reproducible F2FS writeback hang on v7.4-rc3 with syzkaller. The
recipe is self-contained and reproduced on three independent fresh VMs; no
state snapshot is required.

Repository and reproducer:

https://github.com/Zheng-zheng-codes/f2fs-write-data-pages-hang
commit ff85a8d2e8d444ae78308f084869666cb9acc514

Hung-task report
----------------

The primary blocked task is waiting in `__f2fs_write_data_pages()`:

INFO: task syz.2.19:29337 blocked for more than 142 seconds.
task:syz.2.19 state:D stack:24760 pid:29337
Call Trace:
<TASK>
__schedule
schedule_preempt_disabled
__mutex_lock
__f2fs_write_data_pages fs/f2fs/data.c:3834 [inline]
f2fs_write_data_pages+0xfaf/0x14a0 fs/f2fs/data.c:3879
do_writepages
filemap_writeback
file_write_and_wait_range
f2fs_do_sync_file
f2fs_sync_file
vfs_fsync_range
f2fs_file_write_iter
do_pwritev
__x64_sys_pwritev
do_syscall_64
entry_SYSCALL_64_after_hwframe
</TASK>

A second task in the same report is blocked in `f2fs_fallocate()`:

INFO: task syz.2.19:29526 blocked for more than 142 seconds.
task:syz.2.19 state:D stack:28664 pid:29526
Call Trace:
<TASK>
rwsem_down_write_slowpath
__down_write
down_write
inode_lock
f2fs_fallocate+0x347/0x3ca0 fs/f2fs/file.c:2116
vfs_fallocate
__x64_sys_fallocate
do_syscall_64
entry_SYSCALL_64_after_hwframe
</TASK>

Important lock observations
----------------------------

The first blocked task is waiting for the per-superblock `sbi->writepages`
mutex. The lock dump also shows another task, PID 29506, holding
`sbi->writepages` together with:

- `sbi->gc_lock`
- `fi->i_gc_rwsem[0]`
- `fi->i_gc_rwsem[1]`

The NMI backtrace for PID 29506 shows it in garbage collection reached from
writeback:

f2fs_get_node_info
is_alive fs/f2fs/gc.c:1163 [inline]
gc_data_segment fs/f2fs/gc.c:1642 [inline]
do_garbage_collect fs/f2fs/gc.c:1935
f2fs_gc fs/f2fs/gc.c:2047
f2fs_balance_fs fs/f2fs/segment.c:475
f2fs_write_single_data_page fs/f2fs/data.c:3433
f2fs_write_cache_pages fs/f2fs/data.c:3665
__f2fs_write_data_pages fs/f2fs/data.c:3841 [inline]
f2fs_write_data_pages fs/f2fs/data.c:3879
do_writepages
filemap_writeback
filemap_invalidate_pages
kiocb_invalidate_pages
__iomap_dio_rw
f2fs_dio_write_iter
f2fs_file_write_iter

The relevant source in `__f2fs_write_data_pages()` is:

if (__should_serialize_io(inode, wbc)) {
mutex_lock(&sbi->writepages);
locked = true;
}

account_writeback(inode, true);

blk_start_plug(&plug);
ret = f2fs_write_cache_pages(mapping, wbc, io_type);
blk_finish_plug(&plug);

account_writeback(inode, false);

if (locked)
mutex_unlock(&sbi->writepages);

In this report, `f2fs_write_cache_pages()` reaches `f2fs_balance_fs()` and GC
while the per-superblock `sbi->writepages` mutex is held. Other tasks then
block on that mutex, and the fallocate path blocks on the inode lock.
We have not
confirmed the root cause or a fix; this is the observed lock dependency.

How to reproduce
----------------

git clone https://github.com/Zheng-zheng-codes/f2fs-write-data-pages-hang
cd f2fs-write-data-pages-hang

# boot v7.4-rc3 with the supplied kernel config
# using a Debian trixie x86_64 guest

# in the guest, as root:
syz-execprog -procs=8 -threaded -repeat=0 \
-executor ./syz-executor reproducer/repro.kernsight.prog

`-repeat=0` enables indefinite repetition. The hung-task reports appeared
after approximately 205-206 seconds in the external verification runs. The
recipe has 141 entries: 140 replay programs followed by the testcase.

Verification:

- Main Kernsight pipeline: attempt 5, `confirmed=true`,
`status=verified`, 140 replay programs, 2026-11-19T08:05:41Z
- Pipeline verification scope: `snapshot_restore`
- Independent external fresh-VM verification: **3/3**
- run 1 hit after 205 s
- run 2 hit after 206 s
- run 3 hit after 206 s
- A run was counted only when one hung-task report contained both
`INFO: task ... blocked for more than` and `f2fs_write_data_pages`
- External serial logs: `external-verify/serial-{1,2,3}.log`
- Target checker: `external-verify/verify-logs.py`
- C reproducer: not generated; the syzkaller recipe is the primary reproducer

Kernel/guest details:

kernel: v7.4-rc3, bzImage sha256
0c16409f8aec508ac44a63e631c2bd352536401f3fd0856df1d839fb953a1882
guest: Debian trixie x86_64, 6 GiB RAM, 4 vCPU, QEMU/KVM
boot: oops=panic panic_on_warn=1 hung_task_panic=0
config: CONFIG_KASAN=y, CONFIG_PROVE_LOCKING=y, CONFIG_F2FS_FS=y

Thanks,
Zheng Zheng