Skip to content

fix(daemon): name every change a dirty Unmount refusal counts - #488

Merged
yifanxuaaa merged 1 commit into
Ephemeral-AI-Lab:mainfrom
RGB-loop:fix/462-dirty-refusal-unnamed
Oct 28, 2026
Merged

yifanxuaaa merged 1 commit into
Ephemeral-AI-Lab:mainfrom
RGB-loop:fix/462-dirty-refusal-unnamed

Conversation

@RGB-loop

Copy link
Copy Markdown
Contributor

Refs #462. This fixes the refusal half of the issue; two items in its Expected section are not covered (listed under "Not changed").

Problem

A checked workspace.unmount without discard counts every dirty overlay inode. After touch ., touch .probe && rm .probe or mkdir .d && rmdir .d, the overlay holds inode rows a Commit drops, so the unmount is refused Dirty: 0 uncommitted change(s) with changed: [], while workspace.commit answers UpToDate. After a real directory chmod, the change is counted but no path is named, because the probe only names entry rows.

Fix

control/dirty.rs only. The dirty probe now follows Commit's rule for the rows it counts:

  • a locally created inode that no name binds any more is skipped (Commit cannot keep it);
  • a base directory whose mode equals the base is skipped (Commit ignores a directory's mtime);
  • a base directory whose mode differs is named, / for the root.

Files stay conservative: a changed base file is still counted and named, even when only its mtime changed.

Not changed

  • A base file whose only change is its mtime (e.g. /.git/index) still refuses the unmount. It is now named, but Commit would drop it.
  • list_changes still skips directories that have a local row (operator/workspace.rs), so a directory chmod is named by the refusal but not listed by list_changes. Status counts are unchanged.

Tests

New layerfs-api/tests/unmount_dirty.rs:

  • changes_a_commit_drops_do_not_refuse_an_unmount: touch ., touch .git, create+unlink, mkdir+rmdir unmount without discard.
  • a_refusal_names_every_change_it_counts: chmod /, chmod /.git, a created file and an index mtime change refuse, naming exactly their path, not truncated.

On main without the dirty.rs change, both fail:

touch .: Dirty(DirtyReport { ..., paths: [], inodes: 1, entries: 0, pending_merge: false, truncated: false })
left: ([], false)    right: (["/"], false)

With it, both pass. Locally (Linux, Rust 1.95.0, Disposable fixture, no mount): cargo fmt --check and the boundary check pass; cargo clippy -p layerfs-daemon --lib -p layerfs-api --test unmount_dirty -- -D warnings passes with -A clippy::result_large_err (on 1.95 that lint fires only in three files this PR does not touch); the other layerfs-daemon / layerfs-api tests that fail here need /dev/fuse, fusectl or cgroups, which this host does not have. Not run locally: the CI toolchain (1.85.1), FUSE end-to-end tests and macOS.

Production LOC: +35 (layerfs-daemon 6,035 -> 6,070).

🤖 Generated with Claude Code

A checked Unmount without discard refused with "Dirty: 0 uncommitted
change(s)" after changes a Commit drops (touch ., create+unlink,
mkdir+rmdir), and after a real directory chmod it counted the change but
named no path. The dirty probe now skips rows that are no change - a
locally created inode no name binds any more, and a base directory whose
mode equals the base (Commit ignores its mtime) - and names a base
directory whose mode differs, "/" for the root. Files stay conservative.

Refs Ephemeral-AI-Lab#462. Not covered here, still as on main:
- a base file whose only change is its mtime (e.g. /.git/index) still
  refuses Unmount, now naming that path; Commit would drop it.
- list_changes still skips directories with a local row
  (operator/workspace.rs), so a directory chmod is named by the refusal
  but not listed by list_changes; status counts are unchanged.

Test added: layerfs-api/tests/unmount_dirty.rs (touch ., touch .git,
create+unlink, mkdir+rmdir close; chmod /, chmod /.git, a created file
and an index mtime refuse naming exactly their path, not truncated).
No tests deleted.

Production LOC: 102,165 -> 102,200 (delta +35)
Scope and method: tools/production_loc.py --root; layerfs-daemon
6,035 -> 6,070; reference absent (retired R9c; last counted 65,417 at
tree 498dd19).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RGB-loop
RGB-loop marked this pull request as ready for review October 27, 2026 22:16
@yifanxuaaa
yifanxuaaa merged commit 582bc78 into Ephemeral-AI-Lab:main Oct 28, 2026
3 checks passed
jiangkoumo added a commit to jiangkoumo/layerfs that referenced this pull request Oct 28, 2026
…-AI-Lab#427)

Brings main up to 582bc78 (Ephemeral-AI-Lab#488, Ephemeral-AI-Lab#481 forced unmount after a stalled
Join, Ephemeral-AI-Lab#479, Ephemeral-AI-Lab#471, Ephemeral-AI-Lab#473, Ephemeral-AI-Lab#445 fs modes, Ephemeral-AI-Lab#475, Ephemeral-AI-Lab#478, Ephemeral-AI-Lab#476 Docker API
negotiation, Ephemeral-AI-Lab#396, Ephemeral-AI-Lab#419, Ephemeral-AI-Lab#418, Ephemeral-AI-Lab#415, Ephemeral-AI-Lab#477, Ephemeral-AI-Lab#468).

Two conflicts, both from Ephemeral-AI-Lab#481 (forced unmount of a normal unmount stalled
at Join):
- engine/crates/layerfs-daemon/src/control/force.rs: guard() keeps this
  branch's ExportKept check (an NFS export kept after a failed teardown
  answers with its stored custody first) and takes main's comment and its
  forceable() exception for a retained FUSE session. The non-Linux
  `let _ = token;` stays removed: ExportKept uses the token on every
  platform.
- engine/crates/layerfs-node/src/workspace.rs: unmount() keeps this
  branch's per-Workspace unmount lease (repeat a published outcome, drop
  the admission guard before the daemon call, publish the outcome before
  cleanup) and takes main's `force` option inside it: forced, one
  api.unmount(token, true) whose None answer is Unmounted::Closed;
  otherwise unmount_checked with `discard` as before.

Production LOC: first-parent 9478190 108596 -> 109158
(tools/production_loc.py --root .; the delta is main's own changes)
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.

2 participants