Skip to main content

atlas-native filesystems

An atlas-native cluster (docs/NATIVE_NODE.md) serves POSIX filesystems next to its block volumes. Files and directories live in the same replicated catalog as volumes, and file data uses the same copy-on-write extents (3 replicas) on a per-filesystem grid. Clients mount a filesystem through FUSE with atlas-native-mount; the Atlas gateway creates, snapshots and clones filesystems as filesystem volumes on backend bkd_native.

Model​

  • A filesystem (/v1/fs) is an inode table inside the catalog: id, name, root inode 1, and an optional source_snapshot for clones.
  • An inode is a directory (name → inode map), a regular file (offset → extent map plus size), a symlink (target, at most 4096 bytes) or a special file (FIFO, socket, character or block device, with rdev). Each has mode, uid, gid, nlink and atime/mtime/ctime in nanoseconds. Names are 1–255 bytes, without / or NUL, and never . or ...
  • Every change is one Raft command (MetaCommand::Fs) applied identically on each replica. Timestamps are chosen by the leader and travel in the command, so replicas stay deterministic. Creates carry a client-chosen op_id: a retried create returns the inode it already made instead of failing with "exists".
  • Hard links, rename (including over an existing entry, across directories, and refusing to move a directory into itself), setattr (mode, owner, size, times) and truncate follow POSIX. Shrinking a file drops the extents past the new end and trims the extent that straddles it.
  • File data is written through the extent path the volumes use, on the filesystem's own grid (extent_bytes, chosen at create time): a write covering part of an extent rewrites that extent with the old bytes merged in; never-written ranges are holes and read as zeros; reads stop at end of file.
  • Snapshots copy a filesystem's inode table under a snapshot id and take a reference on every extent it points to; no data is copied. A snapshot is read-only and addressed as <fs>@<snapshot>. Clones start a new filesystem from a snapshot. Writes on either side allocate new extents, so a filesystem, its snapshots and its clones never see each other's changes. Each survives deleting the others; extents are freed by GC once nothing references them.
  • A truncate into an extent is two metadata commits unless atomic truncate is in use: the extent without its tail, then the new size. The leader takes no filesystem snapshot between them, so a snapshot holds the file from before the truncate or from after it (a read of the live file made meanwhile can still see zeros past the new end under the old size). The pair is not atomic across a failure. If the second commit is never made (the leader stops or loses its term, the first commit times out but applies later, or a process on a local log crashes), the file keeps its old size with zeros from the new end to the end of that extent, and reads and later snapshots see exactly that until the truncate is repeated. The call has not succeeded then; atlas-native-mount retries it on the next leader for as long as it retries any request (30 s by default), but a snapshot taken before the retry stays as it was.

Atomic truncate (opt-in)​

With metadata.atomic_truncate on, a truncate into an extent is one metadata command (truncate_extent) holding the shortened extent and the attribute change, so after any failure the file is wholly as before or wholly as after, in reads and in snapshots. A call that failed may or may not have applied; repeating it is harmless. Off by default. Not measured.

  • When it is used. The group's leader has the switch on, and every metadata node it replicates to has advertised the command in the leader's current term. Otherwise the truncate takes the two commits above, with their failure window. A node that has not answered since the election counts as lacking it, so after a leader change with a metadata node down, truncates take two commits until that node answers: the protection covers the failure that happens while the whole group is healthy, not a further one while it is degraded. Nothing reports which way a truncate went; the catalog only records that at least one truncate_extent has been applied.
  • A truncate that cuts no extent (to an extent boundary, into a hole, or growing the file) is a single command either way.

