Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1810b4e
refactor(nfs): move Released and Kernel::release into kernel/released…
jiangkoumo Nov 14, 2026
210d5f8
feat(nfs): decode the AppleDouble image a macOS client writes (lp73)
jiangkoumo Nov 14, 2026
fa5dd34
feat(nfs): hold a whole AppleDouble image as its own attributes (lp73)
jiangkoumo Nov 14, 2026
584cc3e
docs(nfs): document the decoded AppleDouble companion (lp73)
jiangkoumo Nov 14, 2026
7b38dad
feat(nfs): spill AppleDouble companion bodies beyond the resident bud…
jiangkoumo Nov 14, 2026
91434f9
test(nfs): cover the companion spill, its files and its cleanup (lp73)
jiangkoumo Nov 14, 2026
8183f89
docs(nfs): document the companion spill area and its cleanup (lp73)
jiangkoumo Nov 14, 2026
dc2c54c
feat(nfs): one companion per inode, beyond 4,096 per export (lp73)
jiangkoumo Nov 14, 2026
12f37b4
test(nfs): cover the companion index bound, aliases and reclamation (…
jiangkoumo Nov 14, 2026
6af05cd
docs(nfs): document the companion index and the inode binding (lp73)
jiangkoumo Nov 14, 2026
b01e805
feat(nfs): encode only the window of the AppleDouble image a READ ask…
jiangkoumo Nov 14, 2026
7ef50a0
refactor(nfs): count decoded AppleDouble images in the resident budge…
jiangkoumo Nov 14, 2026
7a9f20c
Merge lp636-codec into lp636-spill (lp73)
jiangkoumo Nov 14, 2026
e323c0e
feat(nfs): spill a decoded AppleDouble body like any other body (lp73)
jiangkoumo Nov 14, 2026
73f62ef
perf(nfs): keep companion bodies in an eviction order, not a scan (lp73)
jiangkoumo Nov 14, 2026
0cbd34c
perf(nfs): adopt a spilled companion body without the rename under th…
jiangkoumo Nov 14, 2026
485dd2f
fix(nfs): serve a READ that raced a truncation as a short read (lp73)
jiangkoumo Nov 14, 2026
e3e46ae
docs(nfs): record the AppleDouble scratch area as a disposable area (…
jiangkoumo Nov 14, 2026
76adb9e
Merge lp636-spill into lp636-index (lp73)
jiangkoumo Nov 14, 2026
e9f49fb
fix(nfs): decide the AppleDouble slot bound in one place, before comm…
jiangkoumo Nov 14, 2026
812cb84
fix(nfs): settle the resident budget on a companion RENAME (lp73)
jiangkoumo Nov 14, 2026
e902530
fix(nfs): confirm a companion's main file before reclaiming it (lp73)
jiangkoumo Nov 14, 2026
3c3558f
chore(nfs): make the AppleDouble companion edits fmt- and clippy-clea…
jiangkoumo Nov 14, 2026
428ffc3
chore(nfs): make the AppleDouble codec edits fmt- and clippy-clean (l…
jiangkoumo Nov 14, 2026
bdb87af
Merge the codec layer's fmt and clippy pass (lp73)
jiangkoumo Nov 14, 2026
525fcfb
Merge the spill layer's fmt and clippy pass (lp73)
jiangkoumo Nov 14, 2026
ec17db8
fix(nfs): keep an eviction victim's failure out of the writer's reply…
jiangkoumo Nov 14, 2026
aec83af
fix(nfs): leave a failed disk edit's length where it was (lp73)
jiangkoumo Nov 14, 2026
c94693a
Merge the spill layer's victim-error and failed-edit fixes (lp73)
jiangkoumo Nov 14, 2026
f6cb678
fix(nfs): register the main file a reclamation's lookup found (lp73)
jiangkoumo Nov 14, 2026
45d0903
fix(nfs): keep a companion with the inode's other names, and link its…
jiangkoumo Nov 14, 2026
c96af5b
fix(nfs): report companions no name reaches when the export releases …
jiangkoumo Nov 14, 2026
386c5b0
fix(nfs): hold the index slot a commit is still going to take (lp73)
jiangkoumo Nov 14, 2026
0b87716
fix(nfs): reclaim a companion whose main directory is gone (lp73)
jiangkoumo Nov 14, 2026
d114c13
docs(nfs): state what one decoded body is charged, and the one-body o…
jiangkoumo Nov 14, 2026
54b9c1b
fix(nfs): let any name of a companion keep it out of reclamation (lp73)
jiangkoumo Nov 15, 2026
70c55da
fix(nfs): trace the AppleDouble names one client asks about (lp73)
jiangkoumo Nov 15, 2026
6da07ef
fix(nfs): keep an inode's `._` name when its main name goes (lp73)
jiangkoumo Nov 15, 2026
ff28f61
Merge upstream/layerfs_v2_0_0 (cb8ced9d3) into the codec layer (lp73)
jiangkoumo Nov 15, 2026
e3c80ed
Merge the codec layer's upstream merge (ff28f6118) into the spill lay…
jiangkoumo Nov 15, 2026
46550ff
fix(nfs): mount macOS exports with nordirplus
jiangkoumo Nov 16, 2026
1cdb96a
Merge the spill layer upstream merge (e3c80ed1c) into the index layer…
jiangkoumo Nov 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/architecture/engine/daemon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ layerfs-daemon --config <file>
| Takes a fresh incarnation | `generate_keypair()`; the public half is `DaemonStatus.instance` | [`application/owner.rs`](../../../../engine/crates/layerfs-daemon/src/application/owner.rs) |
| Opens the Store | An installed SQLite file with the `Disposable` profile, or PostgreSQL (feature `postgresql`); `Sqlite { install: None }` waits for an install | [`application/owner.rs`](../../../../engine/crates/layerfs-daemon/src/application/owner.rs), [`Cargo.toml`](../../../../engine/crates/layerfs-daemon/Cargo.toml) |
| Starts FUSE serving (Linux) | `/dev/fuse` to `0600`, checks the mount home, mounts a private `fusectl` tree for abort controls; if that fails, writes `LAYERFS_DAEMON_ABORT_UNBOUND` and starts without forced unmount | [`application/filesystem.rs`](../../../../engine/crates/layerfs-daemon/src/application/filesystem.rs) |
| Starts NFS serving | `ExportServing`; force-unmounts client mounts a previous daemon left (`LAYERFS_NFS_RECLAIM` lines); helper overrides `LAYERFS_NFS_MOUNT`, `_UNMOUNT`, `_FORCE`, `_FLUSH` | [`application/filesystem.rs`](../../../../engine/crates/layerfs-daemon/src/application/filesystem.rs) |
| Starts NFS serving | `ExportServing`; force-unmounts client mounts a previous daemon left (`LAYERFS_NFS_RECLAIM` lines); the same reclaim deletes `<mounts>/.appledouble`, the AppleDouble companions' disposable scratch area (directories `0700`, files `0600`, no fsync, no space reserved ahead), and touches nothing else under the mount home; helper overrides `LAYERFS_NFS_MOUNT`, `_UNMOUNT`, `_FORCE`, `_FLUSH` | [`application/filesystem.rs`](../../../../engine/crates/layerfs-daemon/src/application/filesystem.rs), [`export.rs`](../../../../engine/crates/layerfs-daemon/src/control/export.rs) |

### Phases and Hello

Expand Down
159 changes: 146 additions & 13 deletions docs/architecture/engine/kernel-routes/nfs.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/general/cleanup.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ net change; do not attribute an unisolated change entirely to one removal.
| Historical sample databases, exports, and payloads | Closed run, no current consumer, records preserved, disposal authorized | Remove selected payloads and record that they are unavailable for future proof reuse |
| Prepared fixture masters, inventories, sealed Stores, binaries, and images | Current task, harness defaults, source identities, and reuse records | Keep resources selected for ongoing work or qualifying reuse |
| Docker sample containers and volumes | Exact mapping to closed run records, current processes, consumers, and ownership | Stop and remove the identified resources after ownership is established |
| AppleDouble companion scratch area, `<mounts>/.appledouble/<namespace>/` in a Sandbox's mount home | Disposable per-mount area: directories `0700`, files `0600`, no fsync and no space reserved ahead; the daemon deletes it at export release and its startup reclaim deletes any it finds, touching nothing else in the mount home | Remove it with the mount home or Sandbox it belongs to; it never holds Workspace, Commit or Store state, so no proof needs it kept |
| Inactive agent transcripts and text records | No writer; no pinned file identity or current allocation requirement | Prefer verified transparent compression where supported |
| Live application databases, WAL files, active logs, and session state | Owning application and current use | Preserve |
| Download, installer, browser, and package caches | Current consumers, installation activity, and supported pruning behavior | Remove unused staging files or prune through the appropriate installed tool |
Expand Down
59 changes: 41 additions & 18 deletions engine/crates/layerfs-daemon/src/control/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,18 @@ impl Mounter {
/// access time: this export keeps one timestamp and shows it as atime,
/// mtime and ctime alike, and `layerfs-nfs` decodes and drops a SETATTR's
/// access time, so the update would cost one SETATTR per file a read or a
/// scan touches and change nothing.
/// scan touches and change nothing. `nordirplus` turns READDIRPLUS off:
/// a client holding a directory's complete READDIRPLUS listing answers a
/// `._` name absent from it with "not found" and never asks the server,
/// and this export never lists the AppleDouble companions it serves, so
/// every `._` name has to arrive as a LOOKUP.
pub fn host() -> Self {
let helper = |words: &[&str]| Helper(words.iter().map(|w| (*w).to_owned()).collect());
if cfg!(target_os = "macos") {
// `rsize`/`wsize` ask for the window FSINFO declares; the client
// clamps to the smaller of the two.
let options = format!(
"vers=3,tcp,port={{port}},mountport={{port}},locallocks,nfc,noatime,actimeo=60,rsize={WINDOW},wsize={WINDOW},soft,intr,dumbtimer,timeo=300,retrans=6,mutejukebox,nobrowse"
"vers=3,tcp,port={{port}},mountport={{port}},locallocks,nfc,noatime,actimeo=60,rsize={WINDOW},wsize={WINDOW},soft,intr,dumbtimer,timeo=300,retrans=6,mutejukebox,nobrowse,nordirplus"
);
Self {
mount: helper(&["/sbin/mount_nfs", "-o", &options, "127.0.0.1:/", "{dir}"]),
Expand Down Expand Up @@ -179,27 +183,44 @@ impl ExportServing {
fn directory(&self, token: WorkspaceToken) -> PathBuf {
self.config.mounts.join(token.namespace.to_string())
}
fn companion_spill_dir(&self, token: WorkspaceToken) -> PathBuf {
self.spill_root().join(token.namespace.to_string())
}
/// Every companion's scratch directory lives below this one, outside the
/// mount home's mounts.
fn spill_root(&self) -> PathBuf {
self.config.mounts.join(".appledouble")
}
/// At startup, before any Attach: every mount the host still has at or
/// under the mount home is one a daemon that ended without unmounting
/// left (its export is gone, so the client would hang on it). Each is
/// forced off once with the force helper; one line per mount says what
/// happened. Nothing is retried.
/// happened. Nothing is retried. The companions' scratch directories of
/// that daemon belong to exports that are gone too, so they go as well;
/// nothing else under the mount home is touched.
pub fn reclaim(&self) -> Vec<String> {
let mut lines = Vec::new();
let spill = self.spill_root();
if std::fs::remove_dir_all(&spill).is_ok() {
lines.push(format!("removed leftovers under {}", spill.display()));
}
let points = match mounted_under(&self.config.mounts) {
Ok(points) => points,
Err(error) => return vec![format!("mount table unreadable: {error}")],
Err(error) => {
lines.push(format!("mount table unreadable: {error}"));
return lines;
}
};
(points.into_iter())
.map(|point| {
let text = point.display().to_string();
match self.helpers.run(&self.config.mounter.force, 0, &text) {
Ran::Done => format!("forced off {text}"),
Ran::Busy(detail) | Ran::Failed(detail) | Ran::Interrupted(detail) => {
format!("left {text}: {detail}")
}
lines.extend((points.into_iter()).map(|point| {
let text = point.display().to_string();
match self.helpers.run(&self.config.mounter.force, 0, &text) {
Ran::Done => format!("forced off {text}"),
Ran::Busy(detail) | Ran::Failed(detail) | Ran::Interrupted(detail) => {
format!("left {text}: {detail}")
}
})
.collect()
}
}));
lines
}
}
/// Mount points at or under `home`, deepest first, from the host's table:
Expand Down Expand Up @@ -481,12 +502,10 @@ impl Service {
}
};
let export = ExportConfig {
path: "/".into(),
uid: config.command_uid,
gid: config.command_gid,
read_only: false,
refuse_apple_double: config.refuse_apple_double,
lookups_held: config.lookups_held,
companion_spill_dir: Some(serving.companion_spill_dir(token)),
..ExportConfig::writable(config.command_uid, config.command_gid)
};
let started = TcpListener::bind((config.listen, 0)).and_then(|listener| {
Server::start(
Expand Down Expand Up @@ -531,6 +550,7 @@ impl Service {
Ran::Busy(detail) | Ran::Failed(detail) => {
let released = server.stop();
drop(std::fs::remove_dir(&directory));
drop(std::fs::remove_dir(serving.spill_root()));
return Err(self.unwind_export(
workspace,
mount,
Expand Down Expand Up @@ -751,6 +771,9 @@ impl Service {
return Err(Failure::Retained(Box::new(reply)));
}
drop(std::fs::remove_dir(&ready.directory));
if let Some(serving) = self.export.as_ref() {
drop(std::fs::remove_dir(serving.spill_root()));
}
if let Ok(mut entries) = self.entries.lock() {
if let Ok(binding) = bound_mut(&mut entries, token) {
binding.kernel = Kernel::Unattached;
Expand Down
1 change: 1 addition & 0 deletions engine/crates/layerfs-nfs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ layerfs-persistence = { path = "../layerfs-persistence" }
layerfs-project = { path = "../layerfs-project" }
layerfs-storage = { path = "../../../core/crates/layerfs-storage" }
layerfs-telemetry = { path = "../../../core/crates/layerfs-telemetry" }
libc = "=0.2.189"
Loading