rfc-9754

Extensions for Opening and Delegating Files in NFSv4.2

T. Haynes, T. Myklebust
date2025-03 streamIETF areawit wgnfsv4 statusPROPOSED STANDARD pages13 canonicalhttps://www.rfc-editor.org/rfc/rfc9754 doi10.17487/RFC9754 errataview
The Network File System v4 (NFSv4) allows a client to both open a file and be granted a delegation of that file. This delegation provides the client the right to authoritatively cache metadata on the file locally. This document presents several extensions for both opening the file and delegating it to the client. This document extends NFSv4.2 (see RFC 7863).

Extracted elements (24)

design-rationale §4.1

CLOSE is not extended to release delegation stateids because implementation experience shows that doing so does not reduce the number of synchronous operations. The OPEN XOR DELEGATION approach reduces synchronous operations by 33% and total operations by 25% by allowing DELEGRETURN to be deferred asynchronously.

design-rationale §5

The delegation timestamps feature is motivated by POSIX compliance requirements: under write delegation, the server cannot accurately report access and modify times to other clients without querying the delegating client, and the prior mechanism (SETATTR before DELEGRETURN) corrupted time_metadata. This extension allows the client to proxy these values correctly.

design-rationale §5

Time synchronization between client and server is a key prerequisite for the delegation timestamp proxy feature. While base NFSv4.2 does not require synchronization, RPCSEC_GSS typically enforces it, making this prerequisite practical in common deployments.

interoperability-note §5.1

An NFSv3 server acting as an NFSv4.2 client gateway can use the delegation timestamps feature to proxy access and modify times for NFSv3 clients, serving attribute queries locally without sending spurious GETATTRs to the NFSv4.2 server. This requires server-client time synchronization, often already provided by RPCSEC_GSS.

normative-requirement §5 MUST NOT

A change in the access time MUST NOT advance the change time (time_metadata). A change in modify time may advance the change time; if modify time is greater than change time and before current time, change time is adjusted to modify time, not to current time.

normative-requirement §4 SHOULD

If the client already has an open stateid for a file, the server SHOULD ignore the OPEN4_SHARE_ACCESS_WANT_OPEN_XOR_DELEGATION flag and return both the open and delegation stateids to avoid hiding state information from the client.

normative-requirement §5 MUST

If the client sets OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS in an OPEN operation, it MUST support fattr4_time_deleg_access and fattr4_time_deleg_modify in both CB_GETATTR and SETATTR operations.

normative-requirement §3 MUST

If the server returns NFS4ERR_ATTRNOTSUPP for the fattr4_open_arguments attribute, the client MUST interpret this to mean that the additional OPTIONAL OPEN functionality is also not supported.

normative-requirement §3 MUST

The server MUST mark REQUIRED OPEN flags as being supported in the fattr4_open_arguments attribute. OPTIONAL flags may only become REQUIRED when the NFSv4 minor version is incremented.

normative-requirement §5 SHOULD

The SETATTR carrying delegation timestamps SHOULD be either in a separate compound before the one containing DELEGRETURN, or in the same compound as an operation before DELEGRETURN. Failure to properly sequence may lead to race conditions.

normative-requirement §5 MUST

When granting a delegation stateid, the server MUST set OPEN_DELEGATE_READ_ATTRS_DELEG in the open_delegation_type4 response for a read attribute delegation, and MUST set OPEN_DELEGATE_WRITE_ATTRS_DELEG for a write attribute delegation.

normative-requirement §4 MUST

When the server elects not to send an open stateid in response to OPEN4_SHARE_ACCESS_WANT_OPEN_XOR_DELEGATION, it MUST indicate this with the OPEN4_RESULT_NO_OPEN_STATEID result flag, and OPEN4resok.stateid MUST be set to the special all-zero stateid.

normative-requirement §5 MUST

When the server grants a delegation with OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS, it MUST query the client via CB_GETATTR for fattr4_time_deleg_access and fattr4_time_deleg_modify. The change time can be derived from the modify time.

normative-requirement §5 MUST

When the server receives a SETATTR with fattr4_time_deleg_access or fattr4_time_deleg_modify, it MUST either accept those changes and derive the change time, or reject them with NFS4ERR_DELAY.

protocol-element §5

The delegation timestamp attributes (fattr4_time_deleg_access and fattr4_time_deleg_modify) are invalid for use with GETATTR, VERIFY, and NVERIFY; they may only be used with CB_GETATTR and SETATTR by a client holding an appropriate delegation.

protocol-element §2

The fattr4_offline attribute (FATTR4_OFFLINE = 83, type bool) lets a client predetermine whether a file is offline before attempting to open it, avoiding inadvertent retrieval of expensive archived data. Offline files have immediately accessible attributes but expensive-to-retrieve content.

protocol-element §3

The fattr4_open_arguments attribute (FATTR4_OPEN_ARGUMENTS = 86) provides a capability-probing framework for OPEN extensions, modeled using bitmap4 structures for each OPEN argument category (share_access, share_deny, share_access_want, open_claim, create_mode). Its scope applies to all objects with a matching fsid.

protocol-element §5

The OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS flag (0x100000) allows client and server to negotiate that the client will be the authoritative proxy for fattr4_time_deleg_access and fattr4_time_deleg_modify, with those values returned to the server upon DELEGRETURN.

protocol-element §4

The OPEN4_SHARE_ACCESS_WANT_OPEN_XOR_DELEGATION flag (0x200000) allows a client to request that OPEN return either an open stateid or a delegation stateid, but not necessarily both. This is a hint; the server may still return both stateids.

security-consideration §7

The delegation extensions introduce no new security concerns. Other clients cannot directly query the delegating client's cached attributes; if a client reports false cached attribute data via CB_GETATTR, this is no worse than what was already possible via SETATTR.

security

state-machine §5

Timestamp validation on SETATTR with delegation times: if presented time is before the file's existing time_access/time_modify, the update is silently ignored; if the presented time is past current server time, the server clamps to current time or returns NFS4ERR_DELAY. All three times (access, modify, change) are compared against the same snapshot of current time.

wire-format §2.1

fattr4_offline is encoded as an XDR bool with attribute number FATTR4_OFFLINE = 83. It is a file attribute reportable via GETATTR or READDIR without bringing the file online.

wire-format §5.2

fattr4_time_deleg_access (FATTR4_TIME_DELEG_ACCESS = 84) and fattr4_time_deleg_modify (FATTR4_TIME_DELEG_MODIFY = 85) are both encoded as nfstime4. Two new delegation types OPEN_DELEGATE_READ_ATTRS_DELEG = 4 and OPEN_DELEGATE_WRITE_ATTRS_DELEG = 5 are added to the open_delegation_type4 enum.

wire-format §3.1

The open_arguments4 struct contains five bitmap4 fields: oa_share_access, oa_share_deny, oa_share_access_want, oa_open_claim, and oa_create_mode. It is typedef'd as fattr4_open_arguments with attribute number 86.