Repository navigation
fix(daemon,sandbox): follow-ups to the native NFS forced teardown (#644) - #731
Merged
Merged
Conversation
Review follow-ups after merging #644 (layerfs-project#136): - A failed or timed-out unmount helper proves the client mount gone only once its exit has been observed (`Ran::ended`). A plain Linux `umount` drops the mountinfo entry before the superblock's shutdown, which flushes the client's writes through the export; a killed helper still running keeps `Retained(Detach)`, and Force finishes it. - The sandbox undoes an unmount attempt's record when the exchange failed before sending was attempted, as for a call that never connected, so a forceable `Retained/Detach` record is not replaced by an unforceable one. - The macOS mount table is read by one bounded listing, moved from the macOS driver to `layerfs_bridge::process::mount_table` (500 ms, then killed and read as an unreadable table); the daemon's Attach tracking, failed-unmount checks and reclaim now use it instead of an unbounded `/sbin/mount`. - `Helpers` no longer derives `Default` (a zero helper deadline) and keeps its waits private. Tests: new `a_helper_still_running_never_proves_a_vanished_mount_gone` (fails under the previous rule); `timed_out_helper_when_mount_already_gone_ completes_teardown` now observes the killed helper's exit. No tests deleted. Production LOC: 172,703 -> 172,717 (delta +14) core 39,795 -> 39,795 (0) engine 77,204 -> 77,277 (+73) layerfs-bridge +79 (mount_table moved in), layerfs-daemon -6 control 49,287 -> 49,228 (-59) layerfs-sandbox +6, layerfs-sandbox-backend -65 (mount_table moved out) api 6,417 -> 6,417 (0) reference absent (retired R9c; last counted 65,417 at tree 498dd19) Method: python3 tools/production_loc.py --json on the parent (39a2513) and the staged tree, exported with git archive. 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.
Tier: P1
Risks: risk:kernel risk:security
Docs: docs/architecture/engine/kernel-routes/nfs.md, docs/architecture/engine/daemon/control-calls.md, docs/architecture/api/sdk/workspace.md
Review follow-ups to #644 (layerfs-project#136), which is merged into
layerfs_v2_0_0.What changes
Ran::ended). On Linux, a plainumountremoves the mount from mountinfo before the kernel shuts it down, and that shutdown still flushes the client's writes through the export. Under fix(daemon): 原生 NFS 卸载超时后回收 helper 并完成 teardown(layerfs-project#136) #644, a killed helper stuck in that flush with the mount already gone from the table let teardown stop the server. Now the export is kept asRetained(Detach)andforcefinishes it.ControlFailure::attempted == false), the sandbox puts back the earlier unmount record, as it already did for a failed connect. Before, a failed--forceover aRetained/Detachrecord wroteforced: truewith no stage, so the Workspace could never be forced again. A send that was attempted is still recorded./sbin/mountreader moves from the macOS driver into the bridge crate aslayerfs_bridge::process::mount_table: 500 ms, then the listing is killed and treated as an unreadable table, never as "not mounted". Attach tracking, failed-unmount checks and startup cleanup in the daemon now use it instead of aCommand::output()with no time limit.Helpersno longer derivesDefault. The derived default had a 0 s helper deadline, which would kill every helper immediately. Its wait fields are now private.Production LOC: 172,703 -> 172,717 (delta +14). Engine +73 (layerfs-bridge +79, where
mount_tablemoved in; layerfs-daemon -6). Control -59 (layerfs-sandbox +6; layerfs-sandbox-backend -65, wheremount_tablemoved out). Core and api unchanged.Not changed (left for owner decision)
ExportServingConfig::mount_table,ExportServing::reaped_helpers, the zero-reap_waitbranch) still conflict with engine/AGENTS.md ("fault injection", "test-only public APIs"). Removing them means deleting fivehelper_deadlinetests or building a test setup with real mounts.Helper::lazystill detects a lazy unmount from the helper's own flags, so a wrapper script that runsumount -lreads as non-lazy. An explicit setting on the mounter would fix that.Checks (macOS, toolchain 1.85.1)
cargo clippy -p layerfs-bridge -p layerfs-daemon -p layerfs-sandbox -p layerfs-nfs -p layerfs-sandbox-backend --all-targets -- -D warnings: clean.helper_deadline9/9,record_codec5/5,unmount_record9/9, each run under a 120 s limit.a_helper_still_running_never_proves_a_vanished_mount_gone: checked against the old rule (it fails there) and passes with the fix.🤖 Generated with Claude Code