Bug 299095

Summary: growfs: crash during an online grow leaves the filesystem suspended
Product: Base System Reporter: Rick Richard <rick>
Component: kernAssignee: freebsd-fs (Nobody) <fs>
Status: New ---    
Severity: Affects Some People CC: kevans, kib, mckusick
Priority: ---    
Version: 15.1-RELEASE   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296240

Description Rick Richard 2026-10-03 17:00:09 UTC
When growfs grows a mounted filesystem it suspends writes to it through
/dev/ufssuspend, and the suspension is lifted when that descriptor is
closed.

If growfs crashes while the filesystem is suspended, the kernel tries
to write the core dump to that same filesystem (the default when growfs
runs from a directory on it) and waits forever for the suspension to
end.  growfs can't be killed and every other write to the filesystem
blocks.

I first hit this with growfs -y / on a Raspberry Pi 3 running 15.1,
where growfs crashes because of the Cortex-A53 erratum (PR 296240).
ssh logins hung, nothing could write to /, and I had to power cycle.

It reproduces on stock 15.1-RELEASE-p3 by crashing growfs on purpose:

  mdconfig -a -t vnode -f /var/tmp/gfs.img     # 3 GB file
  gpart create -s gpt md0; gpart add -t freebsd-ufs -s 512m md0
  newfs -U /dev/md0p1; mount /dev/md0p1 /mnt/t
  gpart resize -i 1 md0
  cd /mnt/t; growfs -y /dev/md0p1 &
  # once growfs has /dev/ufssuspend open:
  kill -SEGV %1

growfs then sits in the suspfs wait, and touch /mnt/t/x blocks too:

  PID STAT WCHAN  COMMAND
 1426 D+   suspfs growfs -y /dev/md0p1

 growfs ... _sleep vn_start_write vn_open_cred core_vn_extend sigexit
     postsig ...

Possible fixes: growfs could set RLIMIT_CORE to 0 before suspending the
filesystem (the kernel skips the dump entirely in that case), but the
general fix is probably for the core dump code not to wait on a
suspended filesystem.  hv_vss_daemon also uses /dev/ufssuspend.
Comment 1 Konstantin Belousov freebsd_committer freebsd_triage 2026-10-04 00:02:49 UTC
Try https://reviews.freebsd.org/D60283
Comment 2 commit-hook freebsd_committer freebsd_triage 2026-10-07 17:01:27 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=bea382f25b16fec0e9a1c2be130935e739075287

commit bea382f25b16fec0e9a1c2be130935e739075287
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-10-03 23:59:30 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-10-07 17:00:53 +0000

    kern/coredump_vnode.c: avoid dumping to the mount point we suspended

    PR:     299095
    Reported by:    Rick Richard <rick@sloservers.com>
    Reviewed by:    markj
    Tested by:      Rick Richard <rick@sloservers.com> (previous version)
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D60283

 sys/kern/vfs_vnops.c | 46 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 45 insertions(+), 1 deletion(-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2026-10-14 02:22:56 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=4b3c29b5b2148195dd94c78ec8ceec5cb554cc87

commit 4b3c29b5b2148195dd94c78ec8ceec5cb554cc87
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-10-03 23:59:30 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-10-14 02:21:54 +0000

    kern/coredump_vnode.c: avoid dumping to the mount point we suspended

    PR:     299095

    (cherry picked from commit bea382f25b16fec0e9a1c2be130935e739075287)

 sys/kern/vfs_vnops.c | 46 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 45 insertions(+), 1 deletion(-)