Upgrading and downgrading​

  • Upgrade every metadata node to a build that has the command, then set metadata.atomic_truncate on every metadata node (the leader's setting applies) and restart them one at a time.
  • With the switch off everywhere, no new command reaches the log. The only difference an older node sees is one more capability bit (32) in Raft replies.
  • Once the switch has been on, do not downgrade a metadata node, or add one running an older build, while a metadata log may hold a truncate_extent: an older build cannot decode it and so cannot replay that log. To go back, turn the switch off on every node and restart them, then let every node's Raft log compact past the last such command before changing builds. The command adds nothing to the catalog but a bit in its feature set. Atlas does not enforce any of this, and no downgrade has been run.

Node API​

All routes need the API token (and client certificate where configured), like the rest of /v1/*.

Method and pathDescription
GET /v1/fs{"filesystems": [{id, name, inodes, bytes, source_snapshot, extent_bytes}]}.
POST /v1/fs{"name", "id"?, "extent_bytes"?} → 201 {"id"}. Idempotent with the same id and name. extent_bytes (default 1 MiB, at most the cluster's extent_bytes) is the file extent grid; snapshots and clones keep it.
DELETE /v1/fs/{fs}204. Snapshots and clones of it are unaffected.
GET /v1/fs/{fs}/statfs{inodes, used_bytes, free_list_bytes, available_bytes?, quota?}.
GET /v1/fs/{fs}/quota{max_bytes?, max_inodes?} ({} without a quota; see "Quotas").
PUT /v1/fs/{fs}/quota{"max_bytes"?, "max_inodes"?} replaces the quota; {} removes it. Unknown fields are refused.
GET /v1/fs/{fs}/locality?path=&max_inodes=Where a file or directory tree's data lives (see "Dataset locality"). path defaults to /, max_inodes to 100000.
POST /v1/fs/{fs}/locality/pin{"hosts": [...], "path"?, "after"?, "max_extents"?, "max_inodes"?} → {examined, local, moved, bytes_moved, tiered, erasure_coded, deferred, next, truncated}. Leader only.
POST /v1/fs/{fs}/rename{parent, name, new_parent, new_name} → 204.
POST /v1/fs/{fs}/rename-ifA compare-and-swap rename: {parent, name, ino, new_parent, new_name, expect?, retain_xattr?} → 204. name must still name ino. expect: {"kind":"absent"}, or {"kind":"unchanged", ino, size, mtime_ns, xattr, value} for the destination as it was read (value: the bytes of extended attribute xattr, null if unset); 412 precondition otherwise. retain_xattr names an attribute holding Unix seconds until which the destination can't be replaced (409 locked). A repeat that finds ino already at the destination succeeds. 409 unsupported until every metadata node can decode it; see NATIVE_S3.
POST /v1/fs/{fs}/snapshots{"name", "id"?} → 201 {"id"}.
GET /v1/fs-snapshots{"snapshots": [{id, fs_id, name, created_ns, inodes}]}.
DELETE /v1/fs-snapshots/{id}204.
POST /v1/fs-snapshots/{id}/clone{"name", "id"?} → 201 {"id"} of the new filesystem.
GET /v1/fs/{fs}/changes?cursor=&limit=Paths a clone created, modified, deleted or renamed since its snapshot (see "What changed"). Leader only.
GET /v1/fs/{fs}/inodes/{ino}Attributes: {ino, kind, mode, uid, gid, nlink, size, blocks, rdev, atime_ns, mtime_ns, ctime_ns}.
POST /v1/fs/{fs}/inodes/{ino}/attrAny of {mode, uid, gid, size, atime_ns, mtime_ns} → attributes.
GET /v1/fs/{fs}/inodes/{dir}/lookup?name=Attributes of the entry (name percent-encoded; . is the directory, .. its parent).
GET /v1/fs/{fs}/inodes/{dir}/entries{"entries": [{name, ino, kind}]} in name order. ?limit=N returns at most N; ?after=<name> (percent-encoded) starts after that name. Without limit, the whole directory.
POST /v1/fs/{fs}/inodes/{dir}/entries{name, op_id, kind, mode, uid, gid, target?, rdev?} (kind: file, dir, symlink, fifo, socket, char_device, block_device) → 201 attributes.
POST /v1/fs/{fs}/inodes/{dir}/unlink, /rmdir{name} → 204.
POST /v1/fs/{fs}/inodes/{ino}/links{parent, name}: a hard link → attributes.
GET /v1/fs/{fs}/inodes/{ino}/target{"target"} of a symlink.
GET /v1/fs/{fs}/inodes/{ino}/xattrs{"names": [...]} of the extended attributes.
GET /v1/fs/{fs}/inodes/{ino}/xattrs/{name}Raw value (name percent-encoded); 404 no_attr if unset.
PUT /v1/fs/{fs}/inodes/{ino}/xattrs/{name}?mode=Raw body as the value → 204. mode: set (default), create (409 exists if set), replace (404 no_attr if unset).
DELETE /v1/fs/{fs}/inodes/{ino}/xattrs/{name}204; 404 no_attr if unset.
GET /v1/fs/{fs}/inodes/{ino}/data?offset=N&len=MRaw bytes; short at end of file.
PUT /v1/fs/{fs}/inodes/{ino}/data?offset=NRaw body written at offset (extends the file) → attributes.
GET /v1/fs/{fs}/inodes/{ino}/content-tag{"tag"}: a hex string that changes with every change to the file and never comes back, or null if a client must not keep the file's data (not a regular file, a replica filesystem, more than 65536 extents and deltas). See "Keeping the page cache".
POST /v1/fs/{fs}/sessions{"session", "ttl_ms", "cache"?} (TTL 1000–300000): opens a client session, or renews it with a new TTL → {session, ttl_ms, expires_ms}. Session ids are client-chosen (the mount uses a UUID). cache: true if the session will hold cache leases.
GET /v1/fs/{fs}/sessions/{id}/recalls?wait_ms={"inos": [...]}: cache leases the session must give back, waiting up to wait_ms (at most 25 s) for one. Leader only.
POST /v1/fs/{fs}/sessions/{id}/recalls/done{"inos": [...]}: the session dropped what it cached under these leases → 204.
POST /v1/fs/{fs}/sessions/{id}/renew→ {session, ttl_ms, expires_ms}; 410 no_session once it expired or was closed.
DELETE /v1/fs/{fs}/sessions/{id}204; releases every lock the session holds.
POST /v1/fs/{fs}/inodes/{ino}/locks{session, owner, kind, start?, end?, pid?} (kind: read, write, unlock; end inclusive, default end of file) → 204, or 409 locked on another owner's conflicting lock. POSIX F_SETLK semantics per (session, owner); renews the session. Regular files only.
GET /v1/fs/{fs}/inodes/{ino}/locks?session=&owner=&kind=&start=&end={"conflict": {ino, session, owner, kind, start, end, pid} | null}: the first lock that would block the request (F_GETLK).
POST /v1/fs/{fs}/inodes/{ino}/locks/release{session, owner}: drops the owner's locks on the inode (a close) → 204.
GET /v1/fs/{fs}/locks{"sessions": N, "locks": [...]}: every lock held on the filesystem and the open sessions in its metadata group.

{fs} may be <fs>@<snapshot> for reads; any change to a snapshot gets 409 read_only.

?session=<id> names the client session a request comes from. On GET .../inodes/{ino} and GET .../lookup, &lease=1 also asks for a cache lease: the leader confirms its leadership (a read barrier), grants the session a lease on the inode (on a lookup, on the directory and the child) and adds "lease_ms" to the attributes; no lease_ms means none was granted (a change to the inode is in flight, a follower answered, or the tree is a snapshot).

Errors are {"error", "code", "leader"}. code is stable and maps to an errno in the client: not_found (404, ENOENT), exists (EEXIST), not_empty (ENOTEMPTY), not_dir (ENOTDIR), is_dir (EISDIR), invalid (EINVAL), read_only (EROFS), busy (EBUSY), no_attr (404, ENODATA), too_big (E2BIG), unsupported (EOPNOTSUPP), locked (EAGAIN), no_session (410, ENOLCK) — all 409 except where noted — plus not_leader (421), unavailable (503) and internal (500).

Reads are served by the leader once it has applied its log as of the request, so a client always sees its own writes. ?barrier=1 on a GET lets any replica answer after a read barrier (still linearizable, at the cost of one round trip to the leader), and ?stale=1 reads whatever the receiving replica has applied. Mutations go to the leader; followers answer 421 with the leader's id.

atlas-native-mount​

crates/atlas-native-fuse (bin atlas-native-mount, fuse cargo feature, Linux only):

atlas-native-mount --endpoint https://n1:7480,https://n2:7480,https://n3:7480 \
--token-file /etc/atlas-native/token --ca-file ca.pem --fs <id> /mnt/data
atlas-native-mount ... --fs <id> --snapshot <snapshot-id> /mnt/data-at-snap # read-only

Options: --identity-file (client certificate + key PEM), --ttl-ms (attribute and name cache, default 1000), --writeback-bytes (default 4 MiB), --writeback-parallel (full runs sent at once in the background, default 4; 0 sends them in the write call), --readahead-bytes (default 4 MiB, 0 disables), --max-io-bytes (largest request, default 8 MiB; keep at or below the nodes' max_request_bytes), --retry-secs (default 30), --full-grace-secs (default 3), --read-only, --allow-other, --fuse-threads (kernel request workers, each with its own /dev/fuse fd, default 4), --session-ttl-ms (lease of the mount's session, default 15000), --cache-leases (see Consistency), --keep-cache (see "Keeping the page cache"), --acl (see "POSIX ACLs"), --direct-reads and --prefer-host (below). It runs in the foreground until fusermount3 -u; the mount uses default_permissions, so the kernel checks modes and ownership.

  • Failover: every call goes to the last endpoint that answered and moves on through 421s, 503s and unreachable nodes until --retry-secs runs out. Creates reuse their op_id and writes are absolute, so retrying after an ambiguous failure cannot apply twice; a remove that finds the entry already gone after such a failure counts as done.
  • Write-back: sequential writes to an open file are buffered per inode and sent when the buffer fills, on fsync/close, and before a read, truncate or unlink of that file; getattr already reports the buffered and in-flight size. Full runs go out in the background, --writeback-parallel at a time, so a writer keeps filling the next run while earlier ones are on the wire; runs of one file that overlap are sent in order. A full run is cut at a multiple of --writeback-bytes, so a stream that started mid-extent is sent in aligned runs from then on. A send that fails drops its bytes and is reported to every handle of the file; see "Durability and write errors".
  • Read-ahead: a read that continues where the previous one ended fetches --readahead-bytes and serves following reads from it; random reads fetch only what was asked.
  • Unlink while open: removing a file another handle in the same mount still has open renames it to a hidden .atlas_hidden_<ino>_<n> entry (not listed by readdir) and removes it on the last close, or at unmount.
  • Directory listings: each open directory reads 1024 entries per request (?after=&limit=) and keeps its place between the kernel's readdir calls, so listing a directory of any size costs one request per page. Seeking back restarts the listing.
  • Direct reads (--direct-reads): the leader only answers GET /v1/fs/<fs>/inodes/<ino>/layout?offset=&len= (each extent's offset, length, SHA-256 and replicas with their data-node addresses, in the order a read should try them); the client then fetches the extents from the data nodes itself, in parallel, over the data-node protocol, and verifies every checksum. An unreachable node, a checksum mismatch or a layout made stale by a concurrent write falls back to reading through the leader. The client needs network access to the data nodes; when they require mTLS, --identity-file must hold a certificate signed by the cluster CA in --ca-file, and that identity is also accepted for writes by the data nodes, so give it only to trusted clients. Direct reads take read traffic off the leader; on a single host they cost an extra round trip (see the table below). An erasure-coded extent's layout lists its shards in shard order with each shard's checksum; the client reads and verifies the k data shards and joins them, and leaves decoding around a missing shard to the leader. Each replica in the layout carries its data node's host; --prefer-host <host> tries full copies on that host first (use the host the mount runs on, after pinning the dataset there).

Dataset locality​

A training job reads its dataset fastest from data nodes on its own host. Two calls let a scheduler find and make that placement:

  • GET /v1/fs/{fs}/locality?path=/datasets/imagenet walks the file or directory tree (hard links visited once, symlinks not followed) and returns files, dirs, extents (distinct: an extent shared by hard links, clones or snapshots counts once), bytes, tiered_bytes and erasure_coded_bytes, then nodes (every data node with its host, rack, zone, up, bytes of full copies and shard_bytes of erasure-coded shards) and hosts (every host with the bytes it holds a full copy of and local_fraction, that over all replicated bytes), most bytes first. A scheduler places the job on the host with the highest local_fraction. truncated: true means the walk stopped at max_inodes and the figures cover only part of the tree. The walk holds the group's catalog read lock while it runs, delaying commits to that group, so keep max_inodes proportionate.
  • POST /v1/fs/{fs}/locality/pin {"path": "/datasets/imagenet", "hosts": ["gpu-node-3"]} gives every replicated extent of the tree a full copy on one of hosts: an extent without one gets a copy written to an eligible node on those hosts (most free space first), and one of its replicas is released, preferring one on the new node's rack, so the replica count and host spread stay the same. It examines max_extents (default 256) extents per call, in id order after after; call it again with the returned next until next is null. Calls are idempotent: extents already local count as local. Tiered and erasure-coded extents are skipped and counted (a shard on a host is not a local copy). deferred counts extents left for another call: no readable copy, no eligible node on the hosts, or a concurrent change.

Pinning moves existing data only. New writes are placed as usual, and repair may move a pinned copy off a host that fails, so pin again after the dataset changes or a host is replaced. Mount on the pinned host with --direct-reads --prefer-host <host> to read the local copies; the CSI driver doesn't pass --prefer-host yet, since it needs the data nodes' host to match the Kubernetes node names, which the chart doesn't configure.

POSIX ACLs​

Mount with --acl (CSI: the acl mount option) and setfacl/getfacl work as on a local filesystem: the kernel enforces the ACLs (FUSE_POSIX_ACL), and the cluster keeps them consistent, the same for every client:

  • system.posix_acl_access and system.posix_acl_default are validated (the Linux xattr encoding: one owner, group and other entry, a mask with any named entry, sorted, no duplicates) and refused with EINVAL otherwise. A default ACL is for directories only.
  • Setting an access ACL sets the mode's permission bits from it (owner, mask or else group, and other); one that says no more than the mode is not stored. chmod rewrites the access ACL's owner, mask (or group) and other entries.
  • A node created in a directory with a default ACL gets it as its access ACL, ANDed with the requested mode, and the umask is not applied; a new directory also inherits the default ACL. Symlinks have no ACLs. Without a default ACL the umask applies as usual.
  • Without --acl the kernel neither enforces nor exposes ACLs (getfacl shows the mode only), but ACLs set by --acl mounts are still stored and inherited by the cluster.
  • Each mount's kernel caches an inode's ACL. A change made through another mount may be missed until that kernel drops the inode from its cache, so treat ACL changes like other metadata across mounts (--ttl-ms, close-to-open).
  • Not done: clearing setgid when a non-member of the group sets an ACL (the kernel's FUSE_SETXATTR_ACL_KILL_SGID). NFSv4 ACLs are not supported.
  • Upgrades: ACL xattrs and the create mode sent for inheritance are new to the metadata commands, so upgrade every metadata node before mounting with --acl.

Quotas​

PUT /v1/fs/{fs}/quota {"max_bytes": 107374182400, "max_inodes": 1000000} limits a filesystem; either limit may be left out, and {} removes the quota.

  • max_bytes caps used_bytes: the bytes of the file extents the filesystem references, so holes and sparse truncates cost nothing and an extent shared with a snapshot or clone counts in each filesystem that references it. A write is checked when its extents are committed, against the net change: rewriting a range replaces its extents, so overwrites pass even at the limit, and only growth is refused.
  • max_inodes caps the inode count, the root directory included. Hard links don't add inodes.
  • A refused change fails with code quota (HTTP 409); the FUSE client returns EDQUOT. With write-back on (the default), a buffered write can be refused after the write call returned, so the error comes from a later write, fsync or close, as with NFS (see "Durability and write errors"). The data a refused write already sent to the data nodes is released straight away.
  • Lowering a limit below current usage is allowed: nothing is removed, and growth stays refused until deletes bring usage back under it. Removing, truncating and rewriting always work.
  • Snapshots keep the quota they were taken with and clones inherit it. Extents that only a snapshot still holds don't count against the live filesystem.
  • FUSE statfs (df) reports the quota as the filesystem's size and the remaining quota as free space and free inodes, never more free space than the data nodes have room for. Without a quota the size is usage plus that room (Capacity and full disks).
  • Upgrades: the quota is a new metadata command, so upgrade every metadata node before setting one; an older node cannot apply it.

Capacity and full disks​

available_bytes in statfs is the new data the data nodes have room for, counting every replica or erasure-coded shard it needs: the free space of their devices' filesystems, plus space inside the device files that deletes have freed. It is up to 5 seconds old, shared by all filesystems of the cluster, and does not count on compression or deduplication. It is absent, and df shows a large headroom instead, if a data node that takes writes cannot tell: an older build, or a device other than the file backend. Data nodes sharing one filesystem each count its free space.

A write that fails because data nodes have no room is retried like one that finds too few nodes, since space may be freed meanwhile, but only for a short grace (--full-grace-secs, 3 by default) once the cluster has said it has no room ("cluster_full": true in the 503 body), not for the whole --retry-secs. The call then fails with ENOSPC (an older client reports EIO and keeps retrying for --retry-secs). If an earlier attempt of the same call had an unknown outcome (a lost reply, or a 503 other than no_space, such as a timed-out proposal), the call reports EIO instead, since it may have taken effect before the cluster filled; the client cannot tell a stopped replica's plain unavailable from a timed-out proposal, so it treats both as unknown. Too few replicas for another reason stays EIO and is retried for the full window.

A metadata replica whose disk fills up stops, and answers a change with the same no_space code (HTTP 503), so the client tries the other metadata nodes: while a quorum of them has room, calls keep succeeding after at most an election. Without such a quorum the client gives up with ENOSPC, as long as a node with a stopped replica is still up to say so; if those processes have exited and cannot start on the full disk, calls can fail with EIO instead. Reads get unavailable (EIO once the client gives up): a read needs no room. A stopped replica takes part again only after a restart (NATIVE_NODE.md, "Failed data syncs").

A replica stopped by any other storage error (a failed WAL write or sync, an I/O error, or a shutdown in progress) likewise answers unavailable (HTTP 503) rather than a final 500, so the client moves on to another metadata node instead of returning EIO. As for every 503 the outcome of a write is treated as unknown, so the client's existing retry rules decide whether it is repeated. An internal log inconsistency stays a 500.

Data path​

  • A read fetches all the extents it covers in parallel (up to 8 at once), each from a replica chosen from the extent id so the load spreads over every replica; any replica that fails or doesn't verify falls back to the next.
  • A write that spans several extents writes their replicas in parallel (up to 4 extents at once, each to 3 nodes) and installs them all with one metadata commit (install_extents / install_file_extents), so a 4 MiB write costs one Raft round trip, not four. All placements of one write draw from one copy of the free list, so concurrent placements never reuse the same free range.
  • Each data-node client keeps up to 8 idle connections, so concurrent requests to one node don't queue behind a single socket; payloads over 16 KiB are written straight from the caller's buffer.
  • The node HTTP server sets TCP_NODELAY and sends small responses in one write. Before it did, every small reply waited for the client's delayed ACK (40 ms on Linux), which capped random reads at about 24/s and sequential writes at 18 MiB/s regardless of hardware.
  • Upgrades: the two batched commands are new log entries, so upgrade every metadata node before clients write through an upgraded leader; an older node cannot apply them.

Direct I/O​

A file opened with O_DIRECT bypasses the kernel's page cache (the FUSE client answers the open with FOPEN_DIRECT_IO) and the mount's own caches:

  • A write goes to the cluster before it returns: anything the mount still buffers for the file is sent first, then the write itself, and the call returns once its extents are committed. It is visible to every other mount straight away, without a close or fsync.
  • A read fetches from the data nodes, skipping read-ahead, so it returns what other mounts have committed, even if this mount cached older bytes for the file.
  • No alignment is required: any offset and length work, as on other FUSE and network filesystems.
  • Several direct writes to one file run in parallel (FOPEN_PARALLEL_DIRECT_WRITES); concurrent writers to the same range still see last-writer-wins.
  • O_DIRECT has to be given to open: turning it on later with fcntl(F_SETFL) doesn't reach FUSE, and the handle keeps its open-time behaviour. Not tested: mmap of an O_DIRECT handle (the kernel restricts shared mappings of direct-I/O FUSE files); map the file through a handle opened without O_DIRECT.
  • O_SYNC and O_DSYNC without O_DIRECT keep write-back: the kernel follows each write with an fsync, which sends the buffered data before the call returns and fails the write if it cannot be stored.
  • Cost: every direct write is one round trip to the cluster and waits for its commit, so small direct writes are latency-bound. On the lab k3s host (shared, spinning disks, one replica) a direct write took about 70–160 ms whatever its size up to 1 MiB; batch writes, or leave O_DIRECT off, where durability per call isn't needed. Not yet measured on NVMe.

Durability and write errors​

With write-back, write returns before the cluster has the bytes. They are stored once an fsync or fdatasync of the file returns success; so does a close, which sends what is buffered, if no fsync on that handle has reported a failure before. A send can fail after write returned: a quota (EDQUOT), the file removed through another mount (ENOENT), no space, or a cluster that stays unreachable for --retry-secs (EIO). The mount reports this as Linux reports write-back errors (fsync(2); "Handling errors during writeback" in the kernel's filesystems/vfs.rst). "Handle" below is an open file description: one open, shared by the descriptors dup and fork make from it.

CallerAfter a send of the file failed
fsync/fdatasync on a handle open at the time, read-only ones includedfails once with the errno; the next one succeeds unless something else failed. No other handle, process or internal flush can use this report up
close of a descriptor of a writable handle open at the timefails until an fsync on that handle has reported the loss. A close uses nothing up: the fsync is still due
the next write on a writable handle open at the timefails once with the errno and writes nothing; later writes are accepted
fsync on a handle opened afterwardsfails once if no fsync anywhere had reported the loss when the handle was opened, so reopening a file to sync it still tells. Its close and write are unaffected
read (buffered, or a page fault)does not fail because of it; returns what the cluster holds
O_DIRECT read or writefails if a send failed while the call waited for buffered bytes to go first (as on Linux); this uses nothing up
truncate, unlink, renamesucceed as usual, even when they are what sent the bytes; the reports stay due
  • Several failures before one fsync make one report, with the latest errno.
  • Threads that share one handle share its report, as on Linux: the kernel runs the fsyncs of one file one after another, and the first gets it. Open the file once per thread that needs its own answer.
  • O_SYNC and O_DSYNC writes are followed by an fsync from the kernel, so write itself returns the error.
  • A call that fails only its own bytes (an O_DIRECT write, or any write with --writeback-bytes 0) returns the error and leaves nothing for later calls to report.
  • Shared mappings: msync(MS_SYNC) is an fsync and reports as above. Pages written back after the last close (stores made and unmapped later) have only the release call left, whose result the kernel discards. Such a failure reaches other handles open at the time and, if none has synced it first, the next fsync on a new handle; a writer that must know calls msync before unmapping. The mount never refuses pages written back from a mapping because of an earlier failure. With --writeback-bytes 0 the kernel records these failures itself and may report EIO in place of the errno.
  • Directories: every directory change is committed before its call returns, so fsync on a directory succeeds and has nothing to report.
  • sync and syncfs are not forwarded to a FUSE mount like this one: they succeed without sending or reporting anything. Use fsync.

The lost bytes are dropped and not sent again (the client has already retried for --retry-secs what could be retried), so freeing space or restoring the cluster does not bring them back: the application has to write them again. When a send fails, the mount forgets its cached attributes and read-ahead for the file and has the kernel drop its cached pages and attributes. That is done before it answers the fsync or close that reports the loss, so a caller that has the error cannot read the lost bytes back; until the failure, and for the moment the invalidation takes, reads may still get them from the kernel's page cache. Afterwards the range holds whatever the cluster has: the old contents, zeros, or some or all of the new bytes when the outcome was ambiguous (a timeout after the commit). A file that was being extended can become shorter again, so touching a mapping beyond the new end raises SIGBUS and O_APPEND writes continue at the new end.

Unmount and crashes. Unmounting sends what is still buffered and logs an error for every file with a loss that no fsync reported (lost writes were never reported to an fsync); umount itself cannot return it. Each failed send of buffered bytes is also logged when it happens, with inode, offset, length and errno. The record of failures lives in the mount process: after a restart or crash it is gone, together with any buffered bytes (open descriptors then fail with ENOTCONN). For files that no handle has open, at most 16384 unreported failures are kept; the oldest is forgotten beyond that, with a warning.

Gateways and libraries. The NFS and SMB gateways reach the cluster through this mount, and the rules apply to the handles their servers open: a server that serves several clients through one handle gets one report for all of them. What NFS-Ganesha and Samba then tell each client has not been tested. Code that uses Ops by inode number (the S3 gateway) has no handle: its write fails while the file has a loss that no fsync has reported, and its flush reports such a loss once, taking nothing from open handles.

Consistency​

  • Within one mount, operations are linearizable: every call goes through the leader and returns only after its command is committed and applied.
  • Across mounts it is close-to-open: data written on one client is visible to another after the writer closes or fsyncs the file and the reader opens it after that; attributes and names may be cached for up to --ttl-ms (set 0 for no caching). Unlocked concurrent writers to the same file range see last-writer-wins at the extent level.
  • Cache leases (--cache-leases): attributes and names are cached for as long as the cluster's lease on them lasts (5 s, re-taken on the next miss) instead of for --ttl-ms, and never go stale: before any change to an inode commits, the leader recalls every other mount's lease on it and waits until that mount has dropped its cache (its recall thread answers within a round trip) or the lease ran out. A mount's own changes do not wait on its own leases. The kernel gets a zero TTL, so every stat and lookup reaches the mount's cache. A new metadata leader knows none of its predecessor's leases: while a caching session opened under an earlier leader is open, it holds changes back for one lease period (5 s) after taking over. A mount that stops answering recalls delays other mounts' changes to what it cached by up to 5 s. File data is still close-to-open.
  • Unlink-while-open only protects handles in the same mount; a file removed by another client disappears for everyone.
  • Extended attributes in the user., trusted. and security. namespaces are stored on the inode (replicated, copied by snapshots and clones): at most 64 KiB per value and 256 KiB per inode. Of system.*, only the two POSIX ACLs are stored (see "POSIX ACLs"); the rest is refused with EOPNOTSUPP.
  • Locks: fcntl byte-range locks and flock locks are held in the cluster, so every mount of the filesystem sees them. A mount opens a session on its first lock and renews it every third of --session-ttl-ms; the session holds its locks. Closing a file drops its process's locks on it, unmounting closes the session, and a mount that dies (or loses the cluster for a whole TTL) has its session expired by the metadata leader and its locks released. A mount whose session expired under it logs the loss and starts a new session on its next lock. flock reaches the cluster as a whole-file lock, as on Linux NFS, so it conflicts with fcntl locks on the same file. F_SETLKW polls the leader (10–250 ms backoff) while it waits; at most --fuse-threads − 1 waits run at once, more fail with ENOLCK, so waiters never take the kernel worker an unlock needs. A snapshot mount grants every lock locally (nothing writes there). Locks need every metadata node upgraded first: an older node cannot apply them.
  • O_DIRECT reads and writes skip the caches; see "Direct I/O".
  • The kernel drops a file's cached data at every open, unless the mount runs with --keep-cache (below), which keeps it only for an unchanged file.

Keeping the page cache​

By default the kernel discards a file's cached pages whenever the file is opened, so a file read many times is fetched from the cluster every time. atlas-native-mount --keep-cache (off by default) answers an open with FOPEN_KEEP_CACHE when the file is unchanged since the cached pages were read. Close-to-open consistency is the same as without it.

Only opens that read through the page cache take part (O_RDONLY without O_DIRECT); every other open drops the cache as before. Each such open asks the cluster for the file's content tag and keeps the cache only if all of these hold:

ConditionWhy
This mount recorded the tag at an earlier open that dropped the cacheeverything cached since was read after that tag, so it is that content or newer
The tag now equals the recorded onea tag never comes back after a change, so there is nothing newer, hence nothing newer cached
A later read, close or fsync arrived on a handle whose open dropped the cacheproves the kernel has finished dropping it; until then other opens drop it too
This mount has not written, truncated or lost bytes of the file sincethe kernel's pages may hold bytes the cluster does not
No write-back loss of the file is still unreportedsee "Durability and write errors"
The cluster answeredotherwise the open succeeds and drops the cache
  • The tag is a SHA-256 the metadata node computes from its catalog: the extents and pending deltas the file points to, its size and times, a number that moves whenever the filesystem's tree is replaced (created or cloned under a used id, a replica reverted to a snapshot) and, for a snapshot, when it was taken. So a write by another mount, a truncate, a rewrite of the same bytes, a restore and an inode number used again all give a new tag. Anything that touches ctime (chmod, rename, link, extended attributes) does too, and so does the background fold of delta writes: those cost one needless re-read. A replica filesystem has no tag.
  • Freshness: the tag and, with --keep-cache, every data and layout request carry ?barrier=1: whichever replica answers first applies everything committed before the request, so a lagging follower or a leader that has been replaced without knowing cannot serve an older tag or older data. The mount's own read-ahead window is dropped at every open that drops the kernel's cache.
  • What it does not change: attributes and names are still cached for --ttl-ms (or under cache leases). A descriptor already open may read pages cached before another client's write or fetched after it, as without the flag; the next open settles it. Changes made behind the catalog's back (in-place application of deltas, which is designed but not implemented, would keep extents' identities) would have to be added to the tag.
  • Cost: one request per read-only open (a pass over the metadata nodes without retries; an unreachable cluster delays the open by at most the connect and request timeouts), a read barrier per data request (free on a leader holding its read lease, otherwise a quorum round), and on the metadata node a hash over the file's extent list under the catalog read lock. The mount remembers at most 65536 files; past that it forgets all of them, which only drops caches. The cached pages are ordinary page cache and are evicted under memory pressure.
  • Counters: getfattr -n user.atlas.keep_cache <mountpoint> returns JSON with kept and dropped_first (no record yet), dropped_changed, dropped_unconfirmed, dropped_local_change (changed through this mount while the tag was read), dropped_uncacheable, dropped_unavailable (no answer, or the file is gone) and dropped_lost_writes. The mount logs them at unmount. The attribute is answered by the mount, is not listed, and hides a real attribute of that name on the root.
  • Upgrades: upgrade every metadata node first. An older one has no tag route, so opens drop the cache; the tree number is part of the replicated catalog, and an older node ignores it.
  • Verification: deploy/native/keep-cache-lab.py runs several mounts on a real kernel and checks data and page-cache residency (mincore(2)) after each kind of change; --bench times repeated reads with the flag off and on. Speed has not been measured. Its 39 checks passed on the lab host (Linux 7.0, rootless container, 3+3 nodes on one host, debug build, 2026-11-28). One earlier run of its concurrent section failed with an EIO write-back error on the writing mount, which runs without the flag; eight later runs of that section did not reproduce it and its cause is unknown. Not tested: --keep-cache with --direct-writes, --cache-leases, mTLS or several metadata groups, the NFS and SMB gateways, a replica promoted or demoted under a live kernel mount (engine tests cover the tag), and a mixed-version upgrade.

Atlas gateway​

With the native backend enabled (docs/NATIVE_NODE.md, "Atlas gateway"):

atlasctl create-volume team-share --kind filesystem --backend bkd_native --tenant acme
atlasctl snapshot-volume vol_native_fs_<id> --name before-upgrade
atlasctl clone-snapshot snap_native_fs_<id> --name team-share-copy
atlasctl restore-snapshot snap_native_fs_<id>

Filesystems appear as volumes vol_native_fs_<id> (kind filesystem, backend id fs:<id>) and their snapshots as snap_native_fs_<id>. A filesystem has no size limit: its size_bytes is the sum of its file sizes (0 when empty), expanding it is refused, and the requested size at create time is only used for tenant quota admission. Block data routes (/volumes/{id}/data) refuse filesystems; mount them with atlas-native-mount instead.

atlasctl checkpoint seal snapshots and retention-locks a finished training checkpoint on a filesystem and prunes older ones (docs/CHECKPOINTS.md).

Agent workspaces​

An agent workspace is an instant, isolated, disposable copy of an atlas-native volume or filesystem (or of one of its snapshots) for one agent run. It is the snapshot and clone described above with a lifetime, an owner and a size limit around them: nothing is copied, the clone shares extents with its snapshot until it is written, and the source is never written.

POST /api/atlas/v1/workspaces {"source_volume_id": "vol_native_fs_<id>", "name": "run-42", "ttl_secs": 3600, "max_bytes": 0}
GET /api/atlas/v1/workspaces (tenant-scoped; admins see every tenant)
GET /api/atlas/v1/workspaces/{id}
POST /api/atlas/v1/workspaces/{id}/reset roll back to the base snapshot
DELETE /api/atlas/v1/workspaces/{id} discard

Give source_volume_id (Atlas snapshots it now) or source_snapshot_id (an existing snapshot, which Atlas leaves alone when the workspace goes away). The result carries the workspace id, its own volume_id (a normal volume; mount it with atlas-native-mount, or use /volumes/{id}/data for a block source), state, used_bytes, over_cap and remaining_secs.

  • Create, reset and discard need the operator role and a source in the caller's tenant (another tenant gets 404). Only atlas-native sources are accepted.
  • Reset deletes the clone and everything written to it and clones again from the same base snapshot. The workspace keeps its id and its expiry (a reset does not extend it); its volume_id changes. If the re-clone fails the workspace is reset_failed with no volume and last_error set; reset again, or discard it.
  • Discard deletes the clone, then the snapshot Atlas took for it (kept, and reported as base_snapshot_retained, if some other volume was cloned from it), then the record.
  • TTL: ttl_secs is 60 to ATLAS_WORKSPACE_MAX_TTL_SECS (default 7 days), default 3600. A background worker discards expired workspaces and finishes half-done teardowns every ATLAS_WORKSPACE_GC_SECS seconds (default 60, minimum 5, 0 turns it off). State changes are compare-and-set, so several gateway replicas on Postgres can run it at once.
  • Limits: the clone goes through the normal clone path, so the tenant's byte and volume-count quota applies and a refused create leaves nothing behind. ATLAS_WORKSPACE_MAX_PER_TENANT (default 10, 0 = no limit) caps live workspaces per tenant. max_bytes (or ATLAS_WORKSPACE_DEFAULT_MAX_BYTES) refuses a source larger than that at create time. It is an admission check, not a hard limit: a native filesystem has no size limit, so growth after creation is only reported (over_cap), and the tenant byte quota is what bounds it. The per-tenant count and a per-owner budget on the sum of max_bytes (token workspace_bytes, ATLAS_AGENT_WORKSPACE_BYTES; see MCP.md) are checked twice: once up front (cheap, no side effects), and again after the create has inserted its own workspace row in the creating state, which counts toward both figures. The second committer of two racing creates always sees both rows, so the limits cannot be exceeded by a race; the cost is that under contention both may see both and both be refused (retry). A refused create removes its own row. The row becomes active when the clone exists; a creating row whose gateway died is discarded by the GC after 15 minutes (and cannot be reset or discarded by hand until then). Across gateway replicas this relies on Postgres read-committed visibility and is tested in one process on SQLite only.
  • Create, reset, discard and expiry are audited (workspace.create, workspace.reset, workspace.discard, workspace.expire).

The same operations are MCP tools for agents (list_workspaces, get_workspace, and the guarded two-phase create_workspace, reset_workspace, discard_workspace); see MCP.md. The only atlasctl command for workspaces is workspace-changes (below).

Tested over the fixture driver through the gateway (crates/atlas-gateway/tests/workspaces.rs, mcp_workspaces.rs): create, write, reset and discard with the source untouched, TTL expiry GC, quota, size-cap and count refusals, concurrent creates against the byte budget and the count (in process, SQLite), stale creating rows, tenant isolation and roles. The fixture driver does not model files, so a filesystem workspace is not written through the gateway in these tests (a block source is, through /volumes/{id}/data); filesystem snapshot and clone themselves are tested against live in-process nodes in crates/atlas-driver-native/tests/nodes.rs. Not run against a lab cluster.

What changed​

"What did this agent change?" lists the paths of a filesystem workspace that differ from the snapshot it was cloned from. It is read-only and carries metadata only: no file contents, no symlink targets, no extended attribute names or values.

GET /api/atlas/v1/workspaces/{id}/changes?limit=1000&cursor=<next_cursor>
atlasctl workspace-changes <id> [--limit N] [--cursor C]
MCP: workspace_changes {workspace_id, cursor?, limit?} (read-only; 200 per page, at most 1000)

It has the checks of GET /workspaces/{id}: any role of the workspace's tenant; another tenant gets 404. The workspace must be active and a filesystem (a block volume has no paths: 400). The answer:

{"workspace_id": "ws_…", "volume_id": "vol_native_fs_…", "base_snapshot_id": "snap_native_fs_…",
"as_of_index": 812, "computed_unix_ms": 1790000000000, "total": 3,
"summary": {"created": 1, "modified": 1, "deleted": 0, "renamed": 1},
"changes": [
{"path": "/out/report.md", "change": "created", "type": "file", "ino": 41, "size": 5120,
"replaced": false, "object_in_both": false},
{"path": "/src/lib.rs", "change": "modified", "type": "file", "changed": ["content", "size", "mtime", "ctime"],
"ino": 12, "size": 900, "replaced": false, "object_in_both": true},
{"path": "/src/new", "change": "renamed", "from": "/src/old", "type": "dir", "ino": 7,
"replaced": false, "object_in_both": true}],
"next_cursor": null}

How to read it:

  • path is a path in the workspace, except for deleted, where it is a path in the base snapshot. from is always a path in the base snapshot.
  • A renamed directory stands for everything under it: unchanged descendants are not listed. What did change under it is listed, with new paths for what the workspace has and old paths for deletions.
  • Renames are told by identity, not by guessing from contents: a clone keeps its snapshot's inode numbers and numbers are never reused. A rename is reported when one object lost exactly one name and gained exactly one. With several names lost or gained (hard links) the pairing cannot be known, so they are deleted and created entries with object_in_both: true. A link plus an unlink of the same object ends in the same state as a rename and is reported as one. Copy-then-delete is a creation and a deletion.
  • modified with replaced: true: the path existed, and now holds a different object (an editor saving through a temporary file, a rebuilt directory). previous_type is set if the type changed. A rename over an existing path is renamed with replaced: true.
  • changed lists content, size, mode, owner, xattrs, links, mtime, atime, ctime. content means data was written or cut: the bytes may be equal to the old ones (they are not read). ctime alone means the inode was touched and ended up as it was, for example a rename and back.
  • Directories are listed as modified only for mode, owner and xattrs. A directory's times and size follow its entries, which are listed themselves; a touch of a directory, or a file created and removed again, leaves no entry.
  • It is the net difference between two states, not a history: intermediate versions do not appear.

Consistency and cost. The metadata leader computes the listing from what is committed at one instant (as_of_index). A mount that has not yet flushed (write-back before close or fsync) can be ahead of it. The catalog lock is held to take a view of the live tree (cheap once checkpointed; right after a clone, before the first checkpoint, it copies one reference per inode) and to copy the snapshot's inode references 1024 at a time; the comparison runs outside it. Time and memory are linear in the size of both trees, not in the number of changes, even when nothing changed. Later pages are served from the kept result and describe the same instant. A cursor expires after 5 minutes, when newer listings push it out (2 kept per filesystem, 8 and 200000 changes per node process), on a restart or leader change, and after a reset; start again without a cursor. A listing is refused with 409, never cut short, over 1,000,000 inodes or 2,000,000 directory entries in either tree, 100,000 changes, 16 MiB of paths, or 8 s; a node computes at most two at once (others get 503). It is also refused if the base snapshot has been deleted. None of these limits has been measured on large trees.

Not there: commit back or merge into the source. The listing is a report; nothing applies it. Doing so safely would need at least:

  1. A three-way comparison. The source keeps changing after the snapshot, so base, source and workspace have to be compared. A source snapshot and a clone share inode numbers only up to the fork: objects created on either side afterwards can get the same number and mean different things, so identity-based comparison needs an object id that is unique across filesystems.
  2. Conflict rules for edit/edit, edit/delete, rename/rename, a directory moved into a subtree the other side moved, type changes and name collisions, with a way to report conflicts and choose.
  3. One atomic apply in the replicated catalog (a new command that re-checks every precondition at apply time and changes all or nothing), in bounded size, with extents shared from the workspace rather than copied, quota accounting, activity records and recall of client cache leases. Source and workspace must be in the same metadata group.
  4. Handling of what a path list does not carry: hard link sets, ACLs and other attributes, open files and locks on the source, and retention-locked data.
  5. Authorisation of its own: it writes to the source, which no workspace operation does today, and would need a pre-merge snapshot, audit, and the two-phase confirmation of the other MCP writes.

Tested: the classification against a model that replays each listing over the base tree (300 random workloads, in memory and paged from the store, plus rename, hard link, attribute-only, symlink and replacement cases), the engine (paging, cursors, reopen, concurrent renames, deleted snapshot, refusals), the driver against in-process nodes, and the REST route and MCP tool for tenant isolation and against one in-process node. Not run on a lab cluster or through a FUSE mount; not measured.

NFS​

The FUSE client supports kernel export (FUSE_EXPORT_SUPPORT; the node API resolves . and .. in GET /v1/fs/{fs}/inodes/{dir}/lookup), so a mount can be re-exported over NFS. The chart's NFS gateway does this with NFS-Ganesha; see NATIVE_NFS.md.

S3​

The chart's S3 gateway serves filesystems (and snapshots) as buckets whose objects are these same files: a/b/c is the file c in directory a/b. See NATIVE_S3.md.

SMB​

The chart's SMB gateway runs Samba over --allow-other FUSE mounts, one per share. SMB users are Unix accounts with configured uids and gids, so the mount's permission checks apply to them. See NATIVE_SMB.md.

Replication​

atlas-native-replicate keeps a read-only replica of a filesystem on another cluster from snapshot increments that carry only changed grid cells, with promote and demote for failover and failback. See NATIVE_REPLICATION.md.

Limits and performance​

Each filesystem lives in one Raft group's catalog (metadata.groups spreads filesystems across groups; docs/NATIVE_NODE.md, "Metadata groups"). Commands apply in place: every command checks its inputs before it changes anything, so a rejected one leaves the catalog as it was (debug builds assert this on every apply), and the leader validates proposals against one running copy of the catalog plus its uncommitted entries. A create therefore costs the same at 100k inodes as at 10k. Log compaction (every 1024 entries) checkpoints only the records changed since the last one to catalog.redb (docs/NATIVE_METADATA.md, "Catalog store"). Inodes and directory entries are paged from it, so memory holds what changed since the last checkpoint plus a bounded inode cache, not the namespace. The leader's applied and speculative catalogs share everything paged.

Engine-level create rates without FUSE or HTTP (crates/atlas-native/tests/metadata_bench.rs, one host, tmpfs) are ~9k/s from one proposer and ~12k/s from eight on a 3-voter group at 20k files. The table below predates pipelined replication and the catalog store.

Measured 2026-10-04, file creates through the node API with 16 concurrent clients on a 3-node cluster on one laptop (Apple SSD, release build, other load on the machine), all filesystems in one cluster counted:

InodesCreates/sp50 msp99 msCatalog MiBLeader RSS MiB
10k1261232962.2168
50k1566933811.9356
80k2635516619.0367
100k2715417423.6628

No requests were retried or failed; the spread between rows is load from other processes on the laptop, not the inode count. Before commands applied in place, each create copied the catalog and throughput fell from 200/s at 10k inodes to 36/s at 60k. On the shared lab host, where fsync takes tens of milliseconds and other tenants keep I/O pressure around 15%, creates are bound by disk latency but stay flat with the inode count (same run shape, no retries):

InodesCreates/sp50 msp99 msCatalog MiBLeader RSS MiB
5k4036211031.241
15k473218113.499
25k4234612145.8112

These runs predate the paged catalog, when leader memory grew about 6 KiB per inode. Memory now follows the inode cache rather than the inode count: store::bench::memory_of_a_paged_catalog (4096-inode cache, second lab host, 2026-10-05) peaks at ~76 MB for 400k files in one directory and ~78 MB spread over 1000, flat from 300k files on as redb's page cache fills (112–114 MB before directory entries were paged).

Data path, FUSE mount, measured 2026-10-04: 3 nodes on one 12-core host (other tenants' load average around 25), node data on tmpfs so the shared HDDs don't mask software overhead, fio with one job and psync on a 256 MiB file, page cache dropped before each read test, release builds, two rounds each (ranges shown):

BeforeAfterAfter, --direct-reads
1 MiB sequential write18 MiB/s379 MiB/s348–350 MiB/s
1 MiB sequential read328–374 MiB/s369–405 MiB/s483–541 MiB/s
4 KiB random read23 IOPS588–606 IOPS510–519 IOPS

Most of the write and random-read gain is the TCP_NODELAY fix (see Data path); the rest is group commit and parallel extent I/O. A 4 KiB random read still fetches and checksums its whole extent (1 MiB by default). On the lab hosts' shared disks the same runs are bound by fsync latency and other tenants' I/O (pressure 50–80%), so they are not a fair measure of either build. crates/atlas-native/tests/datapath_bench.rs (--ignored) measures the engine alone over localhost data nodes.

Checkpoint fast path (large sequential writes, e.g. a training checkpoint):

  • A write covering whole extents of the file's grid (--writeback-bytes a multiple of the filesystem's extent_bytes, which the defaults are) reads nothing back to merge, so the leader places its data on the data nodes without the engine's write lock; only the commit is serialized. Partial-extent writes still read, merge and rewrite under the lock.
  • Every placement draws free space from one shared view (the applied free list minus the ranges of placements not yet committed), so concurrent writers never share space; a commit whose outcome is unknown (a timeout, a lost leadership) keeps its ranges out of use for 5 minutes.
  • File-backed data-node devices reserve append space under a lock, then write and sync outside it, so concurrent appends share the device instead of queueing behind each other's fsync.

Direct writes (atlas-native-mount --direct-writes, off by default)​

Implemented and tested in-process only; not yet run on the lab or measured, so there is no throughput claim. With the flag, a mount sends whole extents to the data nodes itself and the metadata leader only allocates and commits:

  1. POST /v1/fs/{fs}/inodes/{ino}/direct-write {offset, len} (leader): offset and len are multiples of the filesystem's extent_bytes (at most 64 extents). The leader picks the replica targets as it would for its own write, holds their free space in an allocator lease (inflight), and returns per extent replicas + 1 targets (the extra one is a spare for a replica that is down): the data node's address, the device and offset (or "append"), and a write grant, together with the leader's term.
  2. The client writes each target with that grant and the term as the fence (RemoteDevice::write_at_granted / append_granted).
  3. POST .../direct-commit {lease, cells[{logical_offset, checksum, replicas[{node, device, offset, receipt}]}], failed[]} (leader): the leader checks every reported replica against the lease (an append must carry the data node's receipt for its offset), requires the usual number of replicas per extent, then commits through the same path as a leader-side write: the Raft proposal is made in the lease's term, so a leader that was replaced cannot commit it. Quota, file size, snapshots and cache-lease recall are unchanged. POST .../direct-abort {lease} gives a lease up.

The write credential is separate from read access. Set grant_key_file (a secret of at least 16 bytes, the same file on every metadata and data node). A data node that has it refuses every write that lacks a valid HMAC-SHA256 grant from the leader for exactly that node, group, device, fence, offset (or append), length and an expiry (30 s by default); the leaders sign their own writes with the key. A client that can only read the data nodes (an address, or the cluster client certificate) cannot make a grant. Without grant_key_file the data nodes accept unauthenticated writes as before and the leader refuses to lease direct writes, so the mount keeps writing through the leader. Grants travel in the request header, so they are carried the same way over RDMA (see "RDMA to the data nodes" below).

Failure handling:

  • Any failure of the direct path (no grant key, compression, deduplication or erasure coding enabled, a refused or expired lease, a data node fault with no spare left, a fenced term, a failed commit) is followed by writing that chunk through the leader. A refused lease pauses direct writes for 60 s instead of asking for every run.
  • A client that dies after writing the data nodes but before committing leaves unreferenced bytes and nothing visible. The lease expires; its ranges then stay out of the free list for a grace period (30 s by default, set_direct_write_timing) because a write may still be in flight, then the allocator hands them out again. A commit that arrives after expiry is refused.
  • A client holding a lease from an earlier term is refused by the data nodes (Fenced) once any newer leader has written to them, and the new leader does not know its lease, so its commit is refused. Leases live in the leader's memory; a failover loses them.
  • Appended (not reused) space that is never committed is not reclaimed, as with a failed leader-side write.

Known gaps: the extent checksum in the commit is the client's word (scrub checks replicas against it); direct commits record write volume in the per-minute activity windows but no entropy sample, so the ransomware assessment is blinder for them; grants and leases are wall-clock based, so leaders and data nodes need roughly synchronized clocks.

Measured 2026-10-05 (release builds; the engine benchmark is checkpoint_throughput in tests/datapath_bench.rs, 1 MiB extents, 3 replicas, 8 MiB writes; the client one is checkpoint_bench in atlas-native-fuse/tests/ops.rs, one file in 128 KiB writes):

BeforeAfter
Engine, 8 writers, laptop SSD (macOS)76 MiB/s150 MiB/s
One file through the client, laptop SSD11 MiB/s17 MiB/s
Engine, 8 writers, lab host, data on tmpfs820 MiB/s746 MiB/s
One file through the client, lab host, tmpfs226 MiB/s233 MiB/s
Engine, 8 writers, lab host's shared HDD6 MiB/s4 MiB/s

The gain shows where per-write latency (fsync, network) dominates and the device takes concurrent writes. On the lab host's tmpfs the runs are CPU-bound on a shared 12-core host and on its HDD (other tenants at 20–40% I/O pressure) the differences are within run-to-run noise; neither is a measure of the NVMe target, which still needs the benchmark lab.

Known limits:

  • One filesystem never spans groups: its inodes all live in one group, behind one leader.
  • The catalog is held in memory (about 6 KiB per inode on the group leader): GET /api/atlas/v1/native/health (limits.inodes, limits.catalog_estimate_bytes) shows the inode count and that estimate.
  • Filesystem snapshot trees are held in memory in full, and each is one record in the store.
  • A write that covers part of an extent reads, merges and rewrites the whole extent: up to the filesystem's extent_bytes (1 MiB by default). With the cluster on its default 4 MiB grid, random 4 KiB writes measured 24/s at a 4 MiB file grid, 28/s at 1 MiB, 35/s at 256 KiB and 42/s at 64 KiB (p50 40 → 22 ms); the remaining ~20 ms is the replicated commit. A smaller grid means more extents in the in-memory catalog, so use 64–256 KiB only for random-write-heavy filesystems.
  • The client reuses connections (one per concurrent request) but does not pipeline or batch requests, so each metadata operation is one round trip to the leader.
  • A read verifies whole extents, so a small random read transfers and checksums a full extent.
  • Writes go through the leader unless the mount runs with --direct-writes (see Direct writes); partial extents, compressed, deduplicated or erasure-coded extents and clusters without a grant_key_file always do.
  • Unlink-while-open works only within one mount (see Consistency).

RDMA to the data nodes (atlas-native-mount --rdma, off by default)​

--rdma (with --direct-reads and/or --direct-writes) makes the mount's data-node clients ask each new connection to switch to RDMA, and keep the resulting connection in the same pool TCP connections use. It needs a build with --features rdma (Linux, libibverbs), data nodes built the same way and started with ATLAS_NATIVE_RDMA=1, and --rdma-gid-index if the port's GID is not index 1. The wire protocol is unchanged, so write grants, receipts and fences work over RDMA exactly as over TCP.

  • Plaintext, so never with TLS. RDMA here carries no encryption. Passing --rdma together with a client certificate (--ca-file and --identity-file, which make the data-node connections mTLS) is a configuration error at startup, as is RemoteDevice::use_rdma on a TLS client, and a node never upgrades a TLS connection. Use TLS over TCP, or RDMA on a trusted storage network.

  • Fallback to TCP. If a node does not offer RDMA, the transport cannot connect, or a request fails on an RDMA connection, that request or connection is retried over TCP, counted (RdmaSnapshot: connects, connect failures, TCP fallback connects, mid-flight errors, requests over RDMA, capped fallbacks, ENOMEM failures, live connections), and RDMA is not tried again on that node for 30 s (5 minutes if the node itself declined). A mid-flight retry follows the same rule as a retry on a stale pooled TCP connection: an append can leave an unreferenced copy behind.

  • Locked memory. Every RDMA connection pins about 1.06 MiB (17 x 64 KiB) on the client and on the node, counted against RLIMIT_MEMLOCK; with a typical 8 MiB limit only a few fit and registering more fails with ENOMEM. Raise the limit for the mount and the nodes (systemd LimitMEMLOCK=infinity, ulimit -l unlimited, a container's --ulimit memlock=-1:-1 and IPC_LOCK; a rootless container cannot exceed its host hard limit; in Kubernetes set the runtime default and add IPC_LOCK). As a safeguard the client keeps at most RdmaConfig::max_connections RDMA connections alive across all its data-node clients, by default half of the soft limit divided by 1.06 MiB (at least 1; 64 when unlimited). Beyond that, new connections use TCP and are counted as capped_fallbacks in RdmaSnapshot (not a failure, no back-off); enomem_failures counts setups that hit ENOMEM anyway, live_connections is the current count, and RdmaStats::diagnostics() holds the explanations (logged once by the mount). The mount and atlas-native-node warn at startup when the soft limit is under 64 MiB. Details and what was verified: docs/NATIVE_STORAGE.md, "RDMA and RLIMIT_MEMLOCK".

  • Idle connections. A pooled RDMA connection may sit idle indefinitely: the node waits for the next request (waking every 500 ms to notice shutdown) rather than closing after the stream's 30 s read timeout. A request that starts and then stalls for 30 s still fails.

  • One owner thread per RDMA connection. The verbs objects borrow from one another, so each client connection runs on a worker thread that owns them for the connection's lifetime (rdma_link::WorkerStream); the pooled handle talks to it over channels.

  • Verified only on SoftRoCE over loopback on one dev host (crates/atlas-native-fuse/tests/ops.rs, real_rdma_*, --ignored, --features rdma): direct reads and direct writes with the memlock limit raised for the test process, and graceful degradation to TCP under the default 8 MiB limit. No RDMA hardware, and no throughput or latency numbers. Those tests are not CI. SoftRoCE is enough and an RDMA NIC is not required:

    rdma link add rxe0 type rxe netdev lo
    # GID index is usually 1 on loopback; override with ATLAS_RDMA_GID_INDEX
    cargo test -p atlas-native --features rdma -- --ignored
    cargo test -p atlas-native-fuse --features rdma --test ops -- --ignored real_rdma

    A pass on rxe0 shows the queue pairs connect and bytes match. It is not an RDMA NIC result and not a throughput or latency number. The same note is on each #[ignore].

  • Pipelined sends and registered-memory zero-copy are scaffolded in crates/atlas-native/src/rdma_pipeline.rs and unit-tested with no device: a credit window (SendPipeline, default depth 8) and a RecordingZeroCopy hook that checks a region and returns pending-runtime. ATLAS_NATIVE_RDMA_PIPELINE=1 is recorded and ignored. runtime_enabled() is false, so RdmaStream::write still posts one send and copies into its staging slot. Not built on that path: messages larger than the existing 64 KiB, and one-sided RDMA READ/WRITE. Nothing here is a performance claim.

Verification​

  • crates/atlas-native/src/namespace.rs unit tests (every command, idempotent replay, rename edge cases, truncate refcounts, snapshot and clone isolation) and crates/atlas-native/tests/fs.rs (engine: holes, EOF, truncate, GC, reopen, clones).
  • crates/atlas-native/tests/node.rs: the file API on a 3-node in-process cluster.
  • crates/atlas-native-fuse/tests/ops.rs: the FUSE operations layer against a live in-process cluster, including a leader failure mid-workload, unlink-while-open, read-only snapshot mounts, clone isolation, concurrent creates, direct reads (across extents, after a rewrite) and their fallback to the leader; crates/atlas-native-fuse/src/dirs.rs unit tests page a 2500-entry listing through small kernel buffers with one request per page, and rewind on a seek back.
  • Lost write-back: unit tests in crates/atlas-native-fuse/src/handles.rs (who is told) and invalidate.rs, and the "Lost write-back" cases of tests/ops.rs, which make a quota refuse buffered bytes with runs sent in the background and in the calling thread. Through a kernel mount (lab, Linux 7.0, rootless container, 3+3 node cluster in it, 2026-11-28): separate processes with a quota or stopped data nodes covered fsync, close, dup, O_SYNC/O_DSYNC, O_DIRECT, shared mappings, page-cache invalidation, directory fsync, the unmount log and a 30 s run of 8 processes against failing sends. Not tested: the NFS and SMB gateways, power loss, and --cache-leases, --direct-writes or --direct-reads combined with failures.
  • crates/atlas-native/tests/direct_writes.rs and the direct_writes_* / a_* tests at the end of crates/atlas-native-fuse/tests/ops.rs: direct writes against in-process data nodes that require grants: grant scoping and expiry, a client dying between data and commit (space reclaimed after expiry and quarantine), a stale-term client fenced (also across a real leader failover), a down replica covered by the spare, forged commits, and fallback to the leader.
  • crates/atlas-native/tests/allocator.rs: one write's concurrent extent placements reuse distinct free ranges (verified by reading back and scrubbing every replica).
  • crates/atlas-driver-native/tests/nodes.rs and crates/atlas-gateway/tests/native_backend.rs: filesystem create, snapshot, clone, restore and delete through the driver and the gateway.
  • Lab (2026-10-04), a 3-node cluster on one host with a FUSE mount: pjdfstest unlink, mkdir, rmdir, rename, link, symlink, mknod, mkfifo, truncate, chmod, chown and open all pass (8565 tests); cp/mv/rm round trips; git clone + git fsck --full --strict; a snapshot mount stayed identical (sha256) while the source was overwritten, truncated and extended, refused writes with EROFS, and a clone of it took writes that neither the source nor the snapshot saw. atlasctl created, snapshotted, cloned, restored and deleted a filesystem through a gateway in real mode against a live cluster.