NFS attribute cache
An NFS attribute cache is a client-side copy of file or directory metadata reused until refresh or revalidation is required.
Metadata such as size and change information is not the file's cached payload. By default the Linux client keeps regular-file attributes for at least 3 s and at most 60 s, and directory attributes for 30 s to 60 s, before asking the server again. [1]
Linux actimeo sets all four attribute-cache timers to one value, while noac additionally makes application writes synchronous, so they are not interchangeable settings. With noac every attribute check goes to the server, at the cost of many extra network operations. [1] An NFSv4 client may validate cached attributes by fetching only change and time_access, and it may hold modified values only for size, time_modify and change. [2]
Attribute freshness does not create an atomic snapshot across multiple files, and caches on different clients may observe server changes in different orders. All attributes of one file are cached as a unit, with an upper bound on how long an entry may go unrefreshed. [2]
Relations
- related
- NFS change attribute, NFS, Close-to-open consistency, NFSv4 file delegation, Page cache, NFS lookup cache
Advantages
Limitations
- Disabling attribute caching does not disable all file-data caching or eliminate every coherence race. [1]
- Timestamps changed on the server reach applications only after the client retrieves fresh attributes. [1]
Citations
- nfs-utils nfs(5), Debian trixie: data and metadata coherence and version-specific cto/nocto options.
- Haynes and Noveck (editors). NFS Version 4 Protocol. RFC 7530, sections 10.3, 10.4 and 10.6 (NFSv4.0).
Further reading
Sources & caveats
- nfs-client is nfs(5) from nfs-utils 2.8.3 on Debian trixie, re-read for the ac, noac, acregmin, acregmax, acdirmin, acdirmax and actimeo options and the coherence section.
- rfc7530 is the NFSv4.0 specification, re-read in section 10.6 for attribute caching rules.
- The direct-io entry links here because nfs(5) names O_DIRECT as the way to disable data caching that noac leaves in place.