[BUG] INFO: task hung in nilfs_segctor_thread (fs/nilfs2/segment.c:357, v7.4-rc3)
From: Zheng Zheng
Date: Thu Nov 19 2026 - 09:07:37 EST
Hi Ryusuke, Viacheslav,
We found a reproducible NILFS2 segment-constructor hang on v7.4-rc3 with
syzkaller. The supplied recipe reproduced on three independent fresh VMs; no
state snapshot is required.
Repository and reproducer:
https://github.com/Zheng-zheng-codes/nilfs2-segctor-thread-hang
commit 2d94e07741d28d2dccaba174d06d6a5255ce0134
Hung-task report
----------------
INFO: task segctord:35823 blocked for more than 183 seconds.
task:segctord state:D stack:29568 pid:35823
Call Trace:
<TASK>
__schedule
schedule_preempt_disabled
rwsem_down_write_slowpath
__down_write
down_write
nilfs_transaction_lock+0x25d/0x410 fs/nilfs2/segment.c:357
nilfs_segctor_thread_construct fs/nilfs2/segment.c:2601 [inline]
nilfs_segctor_thread+0x600/0xa60 fs/nilfs2/segment.c:2716
kthread
ret_from_fork
ret_from_fork_asm
</TASK>
The blocked thread is waiting to acquire `nilfs->ns_segctor_sem`
for writing in `nilfs_transaction_lock()`:
for (;;) {
down_write(&nilfs->ns_segctor_sem);
if (!test_bit(NILFS_SC_PRIOR_FLUSH, &sci->sc_flags))
break;
nilfs_segctor_do_immediate_flush(sci);
up_write(&nilfs->ns_segctor_sem);
cond_resched();
}
The lock dump also associates `&nilfs->ns_segctor_sem` with a task in
`nilfs_ioctl_clean_segments()` holding `sb_writers`, while `segctord` is
blocked in `down_write()` on that semaphore. The serial log repeatedly reports:
NILFS (loop6): error -28 cleaning segments
i.e. `-ENOSPC` from the clean-segments path. The reason why the
clean-segments ioctl holds the semaphore
for an extended period is not yet clear. We have not established
a circular lock dependency or identified the root cause.
We would appreciate your analysis.
Reproduction
------------
git clone https://github.com/Zheng-zheng-codes/nilfs2-segctor-thread-hang
cd nilfs2-segctor-thread-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 recipe has 227 entries: 226
replay programs followed by the testcase.
Verification:
- Main KernSight pipeline: attempt 2, `confirmed=true`,
`status=verified`, 226 replay programs, 2026-11-19T11:10:28Z
- Pipeline verification scope: `snapshot_restore`
- Independent external fresh-VM verification: **3/3**
- run 1 hit after 422 s
- run 2 hit after 257 s
- run 3 hit after 320 s
- External serial logs are in `external-verify/serial-{1,2,3}.log`
- Runs were counted only when a `nilfs_transaction_lock` frame appeared next
to `segctord` or `nilfs_segctor_thread`; 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_NILFS2_FS=y
Thanks,
Zheng