Skip to content

feat(fs): symlinks, with targets inline in the inode or in one block - #172

Merged
mattmattox merged 9 commits into
mainfrom
feat/symlinks
Nov 17, 2026
Merged

mattmattox merged 9 commits into
mainfrom
feat/symlinks

Conversation

@mattmattox

@mattmattox mattmattox commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

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:

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

mattmattox and others added 3 commits November 16, 2026 16:40
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 and others added 6 commits November 16, 2026 17:08
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>
@mattmattox
mattmattox merged commit 125d4ae into main Nov 17, 2026
18 checks passed
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