Repository navigation
feat(fs): symlinks, with targets inline in the inode or in one block - #172
Merged
Merged
Conversation
symlink, readlink, lstat, lchown and lutimes work through FUSE; the kernel follows links itself. A target of up to 92 bytes is kept in the inode bytes the inline extents and tree fields use, under a new FlagInlineTarget; the inode decoder leaves the extents zero for such an inode, so nothing that walks extents reads target bytes as blocks. A longer target, up to 4095 bytes, goes in one zeroed data block mapped like a one-block file. -format sets the new RequiredSymlinks superblock flag, so older builds and fsck refuse such volumes; on older volumes symlink returns EOPNOTSUPP. Creating a link is one transaction: InodeCreate, a new SymlinkTarget entry and DirAddEntry (plus BlockUse for a reserved block). It claims the inode before naming it, and replay applies the target only to an inode that replay itself created. fsck parses inline targets, checks symlink link counts, lengths, layout, padding and targets, and checks that DT_LNK entries and symlink inodes match. It reports bad symlinks without repairing them; an unnamed one goes through the existing unnamed-inode repair. Snapshots and clones of a symlink are refused: a Link node takes no xattrs, as the kernel refuses user xattrs on symlinks anyway. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… hold one open Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mattmattox
force-pushed
the
feat/symlinks
branch
from
November 16, 2026 22:42
7a67d7a to
dae1b4e
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… slot A symlink node did not check the inode's birth generation, so once its link was unlinked and another symlink took the slot, readlink and lchown through the old node reached the new link. The symlink unlink fast path made that reuse immediate. Link nodes now record the birth generation, pass it to go-fuse as the generation, and return ESTALE when the slot holds another link, as #169 does for files. A symlink create that fails after its commit now ends the intent durably before it frees the target block, so replay cannot map a block this node already freed; if that fails, the block stays allocated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # CLAUDE.md # internal/fsck/fsck.go
…s do after #181 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symlinks, part 1 of 2: format, ops, replay and fsck. The plan and its four decisions were approved by the PM; it is in the shared notes as symlink-plan.md.
Things to review:
FlagInlineTarget. The inode decoder is the one choke point: for such an inode it leaves the extents zero, so no extent walker reads target bytes as blocks.extent.Insertrefuses such an inode as a backstop.-formatsetsRequiredSymlinks(0x20), so older builds and older fsck refuse the volume. On older volumessymlink(2)returns EOPNOTSUPP.SymlinkTarget(0x0105; 0x0103 is LinkDrop from fix(fs): keep a file unlinked while open until every node closes it #161, 0x0104 is reserved for LinkAdd) + DirAddEntry, plus BlockUse for a reserved block. The order follows fix(fs): claim a new inode before naming it, and check replayed entry changes under the directory lock #84, and the replay guard follows fix(journal): replay a record only while other nodes have not changed what it touches #80.entry.InodeNum < len(map), which almost never holds. My check sits outside that gate; the old check is unchanged.Tests: with #173 on top (84bee9c, rebased on main 580d18f), lint, parity, unit -race and the full integration suite pass; 30 s of FuzzDeserializeInode with #163's re-encode check passes. VM 75/0 and Docker 63/0 passed one main rebase earlier (a8b5f9e, on #161). Since 84bee9c, only a gofmt newline changed.
🤖 Generated with Claude Code