POSIX and NFS Support
What the gateway implements, how it is tested, and the limits to plan around.
The gateway serves NFSv4.1 and NFSv4.2 on TCP port 2049. Every change is tested
against a live NFSv4.1 conformance suite and the pjdfstest POSIX suite.
Files and directories
| Area | Support |
|---|---|
| Operations | mkdir, rmdir, create, open, unlink, rename, link, symbolic links |
| Special files | FIFOs, sockets, and device nodes |
| Large directories | Resumable listing of directories with millions of entries |
| Attributes | Size, mode, owner, group, and times. ctime and mtime change as POSIX requires. |
| Birth time | Served as the NFSv4 time_create attribute, and settable |
| Sparse files | Holes read as zeros. A truncate frees the space it releases. |
| Extended attributes | NFSv4.2 only. See Extended attributes. |
| Stale handles | ESTALE for a handle whose file is gone |
Extended attributes
A client mounted with vers=4.2 can read and write extended attributes:
- Only the
user.namespace. - On files and directories only.
- A name is at most 255 bytes, including
user.. A value is at most 64 KiB. - The names on one file total at most 64 KiB. Past that, a new attribute fails with
ENOSPC. - Reading needs read permission, and writing needs write permission.
- Each attribute's name and value count against the export's byte limit.
Permissions and identities
| Behavior | Support |
|---|---|
| Mode bits | Enforced, including write and execute on a directory to create entries in it |
| ACLs | Not supported. Only mode bits are enforced, and setting a POSIX or NFSv4 ACL fails. |
| Sticky bit | Enforced: only the entry's owner, the directory's owner, or root deletes or renames an entry |
| SUID and SGID | Cleared on write, as POSIX requires |
| Identities | Numeric user and group IDs. See User identities |
| Authentication | AUTH_SYS (sec=sys) |
Locking
| Behavior | Support |
|---|---|
| Byte-range locks | Full NFSv4 locking |
flock | Supported |
| Grace after restart | Clients reclaim their locks after the gateway restarts |
| Scope | The node that serves a file's cell decides every lock on that file |
| A client that dies | A client that stops without unmounting, such as one that loses power, keeps its opens and locks for at most about 70 seconds: its 60-second lease, then one pass of the gateway's cleanup, which runs every 10 seconds |
Open but unlinked files
Unlinking an open file removes its name at once. The space is freed when the last handle
closes. No .nfs* files are left behind. If a node stops with such files open, it frees
their space when it starts again.
Capacity
| Behavior | Support |
|---|---|
| Byte limit | Per export. It counts each file's full size, holes included. A write past it fails with EDQUOT. |
df with a limit | Reports the limit as the size |
df without one | Reports the space used plus 1 PiB free |
lost+found
When the gateway finds data that no file names, for example after an export was rebuilt
from AIStor, it links that data into lost+found/ at the export root. The first check
runs 15 minutes after the export starts. The directory is owned by root, with mode
0700. Its files count against the export's limits. If you change the owner or mode of
lost+found/ or of a file in it, the gateway stops rescuing data into it and leaves that
data in AIStor.
Differences from a local file system
Read this before you move an application from a local disk. Each row is a behavior an application can see. Where a row names no difference, the gateway behaves as a local file system does.
| Behavior | What the gateway does |
|---|---|
| Durability of data | A write returns before its data is durable. The data is durable once fsync, fdatasync, or close returns. A write through O_SYNC or O_DIRECT is durable when it returns. |
| Durability of names | A create, rename, or remove returns once it is on AIStor, so it survives losing the gateway node and its disk. If AIStor cannot be reached, the change stays on the node's disk and the call returns EIO. |
| Seeing another client's data | A client sees another client's writes when it opens the file after the writer closed or synced it. When the two clients mount through different gateway nodes, the reader can see the change up to 1 second later: a node keeps the attributes of a file another node serves for at most 1 second. While both hold the file open, the reader sees new data and the new size once the writer's client has sent the data, by close, fsync, or its own background writeback, and the reader's attribute cache expires. On Linux that takes 3 to 60 seconds, unless the mount sets actimeo. |
| Replace by rename | A rename over an existing name in the same directory replaces it at once. A reader opens the old file or the new one, never a missing name. |
| Rename across directories | After a crash, once the export serves again, the file is at its old path or its new path. It is never lost. |
| Exclusive create | O_CREAT | O_EXCL succeeds for one creator only, across all clients. |
| Overlapping writes | When two clients write the same bytes, the write the gateway receives last wins. Their order is not defined. A read never returns part of one write request: it sees all of a request's bytes or none of them. A client splits a large write() into requests of at most the mount's wsize, so a larger write can be seen in parts. |
O_APPEND | Appends from one client go to the end of the file. Appends from two clients at once can overwrite each other, because each NFS client picks the offset itself. |
mmap | A shared mapping works on one client. Another client sees what was written through it only after it opens the file again. |
| Access time | A read moves the access time as Linux's relatime does, the default of XFS: when it is not after the file's last change, or once it is a day old. So it shows when a file was last read, to within a day. A read the client answers from its cache does not reach the gateway. A read never changes the change time. |
| Timestamps | Times have nanosecond resolution and come from the clock of the gateway node that handles the change, not from the client. A time the gateway sets never moves backward: if a node's clock is behind, the file keeps its last change time instead. A time you set yourself, such as with touch -d, is kept as given. Keep every node's clock in sync with NTP. |
| Directory listing | A listing that runs while entries are created or removed can miss or repeat those entries. It never returns a damaged name. |
| Quota | A write fails with EDQUOT only when the export is full. The export never goes past its limit. |
| Name and path length | A name can be 255 bytes. A path can be 4096 bytes. |
| SUID and SGID programs | A client cannot set the SUID bit, or the SGID bit of a file: the gateway clears them, so no program on an export runs with its owner's privileges. A directory keeps its SGID bit, which only gives new entries the directory's group. Mounting with nosuid adds the same rule on the client. See Mount options. |
Errors that differ
Where a local file system returns a specific error, the gateway can return one of these instead:
| Error | When | What to do |
|---|---|---|
ESTALE | The file was removed, or the node serving it stopped serving it. | Open the file again by its path. |
EIO | Returned by fsync or close: a node stopped before writes it had acknowledged were durable, and those writes are lost. Durable data is not affected. On a soft mount, EIO can also mean only that the gateway did not answer in time. | Write the data again. |
EIO | Returned by read: AIStor holds too few undamaged pieces of the data to rebuild it. On a soft mount it can also mean only that the gateway did not answer in time, and the data is intact. | On a soft mount, check the network and the gateway first. Otherwise the file's data is lost: write it again, or restore it from a copy you keep. |
ETIMEDOUT | Only on a softerr mount: the gateway did not answer in time. A soft mount returns EIO for the same timeout, and a hard mount waits and retries instead. | Use a hard mount for data. |
When a node is down
- Mounting. A client mounts through one gateway node. If that node does not answer,
mountretries for 2 minutes, the Linux default of itsretry=option, then fails. Mount through another node. - A cell that moves. When a node stops, other nodes take its cells in about 33
seconds. Calls on files in those cells wait meanwhile, and opening a file can wait up
to 90 seconds more while clients reclaim their locks. Files in other cells are not
affected. A client that mounted through the node that stopped is not moved: on a
hardmount it waits until that node returns, and on asoftmount it getsEIO. To go on sooner, mount the export through another node. - Waiting calls. On a
hardmount a call waits until a node answers, and onlySIGKILLstops a process that is waiting. A drain or a job that ends must allow for these waits. Asoftmount returnsEIOinstead, at the cost described above.
Data integrity
AIStor protects file data at rest. The gateway protects it on the way there.
- On write: the gateway sends a CRC64NVME checksum with every object of file data it stores, and AIStor refuses an object whose bytes do not match it.
- At rest and on read: AIStor erasure-codes each object and checks every piece it
reads against a bitrot hash. It rebuilds a damaged piece from the others. When too many
pieces are damaged, the read fails with
EIOrather than return wrong bytes. - Metadata: the gateway checks the namespace records it keeps on AIStor against their own checksums, and a damaged local record fails the read rather than reading as missing.
Limits to plan around
- One node per cell. AIStor splits each export into cells, and one node serves each cell at a time. See Ownership and fencing.
- The number of exports. AIStor lists every export in one referral map of at most 256 KiB. Each export takes twice its name's length, plus its node's name, plus 4 bytes. AIStor refuses an export that does not fit.
- AUTH_SYS. Clients state their own identity. Serve exports on a trusted network, and limit clients with access rules.
- The bucket is opaque. Files are not objects, and objects are not files. Do not
point another tool or a lifecycle rule at the
aistor-filesbucket. - Directories above two million entries. The gateway's metadata cache holds two million entries. A larger directory lists much more slowly.