NFS change attribute
The NFSv4 change attribute is a server-generated value used to detect changes to a file's data, a directory's entries or an object's attributes.
Validation: NFSv4 cache checks use change rather than time_modify alone, whose granularity can hide successive updates. It is a 64-bit value, not a content checksum or proof of stable storage. [1]
Directory updates: Without a directory delegation, serialized operations can compare a previous after value with the next before value in change_info4. With a valid starting cache, matching values establish continuity only when both operations report their change information atomically. Replies to concurrent requests may arrive in a different order. A cached listing assembled from multiple READDIR calls needs GETATTR checks before its first and after its last call to validate directory consistency; the continuation cookie does not replace this check. [1]
Ordering: A baseline change value need not be a monotonically increasing counter. NFSv4.2 change_attr_type advertises per-filesystem behavior, including monotonic and version-counter forms. A client cannot infer the newest parallel reply merely by choosing the largest value unless the applicable behavior supports that ordering. [2]
Linux v7.2 implementation: nfsd4_change_attribute checks the returned STATX_CHANGE_COOKIE bit. With no cookie it derives change from ctime. With a cookie it uses that value, adding encoded ctime for a regular file unless STATX_ATTR_CHANGE_MONOTONIC is set. Other file types keep the supplied cookie. The source explains the addition as protection against reusing pre-crash values, conditional on time not moving backward. These are implementation branches, not a universal NFS encoding or a proof of durable bytes. [4]
Relations
- related
- NFS attribute cache, NFS lookup cache, NFS write verifier, NFS READDIR cookie, Multigrain timestamps
Limitations
- Matching values from different servers are not comparable without established change-class continuity. [1]
Citations
- RFC 8881: NFSv4.1, sections 5.8.1.4, 10.3.1, 10.8.1-10.8.2 and 11.11.5.
- RFC 7862: NFSv4.2, sections 10 and 12.2.3, change_attr_type and reply ordering.
- Linux v7.2 fs/nfsd/nfsfh.c: nfsd4_change_attribute and returned change-cookie flags
Further reading
Sources & caveats
- Primary-source protocol review, not a client interoperability or crash test.
- Directory continuity follows RFC 8881 section 10.8.1 without directory delegations; the optional NFSv4.2 type is a separate extension.
- No universal cross-reboot uniqueness or persistence guarantee is inferred from the change attribute.