Repository navigation
Kernel routes: ESTALE for dropped serials, checked parent index, full readdir pages (#7, #17, #12) - #763
Merged
Conversation
… readdir pages Three fixes from the 2.0.0 overlay review, each confirmed in code and by a test that fails on the old code. #7 A merge can drop a serial the kernel still holds (a cwd, an open descriptor). GETATTR on it hit InvalidRecord("bound inode is absent"), was retained, and made the whole FUSE mount terminal. A serial the kernel names by itself (GETATTR, OPEN, OPENDIR, a LOOKUP's directory, READ, READLINK, READDIR of an open handle) that no local row or base inode has is now OverlayError::Stale (Eval::held). Mount ports classify only the engine's own Stale answer as stale (ports::stale; no wrapper is looked through), and FUSE answers ESTALE for that request alone without retaining it. NFS already maps an engine Stale to NFS3ERR_STALE. A name bound to an absent inode and count underflow stay InvalidRecord and terminal. Mutations are unchanged: they already refuse Missing. #17 The kernel parent index is the only evidence the rename cycle check has, and an install never rewrites it. Invalidation does not help: a held cwd or descriptor needs no path walk. Each index row now carries the name it was recorded under, a rename in place updates it too, and a kernel rename of a directory checks every link from the destination to the root against the current view before its cycle check. A link that no longer holds is AncestryMismatch (EINVAL); the next LOOKUP records the directory's current place. install.rs and generation.rs are untouched. #12 The base page budget is derived from the reader's row charge (NAME_LENGTH_BYTES + DIRECTORY_LEAF_SERIAL_BYTES + 255) instead of 264, and the merge stops at the base's last fetched name whenever the base page has a continuation, so a short page can never skip names. Tests: workspace kernel_stale (all three), mount-ports stale (classifier), daemon stale_handles (Linux FUSE: ESTALE through a held cwd with the mount still serving; no cycle through a held cwd the merge moved). The kernel_data case "an inode the kernel holds that neither the base nor a local row has" now expects Stale instead of Missing: the contract changed, the assertion is not weakened. No test deleted. Production LOC: 206,537 -> 206,676 (delta +139) core 40,988 -> 40,988 (0) engine 95,899 -> 96,038 (+139) layerfs-fuse +6, layerfs-mount-ports +25, layerfs-overlay +61, layerfs-workspace +47 control 59,325 -> 59,325 (0) api 10,325 -> 10,325 (0) reference absent (retired R9c; last counted 65,417 at tree 498dd19) Method: tools/production_loc.py --detail on parent 343c59b and the staged tree 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.
Fixes three kernel-route findings from the LayerFS 2.0.0 overlay review (#7, #17, #12). Each one was confirmed in code, and each new test fails on the old code (macOS for the workspace tests, Linux FUSE for the daemon test).
#7: a dropped serial gives ESTALE, not a terminal FUSE mount
InvalidRecord("bound inode is absent"). The failure was retained, andwork.terminal = trueended the whole mount.OverlayError::Stale(Eval::held). It covers any request that names a serial on its own: GETATTR, OPEN, OPENDIR, a LOOKUP's directory, READ, READLINK, and READDIR on an open handle. The serial has no local row and no base inode.ports::staleaccepts only two shapes, the visit's own Stale and the Workspace Stale from a window finished outside the owner. It never looks through wrappers, so an uncertain, retained or owner failure stays retained.ESTALEfor that request alone, retains nothing, and keeps serving.NFS3ERR_STALE. No NFS file is touched.#17: the parent index is checked against the current view
rename(/x, y/x2)could still make a cycle after a merge movedyunderx.AncestryMismatch(EINVAL). The next LOOKUP records the directory's current place.install.rsandgeneration.rs(owned byv2-commit-path) are not touched.#12: readdir byte budget
PAGE_ROWS * (NAME_LENGTH_BYTES + DIRECTORY_LEAF_SERIAL_BYTES + MAXIMUM_NAME_BYTES), replacing* 264.Behaviour changes to note
Tests
layerfs-workspacekernel_stale(new)listand through READDIR paginglayerfs-mount-portsstale(new)layerfs-daemonstale_handles(new, Linux FUSE)retained == 0. No cycle through a held cwd that a merge movedkernel_data(changed)Checks run
--no-runbuilds: all 63 test binaries of layerfs-workspace, overlay, mount-ports and nfs build and pass.-D warningsis clean for workspace, overlay, mount-ports, nfs, daemon and fuse./dev/fuse, SYS_ADMIN,apparmor=unconfined):stale_handles,negative_entries,kernel_mutation,kernel_coherence,kernel_custody,mounted_install,mounted_listing_reads,mounted_cycles,mounted_linksandmounted_rewindall pass. The fuseattributesandrequeststests and mount-portsstalepass on Linux too.kernel_stalefails 3/3 on macOS.stale_handlesfails 2/2 on Linux:stat .gives EIO (the mount went terminal), andmvmakes the cycle.Gaps
request/module is Linux-only, so clippy did not check it. The Linux rustc build had 0 warnings.Production LOC: 206,537 -> 206,676 (delta +139)
core 40,988 -> 40,988 (0)
engine 95,899 -> 96,038 (+139) layerfs-fuse +6, layerfs-mount-ports +25, layerfs-overlay +61, layerfs-workspace +47
control 59,325 -> 59,325 (0)
api 10,325 -> 10,325 (0)
reference absent (retired R9c; last counted 65,417 at tree 498dd1917812)
Method: tools/production_loc.py --detail on parent 343c59b and the staged tree
🤖 Generated with Claude Code