AIStor Files
Reference

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

AreaSupport
Operationsmkdir, rmdir, create, open, unlink, rename, link, symbolic links
Special filesFIFOs, sockets, and device nodes
Large directoriesResumable listing of directories with millions of entries
AttributesSize, mode, owner, group, and times. ctime and mtime change as POSIX requires.
Birth timeServed as the NFSv4 time_create attribute, and settable
Sparse filesHoles read as zeros. A truncate frees the space it releases.
Extended attributesNFSv4.2 only. See Extended attributes.
Stale handlesESTALE 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

BehaviorSupport
Mode bitsEnforced, including write and execute on a directory to create entries in it
ACLsNot supported. Only mode bits are enforced, and setting a POSIX or NFSv4 ACL fails.
Sticky bitEnforced: only the entry's owner, the directory's owner, or root deletes or renames an entry
SUID and SGIDCleared on write, as POSIX requires
IdentitiesNumeric user and group IDs. See User identities
AuthenticationAUTH_SYS (sec=sys)

Locking

BehaviorSupport
Byte-range locksFull NFSv4 locking
flockSupported
Grace after restartClients reclaim their locks after the gateway restarts
ScopeThe node that serves a file's cell decides every lock on that file
A client that diesA 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

BehaviorSupport
Byte limitPer export. It counts each file's full size, holes included. A write past it fails with EDQUOT.
df with a limitReports the limit as the size
df without oneReports 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.

BehaviorWhat the gateway does
Durability of dataA 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 namesA 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 dataA 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 renameA 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 directoriesAfter a crash, once the export serves again, the file is at its old path or its new path. It is never lost.
Exclusive createO_CREAT | O_EXCL succeeds for one creator only, across all clients.
Overlapping writesWhen 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_APPENDAppends 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.
mmapA shared mapping works on one client. Another client sees what was written through it only after it opens the file again.
Access timeA 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.
TimestampsTimes 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 listingA listing that runs while entries are created or removed can miss or repeat those entries. It never returns a damaged name.
QuotaA write fails with EDQUOT only when the export is full. The export never goes past its limit.
Name and path lengthA name can be 255 bytes. A path can be 4096 bytes.
SUID and SGID programsA 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:

ErrorWhenWhat to do
ESTALEThe file was removed, or the node serving it stopped serving it.Open the file again by its path.
EIOReturned 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.
EIOReturned 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.
ETIMEDOUTOnly 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, mount retries for 2 minutes, the Linux default of its retry= 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 hard mount it waits until that node returns, and on a soft mount it gets EIO. To go on sooner, mount the export through another node.
  • Waiting calls. On a hard mount a call waits until a node answers, and only SIGKILL stops a process that is waiting. A drain or a job that ends must allow for these waits. A soft mount returns EIO instead, 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 EIO rather 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-files bucket.
  • Directories above two million entries. The gateway's metadata cache holds two million entries. A larger directory lists much more slowly.