Skip to content

fix(snapshot): keep a descriptor's birth bytes when it has no birth flag - #158

Merged
mattmattox merged 1 commit into
mainfrom
fix-snapshot-descriptor-raw-bytes
Nov 16, 2026
Merged

mattmattox merged 1 commit into
mainfrom
fix-snapshot-descriptor-raw-bytes

Conversation

@mattmattox

Copy link
Copy Markdown
Contributor

For #144. #146 unblocked the nightly by ignoring the checksum in the descriptor round trip. This fixes the cause and makes the check strict again.

Without FlagHasTargetBirth, every rewrite of an older descriptor zeroed bytes 26-27 and 32-35. Those bytes could hold an old extent tree root; nothing reads it, so no data was lost. FuzzDecodeDescriptor now requires a re-encode to write back exactly the bytes it read. Seed 8ac4626f92ad713e fails that check on main and passes here. The fuzzer then ran 10 min on .66 with no failures.

The other encoders I checked:

  • Inode: drops reserved bytes 204-251 on every rewrite, the same pattern. Left for its own PR.
  • Superblock: written only at format.
  • Journal records: never re-encoded.
  • Lock slots, registry slots, journal superblock: rewritten whole, so dropping their reserved tail loses nothing.

🤖 Generated with Claude Code

Without FlagHasTargetBirth, decoding skipped bytes 26-27 and 32-35 and
re-encoding wrote zeros there, so every rewrite of an older descriptor
changed bytes it never read. Decoding now always reads them into
TargetBirth, which BelongsTo uses only with the flag, so a descriptor
re-encodes to the bytes it was read from.

FuzzDecodeDescriptor now checks exactly that, byte for byte, in place
of comparing decoded fields with the checksum ignored. Seed
8ac4626f92ad713e fails the new check without this fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmattox
mattmattox merged commit 8978531 into main Nov 16, 2026
17 checks passed
mattmattox added a commit that referenced this pull request Nov 16, 2026
Every inode rewrite wrote reserved bytes 212-251 as zero. A future field there would be wiped whenever this build rewrote the inode, which is how older builds lost the birth generation at 196-203. The inode now keeps those bytes as read and writes them back, as #158 did for snapshot descriptors. Freeing or claiming a slot still starts from a zeroed inode.

main is merged in, including #161. Holders keeps bytes 204-211, so Reserved is now 40 bytes (212-251). The merge commit holds that change plus the new test; the first commit's message still says 204-251.

Tests:
- FuzzDeserializeInode now checks the re-encoded bytes. Its seed sets both Holders and the reserved bytes.
- New TestRewriteChangesHoldersAndKeepsReservedBytes: through the Table, a Holders change reaches disk and the reserved bytes survive. It fails if a rewrite puts back the Holders read from disk.
- Fuzzed 3 min on .66 with no failures.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant