corrupted UFS directory despite soft updates + journaling

From: John F Carr <jfc_at_mit.edu>
Date: Tue, 13 Feb 2024 01:08:27 UTC
I have a corrupted UFS filesystem after a virtual machine was
terminated abnormally.  It's easy enough to fix with fsck but I
thought such corruption shouldn't happen with journaling and
soft updates.

I was running 15.0 in bhyve on a 13.3 host.  The host kernel
killed bhyve because "a thread waited too long to allocate a page".
(The system was neither heavily loaded nor short of RAM.
A bug for another list.)

On rebooting fsck read the journal and proclaimed itself satisifed.
But one problem remained:

/: bad dir ino 9134991 at offset 1024: mangled entry

A full fsck says

DIRECTORY CORRUPTED  I=9134991  OWNER=root MODE=40775
SIZE=1536 MTIME=Feb 12 19:27 2024 
DIR=/usr/obj/usr/src/amd64.amd64/usr.bin/clang/lldb-server

UNEXPECTED SOFT UPDATE INCONSISTENCY

Is this error supposed to be possible with journaling?



This is what tunefs says:

tunefs: soft updates: (-n)                                 enabled
tunefs: soft update journaling: (-j)                       enabled
tunefs: gjournal: (-J)                                     disabled
tunefs: trim: (-t)                                         enabled
tunefs: maximum blocks per file in a cylinder group: (-e)  4096
tunefs: average file size: (-f)                            16384
tunefs: average number of files in a directory: (-s)       64
tunefs: minimum percentage of free space: (-m)             8%
tunefs: space to hold for metadata blocks: (-k)            6400
tunefs: optimization preference: (-o)                      time


John Carr