$ uname -a A_BLOG_ABOUT_UNIX_TOOLS_AND_THE_BEAUTY_OF_SIMPLE_SYSTEMS
SYS.YEAR  2026
← Back to articles
2026-09-26ARTICLE

Zfs Crash

Dnode-Slot Corruption Record

Panic

The matching FreeBSD 15.1-RELEASE-p3 GENERIC-DEBUG dump panicked in dnode_verify() while syncing object 815488:

VERIFY(DMU_OT_IS_VALID(dn->dn_phys->dn_type)) failed

The discovery stack is dnode_verify() → dnode_sync() → dmu_objset_sync_dnodes(). dnode_sync() verifies the physical dnode before performing its normal sync updates, so the invalid bytes already existed when this sync invocation began.

Slot Geometry

dn_dbuf is a 16 KiB dnode block (db_blkid = 25484), containing 32 slots of 512 bytes. Object 815488 is slot zero because 25484 * 32 = 815488.

dn_phys = db_data = 0xfffffe00ff36c000
slot = (dnode_phys_t *)db_data + (dn_object % (db_size >> 9))

The calculated slot equals dn_phys exactly. This excludes a stale or off-by-one physical-slot pointer as the immediate explanation.

Expected Contents

Each slot begins with a dnode_phys_t header: dn_type, indirect-block shift, level count, block-pointer count, bonus type, and bonus length. The cached dnode_t for this object is coherent and describes a plain file:

dn_type = DMU_OT_PLAIN_FILE_CONTENTS (19)
dn_indblkshift = 17; dn_nlevels = 1; dn_nblkptr = 1
dn_bonuslen = 176

The embedded dnode block-pointer array begins later in the slot, at byte 64.

Observed Contents

Slot zero instead begins:

58 00 00 00 00 00 00 00

0x58 (88) is not a valid DMU_OT_* value. The first 256 bytes decode as two coherent 128-byte blkptr_t values for plain-file data, where the dnode header should be. Neighboring slots, including slots 1 and 31, decode as valid dnodes.

This is not a complete in-core brt_entry_t: that structure contains an AVL node before bre_bp and reference-count fields after it. Slot zero instead resembles blkptr_t bps[2]. The two values match bre_bp fields elsewhere because BRT entries retain copies of cloned source BPs. The same shape is also compatible with the source-BP array passed to dmu_brt_clone().

If a copy was misdirected into the dnode slot, its intended destination might be missing that particular copy. The dump does not demonstrate this: the BPs also exist legitimately in BRT entries and clone dirty-record state, and the overwritten sequence could have been a temporary source array whose normal lifetime had ended.

What This Establishes

The correct physical dnode slot was overwritten before dnode_verify() found it. The structured replacement data makes a generic zeroing/free transition unlikely. The dump does not retain the write instruction, writer stack, or complete historical ARC/ABD ownership, so it does not establish whether BRT, another ZFS destination-pointer error, general kernel memory corruption, or hardware/DMA performed the write.

Future-Crash Evidence

Keep every crash dump, but do not expect a postmortem dump alone to identify the writer: it records the state at discovery, not the earlier write instruction or stack. For the diagnostic period, retain automatic dumping and rebooting:

sysctl debug.debugger_on_panic=0
sysctl kern.panic_reboot_wait_time=15
dumpon -l

Prefer a full dump over a minidump when dump space is at least physical RAM:

sysctl debug.minidump=0

Persist that setting in /etc/sysctl.conf. The original minidump omitted many ARC/ABD data pages, so a full dump may preserve useful ownership and source-buffer evidence. Retain the vmcore, info, core.txt, matching kernel, zfs.ko, debug symbols, zpool status -v, zpool events -v, complete dmesg, uptime, and workload notes for each event.

Avoid broad DTrace/fasttrap tracing during ordinary reproduction: the test VM separately panicked in fasttrap. A small kernel check that snapshots or hashes the target dnode block at controlled ZFS boundaries is more likely to identify the first unexpected mutation and its writer context.

Diagnostic Records and Minidumps

A writer stack is the call stack of code performing a write. A checksum failure normally captures a detection stack: code noticing the change, which may be a different thread. Checks at two boundaries can bracket a change but do not establish its writer. The preceding instrumentation suggestion should be read with this limitation. Legitimate dnode updates, synchronization, and buffer lifetime must be accounted for to avoid false alarms. Even before/after records around a candidate write require accounting for concurrent writers.

A minidump can retain explicitly logged diagnostic records. Before a diagnostic panic, the proposed patch should print the object/TXG, dnode and dbuf addresses, old/new fingerprints, event label, thread, and captured stack into the kernel message buffer. Keep output bounded to avoid overwriting records and verify retention with a controlled VM test. Any separate trace buffer must reside in memory included in the dump. This instrumentation has not yet been implemented or validated here.

With automatic dumping and reboot enabled, the remote signs remain an SSH disconnect, reduced uptime, and a new crash dump. The diagnostic record adds evidence but does not guarantee identification of the writer. A full dump provides more surrounding memory; it is not required solely to retain records in the kernel message buffer. Neither format reconstructs unrecorded history.