Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
d0e21d0
feat(nfs): read a READDIRPLUS window's facts in batches
jiangkoumo Nov 13, 2026
f2973a6
test(store): a PostgreSQL Store reads a READDIRPLUS window's facts in…
jiangkoumo Nov 13, 2026
64ad98b
docs(nfs): count a READDIRPLUS window's inode demand per tree level
jiangkoumo Nov 13, 2026
71606c1
docs(nfs): say when the window's one length demand still holds
jiangkoumo Nov 13, 2026
f87d032
test(workspace): state what the window's batch count depends on
jiangkoumo Nov 13, 2026
871fb04
docs(nfs): align remaining two-batch and cold-window wording
jiangkoumo Nov 13, 2026
4fa8381
Merge upstream/layerfs_v2_0_0 (de1d77e13) into pr637-r1
jiangkoumo Nov 13, 2026
67559fd
docs(kernel-routes): port Decided/LOOKUP note from deleted ports.md
jiangkoumo Nov 13, 2026
877a1aa
Merge upstream/layerfs_v2_0_0 (27920d3bb) into pr637-r3
jiangkoumo Nov 14, 2026
0b9c9e5
fix(nfs): a failed LOOKUP answers its job's directory row, never a st…
jiangkoumo Nov 14, 2026
fdf673e
perf(readdirplus): truncate to the published names before reading facts
jiangkoumo Nov 14, 2026
261cb22
perf(readdirplus): one inode read per listed name in the reading visit
jiangkoumo Nov 14, 2026
2fc186e
docs(kernel-routes): LOOKUP failures answer fresh directory facts
jiangkoumo Nov 14, 2026
e12c5cf
fix(nfs): a listing answers only the row its own window read
jiangkoumo Nov 14, 2026
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
e7349ff
Merge #637: batch READDIRPLUS facts and one-job LOOKUP (Ephemeral-AI-…
yifanxuaaa Nov 17, 2026
7c0f937
Merge #713: decode the AppleDouble image a macOS client writes (lp73)
yifanxuaaa Nov 17, 2026
efa138d
Merge #714: spill AppleDouble companion bodies to a per-mount scratch…
yifanxuaaa Nov 17, 2026
b9b2a31
Merge #722: one AppleDouble companion per inode, 65,536 per export (l…
yifanxuaaa Nov 17, 2026
9db8f4d
fix(nfs): no LOOKUP answers the export's last directory observation (…
yifanxuaaa Nov 17, 2026
fb28450
refactor(nfs): split apple_double.rs under the 999-line ceiling (#722…
yifanxuaaa Nov 17, 2026
77e7368
fix(nfs): reclaim a companion only if no call used it since the decis…
yifanxuaaa Nov 17, 2026
519f8db
fix(nfs): AppleDouble codec review fixes (#713 review)
yifanxuaaa Nov 17, 2026
3466c3d
fix(nfs): AppleDouble spill review fixes (#714 review)
yifanxuaaa Nov 17, 2026
fc40696
fix(nfs): companion rename, slot reservation and macOS mount options …
yifanxuaaa Nov 17, 2026
d4c6c82
chore: format the review fixes; compile #637's PostgreSQL test uncond…
yifanxuaaa Nov 17, 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; `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
4 changes: 2 additions & 2 deletions docs/architecture/engine/kernel-routes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ stops: a stopped mount starts nothing new and still gives back what it holds.

```text
LOOKUP/GETATTR/OPEN/OPENDIR KernelRead::prepare
loop: observe_visit -> Value | Refused | Needs(n): base(); supply; repeat
loop: observe_visit -> Value(Decided) | Refused | Needs(n): base(); supply; repeat
READ/READLINK KernelData::read
read_visit -> local window; base() only for inherited bytes
mutation KernelMutation::perform
Expand All @@ -85,7 +85,7 @@ stops: a stopped mount starts nothing new and still gives back what it holds.

| Type or module | Kernel requests | Source |
| --- | --- | --- |
| `KernelRead` | LOOKUP, GETATTR, OPEN, OPENDIR; holds nothing after its visits | [`lookup.rs`](../../../../engine/crates/layerfs-mount-ports/src/operations/lookup.rs) |
| `KernelRead` | LOOKUP, GETATTR, OPEN, OPENDIR; holds nothing after its visits (a LOOKUP also carries the directory it named, and a refused LOOKUP the directory row its own job read) | [`lookup.rs`](../../../../engine/crates/layerfs-mount-ports/src/operations/lookup.rs) |
| `KernelData` | READ, READLINK | [`read.rs`](../../../../engine/crates/layerfs-mount-ports/src/operations/read.rs) |
| `KernelMutation` | Every changing request; holds one `Publication` ticket until `replied` | [`mutation.rs`](../../../../engine/crates/layerfs-mount-ports/src/operations/mutation.rs) |
| `DirectoryStream` | READDIR; only accepted names become valid offsets | [`directory.rs`](../../../../engine/crates/layerfs-mount-ports/src/operations/directory.rs) |
Expand Down
180 changes: 164 additions & 16 deletions docs/architecture/engine/kernel-routes/nfs.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/architecture/engine/workspace/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ job.
| --- | --- | --- |
| Offset from before the handle was last listed from 0 | `rewound()`: lists nothing | [`kernel_directory.rs`](../../../../engine/crates/layerfs-workspace/src/operations/kernel_directory.rs) |
| Window of whiteouts only | Empty with a continuation; the request reads the next window | same |
| READDIRPLUS reply | Names and kinds come first (batched per inode-tree level), the reply's offer truncates the window to the names it publishes, and only those names' facts are read outside the owner: a re-sent reply reads nothing for a name it does not send | [`kernel_directory.rs`](../../../../engine/crates/layerfs-workspace/src/operations/kernel_directory.rs) |
| Names the kernel buffer accepted | Become resume cookies; nothing is held between the two visits or after the reply | same |

## Kernel mutations
Expand Down
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
51 changes: 35 additions & 16 deletions engine/crates/layerfs-daemon/src/control/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,27 +179,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 +498,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 +546,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 +767,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
10 changes: 7 additions & 3 deletions engine/crates/layerfs-daemon/src/service/filesystem_port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use layerfs_mount_ports::ports::{
};
use layerfs_overlay::{KernelCookieOffer, KernelMount, Publication};
use layerfs_workspace::{
BaseView, CanonicalClient, JobOutcome, KernelDirectoryWindow, KernelInput,
BaseView, CanonicalClient, JobOutcome, KernelDirectoryRead, KernelDirectoryWindow, KernelInput,
KernelMutationOutcome, KernelReadOperation, KernelReadOutcome, KernelVisitRequest,
KernelWindow, Recognition, RecognizeWork, VisitFacts, WorkspaceError, WriteData,
RECOGNIZE_BYTES,
Expand Down Expand Up @@ -106,6 +106,7 @@ impl RequestServices for FilesystemPort {
handle: u64,
offset: u64,
after: Option<Vec<u8>>,
attributes: bool,
) -> ServiceFuture<'_, ServiceReply<Arc<KernelDirectoryWindow>>> {
// A stopped mount refuses before anything about the request is read.
if let Err(fenced) = self.fenced(true) {
Expand All @@ -116,8 +117,11 @@ impl RequestServices for FilesystemPort {
mount,
serial,
handle,
offset,
after,
KernelDirectoryRead {
offset,
after,
attributes,
},
);
match visit {
Ok(visit) => self.call(
Expand Down
2 changes: 1 addition & 1 deletion engine/crates/layerfs-daemon/tests/mounted_sqlite_full.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ macro_rules! forward {
}
impl RequestServices for ObserveRequest {
forward! {
directory_visit(mount:KernelMount,serial:u64,handle:u64,offset:u64,after:Option<Vec<u8>>) -> ServiceReply<Arc<KernelDirectoryWindow>>;
directory_visit(mount:KernelMount,serial:u64,handle:u64,offset:u64,after:Option<Vec<u8>>,attributes:bool) -> ServiceReply<Arc<KernelDirectoryWindow>>;
publish_cookies(offer:KernelCookieOffer,names:Vec<Vec<u8>>) -> ServiceReply<()>;
close_directory(mount:KernelMount,serial:u64,handle:u64) -> ServiceReply<()>;
read_visit(mount:KernelMount,serial:u64,handle:Option<u64>,offset:u64,length:u32) -> ServiceReply<Arc<KernelWindow>>;
Expand Down
26 changes: 16 additions & 10 deletions engine/crates/layerfs-mount-ports/src/operations/directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ pub struct DirectoryStream {
offset: u64,
parent: Option<u64>,
window: Option<KernelDirectoryWindow>,
/// The reply shows every entry's facts, as READDIRPLUS does: the listing
/// then reads them from the authoritative base, outside the owner.
/// The reply shows each entry's facts (READDIRPLUS).
attributes: bool,
ended: bool,
}
Expand Down Expand Up @@ -183,7 +182,14 @@ impl DirectoryStream {
let started = std::time::Instant::now();
let reply = self
.services
.directory_visit(self.mount, self.serial, self.handle, self.offset, after)
.directory_visit(
self.mount,
self.serial,
self.handle,
self.offset,
after,
self.attributes,
)
.await;
crate::phase::charge(crate::phase::Phase::DirectoryVisit, started);
let reply = reply?;
Expand Down Expand Up @@ -223,11 +229,12 @@ impl DirectoryStream {
let Some(window) = self.window.take().filter(|_| !self.ended) else {
return Ok(None);
};
// Only a window whose inherited names or kinds memory did not
// hold leaves the receive loop and takes one Store reader; a
// reply that shows facts needs that reader even when it does.
// Only a window whose inherited names, kinds or facts memory did
// not hold leaves the receive loop and takes one Store reader: a
// local directory, and a window whose inherited entries are all
// resident, are answered without it.
let started = std::time::Instant::now();
let base = if self.attributes || window.listing.is_none() {
let base = if window.needs_base(self.attributes) {
// Provider reads never run on the loop that received the request.
Some(self.services.base().await?)
} else {
Expand Down Expand Up @@ -277,9 +284,8 @@ impl DirectoryBatch {
}
/// Records the entries whose handles this reply hands out, so the
/// publishing visit takes their kernel references with the offsets.
/// `accepted` is the prefix the reply buffer took; only published
/// offsets can make a handle's fence answer, so a reused reply adopts
/// nothing.
/// `accepted` is the prefix the reply buffer took; only published offsets
/// can make a handle's fence answer, so a reused reply adopts nothing.
pub fn adopt(&mut self, accepted: usize) {
let entries: Vec<(u64, bool)> = self.batch.entries[..accepted]
.iter()
Expand Down
23 changes: 19 additions & 4 deletions engine/crates/layerfs-mount-ports/src/operations/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::ports::{BaseDemandFailed, Fenced, RequestServices, ServiceError, Serv
use layerfs_overlay::KernelMount;
use layerfs_workspace::{
KernelReadDecision, KernelReadFailure, KernelReadOperation, KernelReadOutcome, KernelReadValue,
Refusal, VisitFacts,
Refusal, ViewStat, VisitFacts,
};
use std::{fmt, sync::Arc};

Expand All @@ -17,6 +17,9 @@ pub(super) struct Custody {
pub data_input: Option<super::ReadDataInput>,
// Retain the engine receipt through every cloned outcome consumer.
pub receipt: Option<ServiceReply<Arc<KernelReadOutcome>>>,
/// The directory row a refused LOOKUP read in the same job, fresh from
/// that job (see [`KernelRead::refused_directory`]).
pub refused_directory: Option<ViewStat>,
}
/// A deciding answer and the receipt of the visit that decided it.
/// The request holds nothing else in the engine; the kernel's lookup, open
Expand Down Expand Up @@ -126,6 +129,13 @@ impl KernelRead {
pub fn value(&self) -> Result<&KernelReadValue, Refusal> {
self.value.as_ref().map_err(|refusal| *refusal)
}
/// The directory row a refused LOOKUP read in its own job, when it read
/// one: the fresh facts its reply's directory attributes are made of.
/// `None` for every other refusal and for every other operation, none of
/// which read a directory row.
pub fn refused_directory(&self) -> Option<&ViewStat> {
self.custody.refused_directory.as_ref()
}
/// Preserve a successfully decided request when kernel reply conversion or
/// another downstream invariant fails before consumer disposal.
pub fn retain(self, reason: ServiceError) -> ReadFailure {
Expand Down Expand Up @@ -160,6 +170,7 @@ impl Custody {
operation,
data_input: None,
receipt: None,
refused_directory: None,
}
}
pub(super) const fn target(&self) -> (KernelMount, u64, Option<u64>) {
Expand Down Expand Up @@ -189,17 +200,21 @@ impl Custody {
let receipt = receipt?;
let original = receipt.get().clone();
let needs = match (&original.result, &original.decision) {
(Ok(None), Some(KernelReadDecision::Value(inode))) => {
let stat = inode.clone().into();
(Ok(None), Some(KernelReadDecision::Value(decided))) => {
let stat = decided.inode.clone().into();
self.receipt = Some(receipt);
return Ok(Ok(KernelReadValue {
stat,
parent: decided.parent.clone().map(Into::into),
file: original.open_candidate,
directory: original.directory_candidate,
original,
}));
}
(Ok(None), Some(KernelReadDecision::Refused(refusal))) => return Ok(Err(*refusal)),
(Ok(None), Some(KernelReadDecision::Refused { refusal, directory })) => {
self.refused_directory = directory.clone().map(Into::into);
return Ok(Err(*refusal));
}
(Ok(None), Some(KernelReadDecision::Needs(needs))) if !needs.is_empty() => needs,
_ => {
self.receipt = Some(receipt);
Expand Down
7 changes: 5 additions & 2 deletions engine/crates/layerfs-mount-ports/src/ports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,18 @@ pub trait RequestServices: Send + Sync {
/// READDIR's reading visit as one read-only owner job on the open
/// directory `handle`: the position of the kernel `offset`, one window
/// of current names (after `after` when it continues an earlier window
/// of the same request) and the offsets the reply may hand out. It
/// records nothing, so its request holds nothing afterwards.
/// of the same request) and the offsets the reply may hand out. When
/// `attributes` is set (READDIRPLUS), the visit also answers what memory
/// already holds of each entry's facts. It records nothing, so its
/// request holds nothing afterwards.
fn directory_visit(
&self,
mount: KernelMount,
serial: u64,
handle: u64,
offset: u64,
after: Option<Vec<u8>>,
attributes: bool,
) -> ServiceFuture<'_, ServiceReply<Arc<KernelDirectoryWindow>>>;
/// READDIR's publishing visit, before the reply is sent: exactly the
/// names the reply buffer accepted become valid offsets, in one
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