mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [BUG] INFO: task hung in nilfs_transaction_begin (fs/nilfs2/segment.c:221, v7.4-rc3)
@ 2026-11-20 10:59 Zheng Zheng
  2026-11-20 11:24 ` Ryusuke Konishi
  0 siblings, 1 reply; 3+ messages in thread
From: Zheng Zheng @ 2026-11-20 10:59 UTC (permalink / raw)
  To: konishi.ryusuke
  Cc: slava, linux-nilfs, linux-fsdevel, linux-kernel, syzkaller-bugs

Hi Ryusuke, Viacheslav,

We found a reproducible NILFS2 hang on v7.4-rc3 with syzkaller.  The
supplied recipe reproduced on independent fresh VMs.

Note: This hang may share the same underlying root cause as the
previously reported nilfs_segctor_thread hang (issue #182):
https://github.com/nilfs-dev/nilfs2/issues/182

Repository and reproducer:

  https://github.com/Zheng-zheng-codes/nilfs2-transaction-begin-hang
  commit f1065fd59515bd55bbb5141b45e979bc0b3c9993

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

  INFO: task syz.7.24:13081 blocked for more than 142 seconds.
  task:syz.7.24        state:D stack:23176 pid:13081 tgid:13075 ppid:10344
  Call Trace:
   rwsem_down_read_slowpath
   __down_read
   down_read
   nilfs_transaction_begin+0x323/0xa00 fs/nilfs2/segment.c:221
   nilfs_write_begin+0x78/0x1b0 fs/nilfs2/inode.c:228
   generic_perform_write
   vfs_write
   ksys_write

A second thread of the same process (PID 13109) is blocked on the
f_pos_lock held by PID 13081.

An NMI backtrace of the semaphore holder (PID 13190) shows that it is
executing the NILFS2 segment-constructor path through
nilfs_clean_segments(), including btree/bmap propagation:

  nilfs_segctor_apply_buffers fs/nilfs2/segment.c:1010
  nilfs_collect_file_data fs/nilfs2/segment.c:589
  nilfs_bmap_propagate fs/nilfs2/bmap.c:329
  nilfs_btree_propagate fs/nilfs2/btree.c:2128

The lock dump identifies the semaphore holder:

  locks held by syz.7.24/13190: 3:
   #0: (sb_writers#17)                at: nilfs_ioctl_clean_segments
                                          fs/nilfs2/ioctl.c:869
   #1: (&nilfs->ns_segctor_sem) WRITE at: nilfs_transaction_lock
                                          fs/nilfs2/segment.c:357
   #2: (&bmap->b_sem)                 at: nilfs_bmap_assign
                                          fs/nilfs2/bmap.c:373

So a NILFS_IOCTL_CLEAN_SEGMENTS task is inside the segment-constructor
path, holding ns_segctor_sem for writing while doing bmap assignment,
and normal writers cannot acquire the semaphore for reading.  In this
report the segctord thread itself is not among the blocked tasks.

Relation to the earlier nilfs_segctor_thread hang
-------------------------------------------------

We previously reported a related NILFS2 hang:

  INFO: task hung in nilfs_segctor_thread (fs/nilfs2/segment.c:357, v7.4-rc3)
  https://github.com/nilfs-dev/nilfs2/issues/182
  https://github.com/Zheng-zheng-codes/nilfs2-segctor-thread-hang

Its hung-task report showed the constructor thread blocked acquiring
the same semaphore for writing:

  INFO: task segctord:35823 blocked for more than 183 seconds.
  task:segctord state:D
  Call Trace:
   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

The two reports involve different blocked tasks:

- In the earlier report, the segctord kernel thread waits
  for ns_segctor_sem in write mode in nilfs_transaction_lock().

- In this report, a normal file writer waits for the same
  semaphore in read mode in nilfs_transaction_begin().

In both reports, the lock dump identifies a task executing
NILFS_IOCTL_CLEAN_SEGMENTS as the semaphore holder.

The new external verification logs also repeatedly report:

  NILFS (loop0): error -28 cleaning segments

This resembles the repeated -ENOSPC errors observed in the
earlier report.

We suspect that both hangs may be manifestations of the same
GC error-handling problem, but the root cause has not yet
been established.

We would appreciate your analysis of this additional
reproduction alongside issue #182.

Reproduction
------------

  git clone https://github.com/Zheng-zheng-codes/nilfs2-transaction-begin-hang
  cd nilfs2-transaction-begin-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=1 -threaded -repeat=1 \
      -executor ./syz-executor \
      reproducer/repro.kernsight.prog

The recipe requires sequential execution with -procs=1.
Using -procs=8 did not reproduce the hang under our tests.

The recipe is a state-reconstruction sequence (72 replay programs plus
one model-selected priming program, followed by the crashing testcase).
The crash depends on the kernel state built by the recipe; the testcase
alone is not sufficient.

Verification:

- reproduction run: two attempts verified (confirmed=true,
  status=verified), 2026-11-20T07:17:00Z and 2026-11-20T08:05:31Z
- independent fresh-VM verification inside that run: 2/2 target hits
  (2026-11-20T07:46:46Z and 07:50:15Z)
- stability on fresh VMs: 5/5 reproductions, 187-194 s to the
  hung-task dump in every run (2026-11-20, external-verify/)
- evidence: reproducer/repro.outcomes.jsonl, external-verify/,
  logs/external-manager-session.log
- 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-20 11:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20 10:59 [BUG] INFO: task hung in nilfs_transaction_begin (fs/nilfs2/segment.c:221, v7.4-rc3) Zheng Zheng
2026-11-20 11:24 ` Ryusuke Konishi
2026-11-20 11:40   ` Zheng Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®