Repository navigation
nfs: serve real ._* files; let a user chmod through the refresh mark (review #8, #9) - #762
Merged
Merged
Conversation
With `refuse_apple_double` (the default), LOOKUP answered NFS3ERR_NOENT for every `._` name before asking the engine, while READDIR listed the real ones: a repository that contains `._foo` showed it in `ls` and then failed to open it (review finding #8, V-OV-3). A `._` name the Workspace view holds is now an ordinary Workspace file: - LOOKUP of a `._` name asks the view first and answers a companion only when the view has no such name, so LOOKUP and READDIR agree; GETATTR, READ, WRITE and SETATTR then reach the engine by serial as for any file. - CREATE of a `._` name the view holds is the ordinary CREATE of that file (UNCHECKED opens it, GUARDED/EXCLUSIVE answer EXIST); no companion is made, so nothing shadows it. The attributes a macOS client then stores there go into the Workspace file, as on any NFSv3 server. - REMOVE removes it, and RENAME may replace it; RENAME onto a `._` name the view lacks stays NFS3ERR_ACCES. - Names the view does not hold keep using the export-memory companions as before; a companion whose name the view gains later is shadowed by the real file. Cost: LOOKUP, CREATE, REMOVE and RENAME of a `._` name now make one engine LOOKUP (an observe visit) to ask the view, also for companions and absent names. The job-count test in tests/write.rs asserted zero owner jobs for a companion CREATE+WRITE+SETATTR+REMOVE and an absent `._` LOOKUP; that contract is what hid real files, so its exact expectation is now two and three observe visits with zero mutate visits (still exact, not loosened). Tests: new tests/apple_double_view.rs (a base with `._foo` and `d/._bar`: listed, LOOKUP+READ, CREATE GUARDED/UNCHECKED, WRITE, RENAME onto it, REMOVE, committed; a new companion still stays in memory and out of the Commit). Docs: kernel-routes/nfs.md AppleDouble section and LOOKUP rule, kernel-routes/README.md test table. Production LOC: 206,537 -> 206,585 (delta +48) core 40,988 -> 40,988 (0) engine 95,899 -> 95,947 (+48) layerfs-nfs +48 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>
After a merged Commit the daemon marked every stale serial at once, then chmodded the paths one by one on a background thread; for up to 30 s any mode-only SETATTR on a marked serial was answered with the current attributes and changed nothing, without comparing the requested mode. So `chmod +x f` right after a Commit reported success and did nothing (review finding #9, V-OV-4). Now the mark suppresses only the refresh's own chmod: - `Server::refresh` returns (serial, path) and marks nothing. - The refresh thread lstats each path through the mount (skipping a symlink, a vanished path and a path that now names another inode), marks that serial with exactly the mode it is about to ask (`Refresher::arm`), then chmods to it. - `Kernel::refreshed` takes the mark only for a mode-only SETATTR asking the marked mode. A client SETATTR asking another mode is applied, and leaves the mark for the refresh chmod still on its way, which is then answered without a change, so the refresh never overwrites a newer user chmod. - `Refresher` holds a weak reference, so the thread never keeps a stopping export alive (unmount's `Arc::try_unwrap` stays unaffected), and stops once the export is gone. Residual: a client chmod to the very mode just marked, sent in the microseconds between the mark and the refresh's chmod, is answered unchanged; the refresh's chmod that follows applies that same mode. Documented, with the existing limits: the refresh is best effort, runs after the Commit reply and stops at 4,096 stale inodes. Tests: tests/refresh.rs now asserts the new contract. Its old assertion that a marked chmod to another mode (0o600 on a 0o644 file) is swallowed was the bug itself and is replaced: the refresh chmod asking the marked mode is answered unchanged; a user chmod to another mode inside the window is applied and the refresh chmod after it does not undo it (committed 0o700); a stopped export takes no mark. Docs: kernel-routes/nfs.md refresh section, kernel-routes/README.md. Production LOC: 206,585 -> 206,624 (delta +39) core 40,988 -> 40,988 (0) engine 95,947 -> 95,986 (+39) layerfs-daemon +5, layerfs-nfs +34 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 2033a2e and the staged tree Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yifanxuaaa
added a commit
that referenced
this pull request
Nov 23, 2026
Follow-up to 37c0a8b (finding #4), found on an integration branch of PRs #762-#765. layerfs-control tests/mount_control.rs an_original_unknown_blocks_another_commit_and_normal_unmount injected a StorageError::UnknownOutcome from the producer during construction and expected the Workspace to stay Uncertain. Before the Publish phase a Store unknown cannot have published, so under the phase-aware CommitFailure::uncertain() it folds back and answers Failed; the test failed at mount_control.rs:298. The test keeps its intent ("an original unknown blocks another Commit and a normal unmount") with an uncertainty that still holds before Publish: an overlay outcome unknown (OverlayError::Uncertain). It is renamed an_original_local_unknown_blocks_another_commit_and_normal_unmount. The Store unknown it used to inject moves to a new test, a_store_unknown_before_publication_folds_back_and_admits_a_commit: Failed, the Workspace stays Idle on its binding with nothing published, a later Commit publishes over the bound head, and a normal unmount is admitted. No test deleted. Production LOC: 207,195 -> 207,195 (delta 0) core 40,989 -> 40,989 (0) engine 96,515 -> 96,515 (0) control 59,366 -> 59,366 (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 384dbb3 and the staged tree (test-only change) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yifanxuaaa
added a commit
that referenced
this pull request
Nov 23, 2026
Follow-up to 384dbb3 (finding #5), found by the nightly mount lane on an integration branch of PRs #762-#765. layerfs-daemon tests/mounted_commit_failures.rs F3 stages Boundary::LostAcknowledgement (a real publication, then UnknownOutcome) and its retained tail expected the next Commit to be refused; under #5 that Commit's one resolution reads the head, finds exactly this Commit and installs it, so the Commit was admitted (panic at mounted_commit_failures.rs:478). F3 is renamed f3_unknown_history_outcome_is_resolved_by_the_next_commit_and_the_mount_still_serves and ends in a new resolved_tail: after the failure the Workspace is Uncertain with both owners kept and the mount still serves the same view and a new write; an independent session reads the head as one Commit of the candidate root over the bound head (published once), and a fresh bind of it is the captured tree; the next Commit is admitted, its parent is that landed Commit, its root carries the write made since and equals the mount's tree (later_exact), the registry is Idle; reads still work and the normal unmount drains and removes the mount. Deleted: the retained_tail helper, its Kept enum, the refused() helper and the SECOND constant, whose only caller was F3's old expectation that the next Commit and a normal unmount are refused under retained custody. That contract no longer holds for a resolvable unknown outcome; retained custody that cannot be resolved is covered without a mount by store_commit.rs an_unknown_outcome_under_a_moved_head_stays_retained and by layerfs-control mount_control.rs an_original_local_unknown_blocks_another_commit_and_normal_unmount. The module header notes F3's new end and where the nothing-published case is staged. Production LOC: 207,195 -> 207,195 (delta 0) core 40,989 -> 40,989 (0) engine 96,515 -> 96,515 (0) control 59,366 -> 59,366 (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 cecee1e and the staged tree (test-only change) 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 two NFS-route findings from the LayerFS 2.0.0 overlay review (#8 / V-OV-3 and #9 / V-OV-4). I re-checked both in the code before fixing them, and both were real.
1. Real
._*files were hidden (finding #8)Bug: with
refuse_apple_double(the default), LOOKUP answeredNFS3ERR_NOENTfor every._name before it asked the engine. READDIR still listed the real ones, so a repository containing._fooshowed it inls, but opening it failed.Fix: a
._name that the Workspace view holds is now an ordinary Workspace file.EXIST.._name the view does not hold is stillACCES.._name now each make one engine LOOKUP. That includes companion and absent names.tests/write.rsasserted zero owner jobs for those calls. Zero jobs is the behaviour that hid real files. The test now expects exactly 2 and 3 observe visits, with 0 mutate visits.2. The refresh mark swallowed a user's chmod (finding #9)
Bug: after a merged Commit, every stale serial was marked at once. For up to 30 s, any mode-only SETATTR on a marked serial did nothing, whatever mode it asked for. So
chmod +xright after a Commit reported success and changed nothing.Fix:
Server::refreshnow returns(serial, path)pairs and marks nothing.Refresher::arm, which holds a weak reference so it never blocks unmount);tests/refresh.rsasserted that a marked chmod to another mode is swallowed. That assertion was the bug itself, so it now checks the new contract.Checks run (macOS,
tools/worktree.py cargo, toolchain 1.85.1, each test target ≤100 s)test -p layerfs-nfs -p layerfs-daemon --tests --no-run: okclippy -p layerfs-nfs -p layerfs-daemon --all-targets -D warnings: ok, at the final commitcargo fmt --check: oklayerfs-nfstest targets, all passing:apple_double_view(new): 1refresh: 1write: 15export: 10apple_double_decode: 32apple_double_codec: 7protocol: 15collect: 1daemon: 2helper_deadline: 9mounter: 2layerfs-nfsandlayerfs-daemonlib targets (0 tests each)Gaps
st_inoequals the export fileid (the inode check depends on it).MARK_LIFEis 30 s.Production LOC (range 343c59b..a10feaf)
Each commit message has its own LOC block (+48 and +39).
🤖 Generated with Claude Code