RFC 9754
Extensions for Opening and Delegating Files in NFSv4.2
RFC 9754: Extensions for Opening and Delegating Files in NFSv4.2 β¨
Okay bestie, here's the title block π
- Who wrote it: T. Haynes and T. Myklebust, both from Hammerspace π§βπ»
- Stream and category: Internet Engineering Task Force (IETF), Standards Track π
- Date: March 2025 ποΈ
- ISSN: 2070-1721
- Obsoletes/Updates: the header doesn't list any obsoleted or updated documents. What it does say is that it extends NFSv4.2, which the Abstract covers below. π¦
Abstract
Okay so NFSv4 lets a client open a file and get a delegation for that same file π₯ A delegation basically means the client gets to be the authority for that file's metadata and cache it locally, which is so iconic π This doc adds several extensions for both opening the file and delegating it to the client β¨ It extends NFSv4.2 (see RFC 7863) π
Status of This Memo
This is an Internet Standards Track document πΈ
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community, it got public review, and the Internet Engineering Steering Group (IESG) approved it for publication π«Ά For more on Internet Standards, check Section 2 of RFC 7841.
Want the current status, any errata, or a way to send feedback? Go to https://www.rfc-editor.org/info/rfc9754 π¦
Copyright Notice
Copyright (c) 2025 IETF Trust and the persons identified as the document authors. All rights reserved. π
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) as they stand on the publication date. Please actually read these, because they spell out your rights and restrictions for this document π Any Code Components pulled out of this document must include Revised BSD License text, as described in Section 4.e of the Trust Legal Provisions, and they come with no warranty, as described in the Revised BSD License.
Table of Contents
1. Introduction
1.1. Definitions
1.2. Requirements Language
2. Offline Files
2.1. XDR for the Offline Attribute
3. Determining OPEN Feature Support
3.1. XDR for Open Arguments
4. OPEN Grants Either an Open or a Delegation Stateid
4.1. Implementation Experience
5. Proxying of Times
5.1. Use Case for NFSv3 Client Proxy
5.2. XDR for Proxying of Times
6. Extraction of XDR
7. Security Considerations
8. IANA Considerations
9. Normative References
Acknowledgments
Authors' Addresses
1. Introduction β¨
In NFSv4, a client can be granted a delegation for a file (see Section 1.8.4 of [RFC8881]). That makes the client the authority for the file's data and metadata, which is giving main character energy π This document adds a bunch of extensions that level up opens and delegations. They let the client:
- detect an offline file, which may require significant effort to obtain;
- determine which extensions of OPEN flags are supported by the server;
- retrieve either the open or delegation stateid, but not both simultaneously, during the OPEN procedure; and
- cache both the access and modify timestamps, thereby reducing the frequency with which the client must query the server for this information.
Using the process in [RFC8178], the revisions in this document become an extension of NFSv4.2 [RFC7862]. They're built on top of the External Data Representation (XDR) [RFC4506] generated from [RFC7863] π§
1.1. Definitions
Here's the terminology this doc uses π
- offline file: A file that lives on a device that isn't connected to the server. Bringing it online usually costs something. Historically that meant a file on tape media, and the cost was finding and loading the tape πΌ These days it's more likely a file in the cloud, where the cost is money for downloading it πΈ
- proxy: Attributes get proxied when a client has the authority, granted by the right delegation, to represent the attributes the server normally maintains. For read attributes, that happens when the client has either a read or write delegation for the file. For write attributes, it happens when the client has a write delegation for the file. The client with this authority is the "proxy" for those attributes π«Ά
The following terms are referenced as well, with their definitions found where shown:
CB_GETATTR(Section 20.1 of [RFC8881])change(Section 5.8.1.4 of [RFC8881])CLOSE(Section 18.2 of [RFC8881])compound(Section 2.3 of [RFC8881])DELEGRETURN(Section 18.6 of [RFC8881])GETATTR(Section 18.7 of [RFC8881])LAYOUTGET(Section 18.43 of [RFC8881])LOCK(Section 18.10 of [RFC8881])NFS4ERR_DELAY(Section 15.1.1.3 of [RFC8881])OPEN(Section 18.16 of [RFC8881])open_delegation_type4(Section 18.16.1 of [RFC8881])READ(Section 18.22 of [RFC8881])READDIR(Section 18.23 of [RFC8881])SETATTR(Section 18.30 of [RFC8881])stateid(Section 8.2 of [RFC8881])time_access(Section 5.8.2.37 of [RFC8881])time_metadata(Section 5.8.2.42 of [RFC8881])time_modify(Section 5.8.2.43 of [RFC8881])WRITE(Section 18.32 of [RFC8881])
1.2. Requirements Language
Okay, keyword rules time π The words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document carry the meaning from BCP 14 [RFC2119] [RFC8174]. That only applies when, and only when, they're written in all capitals, the way they are right here π
2. Offline Files π§
If a file is offline, the server has immediate, high-performance access to its attributes, but not to its content. Pulling the data content is expensive, so the content should only be retrieved if it's actually going to be used π For example, a graphical file manager (such as Finder in Mac OS X) may want to peek at the beginning of a file so it can preview it while a user hovers over the file name, without actually opening it. If the file does get retrieved, it'll most likely be either immediately thrown away or returned π
A compound with a GETATTR or READDIR can report the file's attributes without bringing the file online. But either an OPEN or a LAYOUTGET might make the file server retrieve the archived data contents, which brings the file online β¨ For non-parallel NFS systems (see Section 12 of [RFC8881]), the OPEN operation requires a filehandle to retrieve the data content. For parallel NFS (pNFS) systems, the filehandle retrieved from an OPEN doesn't need to cause the data content to be retrieved. However, when the LAYOUTGET operation is processed, a layout-type-specific mapping will cause the data content to be retrieved from offline storage π§
If the client doesn't know the file is offline, it might accidentally open the file just to figure out what type of file it is π¬ By checking the new attribute fattr4_offline, a client can predetermine whether the file is available, so it doesn't have to open it at all π¦ Being offline can also mean the file is archived in the cloud, i.e., there can be a cost both for retrieving the file to bring it online and for sending it back to offline status πΈ
2.1. XDR for the Offline Attribute
<CODE BEGINS>
///
/// typedef bool fattr4_offline;
///
///
/// const FATTR4_OFFLINE = 83;
///
<CODE ENDS>
3. Determining OPEN Feature Support π
Section 4.4.2 of [RFC8178] lets you extend a particular minor version of the NFSv4 protocol without defining a brand-new minor version, which is so smart π§ The client can probe the server's capabilities and, based on the result, figure out whether both it and the server support optional features that weren't previously specified as part of the minor version π
The fattr4_open_arguments attribute is a new XDR extension that's super helpful when OPEN gets extended this way π It models all of the parameters with bitmap4 data structures, which means you can add a new flag to any of the OPEN arguments. The scope of this attribute applies to all objects with a matching fsid π
Two new flags are provided:
OPEN4_SHARE_ACCESS_WANT_OPEN_XOR_DELEGATION(see Section 4)OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS(see Section 5)
Future extensions can use this framework when they add new OPTIONAL functionality to OPEN, by creating a new flag for each OPTIONAL parameter π«Ά
Since fattr4_open_arguments is a RECOMMENDED attribute, if the server tells the client via NFS4ERR_ATTRNOTSUPP that it doesn't support this new attribute, the client MUST take that to mean the additional new OPTIONAL functionality to OPEN isn't supported either. Not me assuming otherwise π
ββοΈ
There's also the question of handling flags that are currently REQUIRED alongside OPTIONAL flags that become REQUIRED in the future π€ The server MUST mark REQUIRED flags as being supported. And these flags MUST only change from OPTIONAL to REQUIRED when the NFSv4 minor version is incremented. No sneaky changes mid-version, periodt π β¨
3.1. XDR for Open Arguments π
okay so this part is the XDR (the type language this protocol uses to describe its data) for the OPEN arguments π . Here's the whole thing:
///
/// struct open_arguments4 {
/// bitmap4 oa_share_access;
/// bitmap4 oa_share_deny;
/// bitmap4 oa_share_access_want;
/// bitmap4 oa_open_claim;
/// bitmap4 oa_create_mode;
/// };
///
///
/// enum open_args_share_access4 {
/// OPEN_ARGS_SHARE_ACCESS_READ = 1,
/// OPEN_ARGS_SHARE_ACCESS_WRITE = 2,
/// OPEN_ARGS_SHARE_ACCESS_BOTH = 3
/// };
///
///
/// enum open_args_share_deny4 {
/// OPEN_ARGS_SHARE_DENY_NONE = 0,
/// OPEN_ARGS_SHARE_DENY_READ = 1,
/// OPEN_ARGS_SHARE_DENY_WRITE = 2,
/// OPEN_ARGS_SHARE_DENY_BOTH = 3
/// };
///
///
/// enum open_args_share_access_want4 {
/// OPEN_ARGS_SHARE_ACCESS_WANT_ANY_DELEG = 3,
/// OPEN_ARGS_SHARE_ACCESS_WANT_NO_DELEG = 4,
/// OPEN_ARGS_SHARE_ACCESS_WANT_CANCEL = 5,
/// OPEN_ARGS_SHARE_ACCESS_WANT_SIGNAL_DELEG_WHEN_RESRC_AVAIL
/// = 17,
/// OPEN_ARGS_SHARE_ACCESS_WANT_PUSH_DELEG_WHEN_UNCONTENDED
/// = 18,
/// OPEN_ARGS_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS = 20,
/// OPEN_ARGS_SHARE_ACCESS_WANT_OPEN_XOR_DELEGATION = 21
/// };
///
///
/// enum open_args_open_claim4 {
/// OPEN_ARGS_OPEN_CLAIM_NULL = 0,
/// OPEN_ARGS_OPEN_CLAIM_PREVIOUS = 1,
/// OPEN_ARGS_OPEN_CLAIM_DELEGATE_CUR = 2,
/// OPEN_ARGS_OPEN_CLAIM_DELEGATE_PREV = 3,
/// OPEN_ARGS_OPEN_CLAIM_FH = 4,
/// OPEN_ARGS_OPEN_CLAIM_DELEG_CUR_FH = 5,
/// OPEN_ARGS_OPEN_CLAIM_DELEG_PREV_FH = 6
/// };
///
///
/// enum open_args_createmode4 {
/// OPEN_ARGS_CREATEMODE_UNCHECKED4 = 0,
/// OPEN_ARGS_CREATE_MODE_GUARDED = 1,
/// OPEN_ARGS_CREATEMODE_EXCLUSIVE4 = 2,
/// OPEN_ARGS_CREATE_MODE_EXCLUSIVE4_1 = 3
/// };
///
///
/// typedef open_arguments4 fattr4_open_arguments;
///
///
/// %/*
/// % * Determine what OPEN supports.
/// % */
/// const FATTR4_OPEN_ARGUMENTS = 86;
///
///
/// const OPEN4_SHARE_ACCESS_WANT_OPEN_XOR_DELEGATION = 0x200000;
///
///
/// const OPEN4_RESULT_NO_OPEN_STATEID = 0x00000010;
4. OPEN Grants Either an Open or a Delegation Stateid β¨
okay bestie, so the OPEN procedure hands the client an open stateid π¦ so it can reference the state of the file. The client can also ask for a delegation stateid in the OPEN arguments. The file counts as open for the client as long as the count of open and delegated stateids is greater than 0 π. Either type is enough for the server to treat the file as open, which lets READ, WRITE, LOCK, and LAYOUTGET operations go through. If the client gets both an open and a delegation stateid as part of the OPEN, it has to return them both to the server π«Ά. And one more thing: during each operation, the client can send a costly GETATTR π.
If the client knows that the server supports the OPEN4_SHARE_ACCESS_WANT_OPEN_XOR_DELEGATION flag (as determined by an earlier GETATTR operation that queried for the fattr4_open_arguments attribute), then the client can supply that flag during the OPEN and get either an open or a delegation stateid πΈ.
The client is already prepared to not get a delegation stateid, even if it asked for one π§. To not send an open stateid, the server MUST indicate that fact with the result flag OPEN4_RESULT_NO_OPEN_STATEID. The open stateid field, OPEN4resok.stateid, MUST be set to the special all-zero stateid in this case.
Note that the OPEN4_SHARE_ACCESS_WANT_OPEN_XOR_DELEGATION flag is a hint π. The server might return both stateids. Picture this: the client opens a file read-only (with OPEN4_SHARE_ACCESS_WANT_OPEN_XOR_DELEGATION set) and only gets an open stateid. Then it opens the same file read-write (again with OPEN4_SHARE_ACCESS_WANT_OPEN_XOR_DELEGATION set). The server can return one of these three options:
- Only an open stateid with the correct seqid.
- Only a delegation stateid, with the open stateid now having an incorrect seqid as it needs to be upgraded.
- Both an open stateid (which will be upgraded) and a delegation stateid.
In that scenario, returning just a delegation stateid would hide information from the client. So if the client already has an open stateid, then the server SHOULD ignore the OPEN4_SHARE_ACCESS_WANT_OPEN_XOR_DELEGATION flag and return both the open and delegation stateids π.
4.1. Implementation Experience π
The CLOSE operation neither explicitly nor implicitly releases any delegation stateids. This is not symmetrical with the OPEN operation, which can grant both an open and a delegation stateid. This specification could have tried to extend the CLOSE operation to release both stateids, but implementation experience shows that is more costly than the approach that has been proposed π .
Consider a small workload of creating a file with content. With existing implementations, this involves three synchronous operations and one asynchronous operation:
- The first synchronous operation has to OPEN the file.
- The second synchronous operation performs the WRITE to the file.
- The third synchronous operation has to CLOSE the file.
- The asynchronous operation uses DELEGRETURN to return the delegation stateid.
SEQ PUTFH OPEN GETFH GETATTR
SEQ PUTFH WRITE GETATTR
SEQ PUTFH CLOSE
...
SEQ PUTFH DELEGRETURN
With the proposed approach of setting the OPEN_ARGS_SHARE_ACCESS_WANT_OPEN_XOR_DELEGATION flag during the OPEN, the number of operations is always three π. The first two compounds are still synchronous, but the last one is asynchronous. That's because the client no longer has to send a CLOSE operation, so it can delay the DELEGRETURN until either the server requests it back via delegation recall, or garbage collection causes the client to return the stateid π¦.
SEQ PUTFH OPEN(OPEN_ARGS_SHARE_ACCESS_WANT_OPEN_XOR_DELEGATION)
GETFH GETATTR
SEQ PUTFH WRITE GETATTR
...
SEQ PUTFH DELEGRETURN
This approach reduces the cost of synchronous operations by 33% and the total number of operations by 25% π₯. Contrast that with the alternative proposal of having CLOSE return both stateids, which would not reduce the number of synchronous operations π.
5. Proxying of Times β¨
Okay so, bestie, when a client gets a write delegation on a file, it becomes the boss of the file contents and the associated attributes π. If the server asks what's going on with the file via a CB_GETATTR, then under the unextended NFSv4 protocol, the server can only figure out the file size and the change attribute π€·ββοΈ. Meanwhile the delegation-holding client has the current access and modify times, and literally no other client can see those values π. To tell the server about these proxied values, the client could send a compound of the form SEQ, PUTFH, SETATTR (time_modify | time_access), DELEGRETURN. The catch is that the SETATTR would make either or both of the change attribute or time_metadata attribute jump to the current time on the server π©. There's also no current way to grab these values before the delegation comes back using CB_GETATTR. So it can't pass these times along to an application that expects POSIX compliance, which is often super necessary for things to work right π.
With the new OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS flag, the client and server can negotiate that the client is the authority for these values π¦. Then, when the delegation stateid gets returned via a DELEGRETURN, the times get passed back to the server π. If another client queries the server for either the size or the times, the server will need to use a CB_GETATTR to ask the client holding the delegation π«Ά.
If a server tells the client through the fattr4_open_arguments attribute that it supports OPEN_ARGS_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS, and it returns a valid delegation stateid for an OPEN operation that sets the OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS flag, then it MUST query the client via a CB_GETATTR for the fattr4_time_deleg_access attribute (see Section 5.2) and the fattr4_time_deleg_modify attribute (see Section 5.2). (Note that the change time can be derived from the modify time π§.) Further, when a server gets a SETATTR with those attributes set, then it MUST accept those changes in the fattr4_time_deleg_access and fattr4_time_deleg_modify attributes and derive the change time, or it MUST reject the changes with NFS4ERR_DELAY π.
When the server grants a delegation stateid, it MUST inform the client by setting the appropriate flag in the open_delegation_type4 response β¨. The server MUST set OPEN_DELEGATE_READ_ATTRS_DELEG when it grants a read attribute delegation, and MUST set OPEN_DELEGATE_WRITE_ATTRS_DELEG when it grants a write attribute delegation π.
These new attributes are invalid to use with GETATTR, VERIFY, and NVERIFY, and they can only be used with CB_GETATTR and SETATTR by a client holding an appropriate delegation π«. The SETATTR SHOULD be either 1) in a separate compound before the one containing the DELEGRETURN, or 2) in the same compound as an operation before the DELEGRETURN. Failure to sequence the operations properly may lead to race conditions π.
A key prerequisite of this approach is that the server and client are in time synchronization with each other β°. Note that while base NFSv4.2 doesn't require this synchronization, using RPCSEC_GSS typically makes it a requirement π. When the client presents either the fattr4_time_deleg_access or the fattr4_time_deleg_modify attribute to the server, the server MUST decide, for both of them, whether the time presented is:
- before the corresponding time_access attribute or time_modify attribute on the file, or
- past the current server time.
When the time presented is before the original time, the update is ignored π
ββοΈ. When the time presented is in the future, the server can either clamp the new time to the current time or return NFS4ERR_DELAY to the client, letting it retry π. Note that if the clock skew is large, the delay approach would result in access to the file being denied until the clock skew is exceeded π¬.
A change in the access time MUST NOT advance the change time, also known as the time_metadata attribute π«. However, a change in the modify time might advance the change time (and in turn, the change attribute) π. If the modify time is greater than the change time and before the current time, then the change time is adjusted to the modify time, and not the current time (as is most likely done on most SETATTR calls that change the metadata) π . If the modify time is in the future, it will be clamped to the current time π§.
Note that each of the possible times (access, modify, and change) is compared to the current time. They should all be compared against the same time value for the current time (i.e., they do not retrieve a different value of the current time for each calculation) β.
If the client sets the OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS flag in an OPEN operation, then it MUST support the fattr4_time_deleg_access and fattr4_time_deleg_modify attributes in both the CB_GETATTR and SETATTR operations π«Ά.
5.1. Use Case for NFSv3 Client Proxy
Let's say there's an NFSv3 client that wants to access data on a server that only supports NFSv4.2 πΈ. An implementation can introduce an NFSv3 server that acts as an NFSv4.2 client, serving as a gateway between the two otherwise incompatible systems π. NFSv3 is a stateless protocol, so the state isn't kept on the client, but rather on the NFSv3 server π§ . Since the NFSv3 server is already managing the state, it can proxy file delegations to avoid spurious GETATTRs π―. That means that as the client queries the NFSv3 server for attributes, they can be served without the NFSv3 server sending a GETATTR to the NFSv4.2 server π¦.
5.2. XDR for Proxying of Times
///
/// /*
/// * attributes for the delegation times being
/// * cached and served by the "client"
/// */
/// typedef nfstime4 fattr4_time_deleg_access;
/// typedef nfstime4 fattr4_time_deleg_modify;
///
///
/// %/*
/// % * New RECOMMENDED Attribute for
/// % * delegation caching of times
/// % */
/// const FATTR4_TIME_DELEG_ACCESS = 84;
/// const FATTR4_TIME_DELEG_MODIFY = 85;
///
///
/// const OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS = 0x100000;
///
/// enum open_delegation_type4 {
/// OPEN_DELEGATE_NONE = 0,
/// OPEN_DELEGATE_READ = 1,
/// OPEN_DELEGATE_WRITE = 2,
/// OPEN_DELEGATE_NONE_EXT = 3, /* new to v4.1 */
/// OPEN_DELEGATE_READ_ATTRS_DELEG = 4,
/// OPEN_DELEGATE_WRITE_ATTRS_DELEG = 5
/// };
6. Extraction of XDR π§©
This document contains the XDR [RFC4506] description of the new open flags for delegating the file to the client π. The XDR description is embedded in this document in a way that makes it simple for the reader to extract it into a ready-to-compile form π οΈ. The reader can feed this document into the following shell script to produce the machine-readable XDR description of the new flags:
#!/bin/sh
grep '^ *///' $* | sed 's?^ */// ??' | sed 's?^ *///$??'
So if the above script is stored in a file called "extract.sh" and this document is in a file called "spec.txt", then the reader can do the following:
sh extract.sh < spec.txt > delstid_prot.x
The effect of the script is to remove leading blank space from each line, plus a sentinel sequence of "///". XDR descriptions with the sentinel sequence are embedded throughout the document π.
Note that the XDR code in this document depends on types from the NFSv4.2 nfs4_prot.x file (generated from [RFC7863]). This includes both nfs types that end with a 4 (such as offset4 and length4) as well as more generic types (such as uint32_t and uint64_t) π.
While the XDR can be appended to that from [RFC7863], the various code snippets belong in their respective areas of that XDR π.
7. Security Considerations π¨
Okay, this part is serious bestie π₯Ί. While this document extends some capabilities for client delegation, there are no new security concerns. The client cannot be queried by other clients as to the cached attributes. The client could report false data for the cached attributes, but it already has this ability via a SETATTR operation ππ.
8. IANA Considerations ποΈ
This document has no IANA actions β¨.
9. Normative References π
- [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, <https://www.rfc-editor.org/info/rfc2119>.
- [RFC4506] Eisler, M., Ed., "XDR: External Data Representation Standard", STD 67, RFC 4506, DOI 10.17487/RFC4506, May 2006, <https://www.rfc-editor.org/info/rfc4506>.
- [RFC7862] Haynes, T., "Network File System (NFS) Version 4 Minor Version 2 Protocol", RFC 7862, DOI 10.17487/RFC7862, November 2016, <https://www.rfc-editor.org/info/rfc7862>.
- [RFC7863] Haynes, T., "Network File System (NFS) Version 4 Minor Version 2 External Data Representation Standard (XDR) Description", RFC 7863, DOI 10.17487/RFC7863, November 2016, <https://www.rfc-editor.org/info/rfc7863>.
- [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, <https://www.rfc-editor.org/info/rfc8174>.
- [RFC8178] Noveck, D., "Rules for NFSv4 Extensions and Minor Versions", RFC 8178, DOI 10.17487/RFC8178, July 2017, <https://www.rfc-editor.org/info/rfc8178>.
- [RFC8881] Noveck, D., Ed. and C. Lever, "Network File System (NFS) Version 4 Minor Version 1 Protocol", RFC 8881, DOI 10.17487/RFC8881, August 2020, <https://www.rfc-editor.org/info/rfc8881>.
Acknowledgments π
Trond Myklebust, Tom Haynes, and David Flynn all worked on the prototype at Hammerspace π.
Dave Noveck, Chuck Lever, Rick Macklem, and Zaheduzzaman Sarker provided reviews of the document π.
Jeff Layton provided experience from an implementation he authored π«Ά.
Authors' Addresses π
Thomas Haynes Hammerspace Email: loghyr@hammerspace.com
Trond Myklebust Hammerspace Email: trondmy@hammerspace.com
π¦ where this page comes from
- ietf: rfc9754 2025-03
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms