idnits 2.17.1 draft-ietf-nfsv4-minorversion2-28.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- -- The document has examples using IPv4 documentation addresses according to RFC6890, but does not use any IPv6 documentation addresses. Maybe there should be IPv6 examples, too? Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (November 24, 2014) is 3438 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '0' on line 3779 == Missing Reference: '32K' is mentioned on line 3779, but not defined == Unused Reference: 'RFC5664' is defined on line 4098, but no explicit reference was found in the text == Unused Reference: 'RFC4506' is defined on line 4167, but no explicit reference was found in the text -- Possible downref: Non-RFC (?) normative reference: ref. 'NFSv42xdr' ** Obsolete normative reference: RFC 5661 (Obsoleted by RFC 8881) == Outdated reference: A later version (-35) exists of draft-ietf-nfsv4-rfc3530bis-33 == Outdated reference: A later version (-06) exists of draft-ietf-nfsv4-lfs-registry-01 -- Obsolete informational reference (is this intentional?): RFC 2401 (Obsoleted by RFC 4301) -- Obsolete informational reference (is this intentional?): RFC 2616 (Obsoleted by RFC 7230, RFC 7231, RFC 7232, RFC 7233, RFC 7234, RFC 7235) Summary: 1 error (**), 0 flaws (~~), 6 warnings (==), 7 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 NFSv4 T. Haynes 3 Internet-Draft Primary Data 4 Intended status: Standards Track November 24, 2014 5 Expires: May 28, 2015 7 NFS Version 4 Minor Version 2 8 draft-ietf-nfsv4-minorversion2-28.txt 10 Abstract 12 This Internet-Draft describes NFS version 4 minor version two, 13 describing the protocol extensions made from NFS version 4 minor 14 version 1. Major extensions introduced in NFS version 4 minor 15 version two include: Server Side Copy, Application I/O Advise, Space 16 Reservations, Sparse Files, Application Data Blocks, and Labeled NFS. 18 Requirements Language 20 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 21 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 22 document are to be interpreted as described in RFC 2119 [RFC2119]. 24 Status of This Memo 26 This Internet-Draft is submitted in full conformance with the 27 provisions of BCP 78 and BCP 79. 29 Internet-Drafts are working documents of the Internet Engineering 30 Task Force (IETF). Note that other groups may also distribute 31 working documents as Internet-Drafts. The list of current Internet- 32 Drafts is at http://datatracker.ietf.org/drafts/current/. 34 Internet-Drafts are draft documents valid for a maximum of six months 35 and may be updated, replaced, or obsoleted by other documents at any 36 time. It is inappropriate to use Internet-Drafts as reference 37 material or to cite them other than as "work in progress." 39 This Internet-Draft will expire on May 28, 2015. 41 Copyright Notice 43 Copyright (c) 2014 IETF Trust and the persons identified as the 44 document authors. All rights reserved. 46 This document is subject to BCP 78 and the IETF Trust's Legal 47 Provisions Relating to IETF Documents 48 (http://trustee.ietf.org/license-info) in effect on the date of 49 publication of this document. Please review these documents 50 carefully, as they describe your rights and restrictions with respect 51 to this document. Code Components extracted from this document must 52 include Simplified BSD License text as described in Section 4.e of 53 the Trust Legal Provisions and are provided without warranty as 54 described in the Simplified BSD License. 56 Table of Contents 58 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 59 1.1. The NFS Version 4 Minor Version 2 Protocol . . . . . . . 4 60 1.2. Scope of This Document . . . . . . . . . . . . . . . . . 5 61 1.3. NFSv4.2 Goals . . . . . . . . . . . . . . . . . . . . . . 5 62 1.4. Overview of NFSv4.2 Features . . . . . . . . . . . . . . 5 63 1.4.1. Server Side Copy . . . . . . . . . . . . . . . . . . 5 64 1.4.2. Application I/O Advise . . . . . . . . . . . . . . . 6 65 1.4.3. Sparse Files . . . . . . . . . . . . . . . . . . . . 6 66 1.4.4. Space Reservation . . . . . . . . . . . . . . . . . . 6 67 1.4.5. Application Data Block (ADB) Support . . . . . . . . 6 68 1.4.6. Labeled NFS . . . . . . . . . . . . . . . . . . . . . 6 69 1.5. Enhancements to Minor Versioning Model . . . . . . . . . 7 70 2. Minor Versioning . . . . . . . . . . . . . . . . . . . . . . 7 71 3. pNFS considerations for New Operations . . . . . . . . . . . 8 72 3.1. Atomicity for ALLOCATE and DEALLOCATE . . . . . . . . . . 8 73 3.2. Sharing of stateids with NFSv4.1 . . . . . . . . . . . . 8 74 3.3. NFSv4.2 as a Storage Protocol in pNFS: the File Layout 75 Type . . . . . . . . . . . . . . . . . . . . . . . . . . 8 76 3.3.1. Operations Sent to NFSv4.2 Data Servers . . . . . . . 8 77 4. Server Side Copy . . . . . . . . . . . . . . . . . . . . . . 9 78 4.1. Introduction . . . . . . . . . . . . . . . . . . . . . . 9 79 4.2. Protocol Overview . . . . . . . . . . . . . . . . . . . . 9 80 4.2.1. Copy Operations . . . . . . . . . . . . . . . . . . . 10 81 4.2.2. Requirements for Operations . . . . . . . . . . . . . 10 82 4.3. Requirements for Inter-Server Copy . . . . . . . . . . . 11 83 4.4. Implementation Considerations . . . . . . . . . . . . . . 11 84 4.4.1. Locking the Files . . . . . . . . . . . . . . . . . . 11 85 4.4.2. Client Caches . . . . . . . . . . . . . . . . . . . . 12 86 4.5. Intra-Server Copy . . . . . . . . . . . . . . . . . . . . 12 87 4.6. Inter-Server Copy . . . . . . . . . . . . . . . . . . . . 13 88 4.7. Server-to-Server Copy Protocol . . . . . . . . . . . . . 17 89 4.7.1. Considerations on Selecting a Copy Protocol . . . . . 17 90 4.7.2. Using NFSv4.x as the Copy Protocol . . . . . . . . . 17 91 4.7.3. Using an Alternative Copy Protocol . . . . . . . . . 17 92 4.8. netloc4 - Network Locations . . . . . . . . . . . . . . . 18 93 4.9. Copy Offload Stateids . . . . . . . . . . . . . . . . . . 19 94 4.10. Security Considerations . . . . . . . . . . . . . . . . . 19 95 4.10.1. Inter-Server Copy Security . . . . . . . . . . . . . 19 96 5. Support for Application IO Hints . . . . . . . . . . . . . . 27 97 6. Sparse Files . . . . . . . . . . . . . . . . . . . . . . . . 27 98 6.1. Introduction . . . . . . . . . . . . . . . . . . . . . . 27 99 6.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 29 100 6.3. New Operations . . . . . . . . . . . . . . . . . . . . . 29 101 6.3.1. READ_PLUS . . . . . . . . . . . . . . . . . . . . . . 29 102 6.3.2. DEALLOCATE . . . . . . . . . . . . . . . . . . . . . 29 103 7. Space Reservation . . . . . . . . . . . . . . . . . . . . . . 29 104 8. Application Data Block Support . . . . . . . . . . . . . . . 31 105 8.1. Generic Framework . . . . . . . . . . . . . . . . . . . . 32 106 8.1.1. Data Block Representation . . . . . . . . . . . . . . 33 107 8.2. An Example of Detecting Corruption . . . . . . . . . . . 33 108 8.3. Example of READ_PLUS . . . . . . . . . . . . . . . . . . 35 109 8.4. An Example of Zeroing Space . . . . . . . . . . . . . . . 35 110 9. Labeled NFS . . . . . . . . . . . . . . . . . . . . . . . . . 36 111 9.1. Introduction . . . . . . . . . . . . . . . . . . . . . . 36 112 9.2. Definitions . . . . . . . . . . . . . . . . . . . . . . . 36 113 9.3. MAC Security Attribute . . . . . . . . . . . . . . . . . 37 114 9.3.1. Delegations . . . . . . . . . . . . . . . . . . . . . 38 115 9.3.2. Permission Checking . . . . . . . . . . . . . . . . . 38 116 9.3.3. Object Creation . . . . . . . . . . . . . . . . . . . 38 117 9.3.4. Existing Objects . . . . . . . . . . . . . . . . . . 39 118 9.3.5. Label Changes . . . . . . . . . . . . . . . . . . . . 39 119 9.4. pNFS Considerations . . . . . . . . . . . . . . . . . . . 39 120 9.5. Discovery of Server Labeled NFS Support . . . . . . . . . 39 121 9.6. MAC Security NFS Modes of Operation . . . . . . . . . . . 40 122 9.6.1. Full Mode . . . . . . . . . . . . . . . . . . . . . . 40 123 9.6.2. Guest Mode . . . . . . . . . . . . . . . . . . . . . 42 124 9.7. Security Considerations for Labeled NFS . . . . . . . . . 42 125 10. Sharing change attribute implementation details with NFSv4 126 clients . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 127 11. Error Values . . . . . . . . . . . . . . . . . . . . . . . . 43 128 11.1. Error Definitions . . . . . . . . . . . . . . . . . . . 43 129 11.1.1. General Errors . . . . . . . . . . . . . . . . . . . 43 130 11.1.2. Server to Server Copy Errors . . . . . . . . . . . . 44 131 11.1.3. Labeled NFS Errors . . . . . . . . . . . . . . . . . 44 132 11.2. New Operations and Their Valid Errors . . . . . . . . . 45 133 11.3. New Callback Operations and Their Valid Errors . . . . . 48 134 12. New File Attributes . . . . . . . . . . . . . . . . . . . . . 49 135 12.1. New RECOMMENDED Attributes - List and Definition 136 References . . . . . . . . . . . . . . . . . . . . . . . 49 137 12.2. Attribute Definitions . . . . . . . . . . . . . . . . . 50 138 13. Operations: REQUIRED, RECOMMENDED, or OPTIONAL . . . . . . . 52 139 14. Modifications to NFSv4.1 Operations . . . . . . . . . . . . . 56 140 14.1. Operation 42: EXCHANGE_ID - Instantiate Client ID . . . 56 141 14.2. Operation 48: GETDEVICELIST - Get All Device Mappings 142 for a File System . . . . . . . . . . . . . . . . . . . 57 143 15. NFSv4.2 Operations . . . . . . . . . . . . . . . . . . . . . 58 144 15.1. Operation 59: ALLOCATE - Reserve Space in A Region of a 145 File . . . . . . . . . . . . . . . . . . . . . . . . . . 58 146 15.2. Operation 60: COPY - Initiate a server-side copy . . . . 59 147 15.3. Operation 61: COPY_NOTIFY - Notify a source server of a 148 future copy . . . . . . . . . . . . . . . . . . . . . . 63 149 15.4. Operation 62: DEALLOCATE - Unreserve Space in a Region 150 of a File . . . . . . . . . . . . . . . . . . . . . . . 65 151 15.5. Operation 63: IO_ADVISE - Application I/O access pattern 152 hints . . . . . . . . . . . . . . . . . . . . . . . . . 66 153 15.6. Operation 64: LAYOUTERROR - Provide Errors for the 154 Layout . . . . . . . . . . . . . . . . . . . . . . . . . 71 155 15.7. Operation 65: LAYOUTSTATS - Provide Statistics for the 156 Layout . . . . . . . . . . . . . . . . . . . . . . . . . 74 157 15.8. Operation 66: OFFLOAD_CANCEL - Stop an Offloaded 158 Operation . . . . . . . . . . . . . . . . . . . . . . . 75 159 15.9. Operation 67: OFFLOAD_STATUS - Poll for Status of 160 Asynchronous Operation . . . . . . . . . . . . . . . . . 76 161 15.10. Operation 68: READ_PLUS - READ Data or Holes from a File 77 162 15.11. Operation 69: SEEK - Find the Next Data or Hole . . . . 82 163 15.12. Operation 70: WRITE_SAME - WRITE an ADB Multiple Times 164 to a File . . . . . . . . . . . . . . . . . . . . . . . 83 165 16. NFSv4.2 Callback Operations . . . . . . . . . . . . . . . . . 86 166 16.1. Operation 15: CB_OFFLOAD - Report results of an 167 asynchronous operation . . . . . . . . . . . . . . . . . 86 168 17. Security Considerations . . . . . . . . . . . . . . . . . . . 87 169 18. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 88 170 19. References . . . . . . . . . . . . . . . . . . . . . . . . . 88 171 19.1. Normative References . . . . . . . . . . . . . . . . . . 88 172 19.2. Informative References . . . . . . . . . . . . . . . . . 88 173 Appendix A. Acknowledgments . . . . . . . . . . . . . . . . . . 90 174 Appendix B. RFC Editor Notes . . . . . . . . . . . . . . . . . . 91 175 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 91 177 1. Introduction 179 1.1. The NFS Version 4 Minor Version 2 Protocol 181 The NFS version 4 minor version 2 (NFSv4.2) protocol is the third 182 minor version of the NFS version 4 (NFSv4) protocol. The first minor 183 version, NFSv4.0, is described in [I-D.ietf-nfsv4-rfc3530bis] and the 184 second minor version, NFSv4.1, is described in [RFC5661]. 186 As a minor version, NFSv4.2 is consistent with the overall goals for 187 NFSv4, but extends the protocol so as to better meet those goals, 188 based on experiences with NFSv4.1. In addition, NFSv4.2 has adopted 189 some additional goals, which motivate some of the major extensions in 190 NFSv4.2. 192 1.2. Scope of This Document 194 This document describes the NFSv4.2 protocol. With respect to 195 NFSv4.0 and NFSv4.1, this document does not: 197 o describe the NFSv4.0 or NFSv4.1 protocols, except where needed to 198 contrast with NFSv4.2 200 o modify the specification of the NFSv4.0 or NFSv4.1 protocols 202 o clarify the NFSv4.0 or NFSv4.1 protocols. I.e., any 203 clarifications made here apply to NFSv4.2 and neither of the prior 204 protocols 206 The full XDR for NFSv4.2 is presented in [NFSv42xdr]. 208 1.3. NFSv4.2 Goals 210 A major goal of the design of NFSv4.2 is to take common local file 211 system features and offer them remotely. These features might 213 o already be available on the servers, e.g., sparse files 215 o be under development as a new standard, e.g., SEEK pulls in both 216 SEEK_HOLE and SEEK_DATA 218 o be used by clients with the servers via some proprietary means, 219 e.g., Labeled NFS 221 NFSv4.2 provides means for clients to leverage these features on the 222 server in cases in which that had previously not been possible within 223 the confines of the NFS protocol. 225 1.4. Overview of NFSv4.2 Features 227 1.4.1. Server Side Copy 229 A traditional file copy of a remotely accessed, whether from one 230 server to another or between location in the same server, results in 231 the data being put on the network twice - source to client and then 232 client to destination. New operations are introduced to allow 233 unnecessary traffic to be eliminated: 235 The intra-server copy feature allows the client to request the 236 server to perform the copy internally, avoiding unnecessary 237 network traffic. 239 The inter-server copy feature allows the client to authorize the 240 source and destination servers to interact directly. 242 As such copies can be lengthy, asynchronous support is also provided. 244 1.4.2. Application I/O Advise 246 Applications and clients want to advise the server as to expected I/O 247 behavior. Using IO_ADVISE (see Section 15.5) to communicate future I 248 /O behavior such as whether a file will be accessed sequentially or 249 randomly, and whether a file will or will not be accessed in the near 250 future, allows servers to optimize future I/O requests for a file by, 251 for example, prefetching or evicting data. This operation can be 252 used to support the posix_fadvise function. In addition, it may be 253 helpful to applications such as databases and video editors. 255 1.4.3. Sparse Files 257 Sparse files are ones which have unallocated or uninitialized data 258 blocks as holes in the file. Such holes are typically transferred as 259 0s during I/O. READ_PLUS (see Section 15.10) allows a server to send 260 back to the client metadata describing the hole and DEALLOCATE (see 261 Section 15.4) allows the client to punch holes into a file. In 262 addition, SEEK (see Section 15.11) is provided to scan for the next 263 hole or data from a given location. 265 1.4.4. Space Reservation 267 When a file is sparse, one concern applications have is ensuring that 268 there will always be enough data blocks available for the file during 269 future writes. ALLOCATE (see Section 15.1) allows a client to 270 request a guarantee that space will be available. Also DEALLOCATE 271 (see Section 15.4) allows the client to punch a hole into a file, 272 thus releasing a space reservation. 274 1.4.5. Application Data Block (ADB) Support 276 Some applications treat a file as if it were a disk and as such want 277 to initialize (or format) the file image. We introduce WRITE_SAME 278 (see Section 15.12) to send this metadata to the server to allow it 279 to write the block contents. 281 1.4.6. Labeled NFS 283 While both clients and servers can employ Mandatory Access Control 284 (MAC) security models to enforce data access, there has been no 285 protocol support for interoperability. A new file object attribute, 286 sec_label (see Section 12.2.2) allows for the server to store MAC 287 labels on files, which the client retrieves and uses to enforce data 288 access (see Section 9.6.2). The format of the sec_label accommodates 289 any MAC security system. 291 1.5. Enhancements to Minor Versioning Model 293 In NFSv4.1, the only way to introduce new variants of an operation 294 was to introduce a new operation. I.e., READ becomes either READ2 or 295 READ_PLUS. With the use of discriminated unions as parameters to 296 such functions in NFSv4.2, it is possible to add a new arm in a 297 subsequent minor version. And it is also possible to move such an 298 operation from OPTIONAL/RECOMMENDED to REQUIRED. Forcing an 299 implementation to adopt each arm of a discriminated union at such a 300 time does not meet the spirit of the minor versioning rules. As 301 such, new arms of a discriminated union MUST follow the same 302 guidelines for minor versioning as operations in NFSv4.1 - i.e., they 303 may not be made REQUIRED. To support this, a new error code, 304 NFS4ERR_UNION_NOTSUPP, allows the server to communicate to the client 305 that the operation is supported, but the specific arm of the 306 discriminated union is not. 308 2. Minor Versioning 310 NFSv4.2 is a minor version of NFSv4 and is built upon NFSv4.1 as 311 documented in [RFC5661] and [RFC5662]. 313 NFSv4.2 does not modify the rules applicable to the NFSv4 versioning 314 process and follows the rules set out in [RFC5661] or in standard- 315 track documents updating that document (e.g., in an RFC based on 316 [NFSv4-Versioning]). 318 NFSv4.2 only defines extensions to NFSv4.1, each of which may be 319 supported (or not) independently. It does not 321 o introduce infrastructural features 323 o make existing features MANDATORY to NOT implement 325 o change the status of existing features (i.e., by changing their 326 status among OPTIONAL, RECOMMENDED, REQUIRED). 328 The following versioning-related considerations should be noted. 330 o When a new case is added to an existing switch, servers need to 331 report non-support of that new case by returning 332 NFS4ERR_UNION_NOTSUPP. 334 o As regards the potential cross-minor-version transfer of stateids, 335 pNFS implementations of the file mapping type may support of use 336 of an NFSv4.2 metadata sever with NFSv4.1 data servers. In this 337 context, a stateid returned by an NFSv4.2 COMPOUND will be used in 338 an NFSv4.1 COMPOUND directed to the data server (see Sections 3.2 339 and 3.3). 341 3. pNFS considerations for New Operations 343 3.1. Atomicity for ALLOCATE and DEALLOCATE 345 Both ALLOCATE (see Section 15.1) and DEALLOCATE (see Section 15.4) 346 are sent to the metadata server, which is responsible for 347 coordinating the changes onto the storage devices. In particular, 348 both operations must either fully succeed or fail, it cannot be the 349 case that one storage device succeeds whilst another fails. 351 3.2. Sharing of stateids with NFSv4.1 353 A NFSv4.2 metadata server can hand out a layout to a NFSv4.1 storage 354 device. Section 13.9.1 of [RFC5661] discusses how the client gets a 355 stateid from the metadata server to present to a storage device. 357 3.3. NFSv4.2 as a Storage Protocol in pNFS: the File Layout Type 359 A file layout provided by a NFSv4.2 server may refer either to a 360 storage device that only implements NFSv4.1 as specified in 361 [RFC5661], or to a storage device that implements additions from 362 NFSv4.2, in which case the rules in Section 3.3.1 apply. As the File 363 Layout Type does not provide a means for informing the client as to 364 which minor version a particular storage device is providing, it will 365 have to negotiate this via the normal RPC semantics of major and 366 minor version discovery. 368 3.3.1. Operations Sent to NFSv4.2 Data Servers 370 In addition to the commands listed in [RFC5661], NFSv4.2 data servers 371 MAY accept a COMPOUND containing the following additional operations: 372 IO_ADVISE (see Section 15.5), READ_PLUS (see Section 15.10), 373 WRITE_SAME (see Section 15.12), and SEEK (see Section 15.11), which 374 will be treated like the subset specified as "Operations Sent to 375 NFSv4.1 Data Servers" in Section 13.6 of [RFC5661]. 377 Additional details on the implementation of these operations in a 378 pNFS context are documented in the operation specific sections. 380 4. Server Side Copy 382 4.1. Introduction 384 The server-side copy feature provides a mechanism for the NFS client 385 to perform a file copy on a server or between two servers without the 386 data being transmitted back and forth over the network through the 387 NFS client. Without this feature, an NFS client copies data from one 388 location to another by reading the data from the source server over 389 the network, and then writing the data back over the network to the 390 destination server. 392 If the source object and destination object are on different file 393 servers, the file servers will communicate with one another to 394 perform the copy operation. The server-to-server protocol by which 395 this is accomplished is not defined in this document. 397 4.2. Protocol Overview 399 The server-side copy offload operations support both intra-server and 400 inter-server file copies. An intra-server copy is a copy in which 401 the source file and destination file reside on the same server. In 402 an inter-server copy, the source file and destination file are on 403 different servers. In both cases, the copy may be performed 404 synchronously or asynchronously. 406 Throughout the rest of this document, we refer to the NFS server 407 containing the source file as the "source server" and the NFS server 408 to which the file is transferred as the "destination server". In the 409 case of an intra-server copy, the source server and destination 410 server are the same server. Therefore in the context of an intra- 411 server copy, the terms source server and destination server refer to 412 the single server performing the copy. 414 The new operations are designed to copy files. Other file system 415 objects can be copied by building on these operations or using other 416 techniques. For example, if the user wishes to copy a directory, the 417 client can synthesize a directory copy by first creating the 418 destination directory and then copying the source directory's files 419 to the new destination directory. 421 For the inter-server copy, the operations are defined to be 422 compatible with the traditional copy authentication approach. The 423 client and user are authorized at the source for reading. Then they 424 are authorized at the destination for writing. 426 4.2.1. Copy Operations 428 COPY_NOTIFY: Used by the client to notify the source server of a 429 future file copy from a given destination server for the given 430 user. (Section 15.3) 432 COPY: Used by the client to request a file copy. (Section 15.2) 434 OFFLOAD_CANCEL: Used by the client to terminate an asynchronous file 435 copy. (Section 15.8) 437 OFFLOAD_STATUS: Used by the client to poll the status of an 438 asynchronous file copy. (Section 15.9) 440 CB_OFFLOAD: Used by the destination server to report the results of 441 an asynchronous file copy to the client. (Section 16.1) 443 4.2.2. Requirements for Operations 445 The implementation of server-side copy is OPTIONAL by the client and 446 the server. However, in order to successfully copy a file, some 447 operations MUST be supported by the client and/or server. 449 If a client desires an intra-server file copy, then it MUST support 450 the COPY and CB_OFFLOAD operations. If COPY returns a stateid, then 451 the client MAY use the OFFLOAD_CANCEL and OFFLOAD_STATUS operations. 453 If a client desires an inter-server file copy, then it MUST support 454 the COPY, COPY_NOTICE, and CB_OFFLOAD operations, and MAY use the 455 OFFLOAD_CANCEL operation. If COPY returns a stateid, then the client 456 MAY use the OFFLOAD_CANCEL and OFFLOAD_STATUS operations. 458 If a server supports intra-server copy, then the server MUST support 459 the COPY operation. If a server's COPY operation returns a stateid, 460 then the server MUST also support these operations: CB_OFFLOAD, 461 OFFLOAD_CANCEL, and OFFLOAD_STATUS. 463 If a source server supports inter-server copy, then the source server 464 MUST support all these operations: COPY_NOTIFY and OFFLOAD_CANCEL. 465 If a destination server supports inter-server copy, then the 466 destination server MUST support the COPY operation. If a destination 467 server's COPY operation returns a stateid, then the destination 468 server MUST also support these operations: CB_OFFLOAD, 469 OFFLOAD_CANCEL, COPY_NOTIFY, and OFFLOAD_STATUS. 471 Each operation is performed in the context of the user identified by 472 the ONC RPC credential of its containing COMPOUND or CB_COMPOUND 473 request. For example, an OFFLOAD_CANCEL operation issued by a given 474 user indicates that a specified COPY operation initiated by the same 475 user be canceled. Therefore an OFFLOAD_CANCEL MUST NOT interfere 476 with a copy of the same file initiated by another user. 478 An NFS server MAY allow an administrative user to monitor or cancel 479 copy operations using an implementation specific interface. 481 4.3. Requirements for Inter-Server Copy 483 Inter-server copy is driven by several requirements: 485 o The specification MUST NOT mandate the server-to-server protocol. 487 o The specification MUST provide guidance for using NFSv4.x as a 488 copy protocol. For those source and destination servers willing 489 to use NFSv4.x, there are specific security considerations that 490 this specification MUST address. 492 o The specification MUST NOT mandate preconfiguration between the 493 source and destination server. Requiring that the source and 494 destination first have a "copying relationship" increases the 495 administrative burden. However the specification MUST NOT 496 preclude implementations that require preconfiguration. 498 o The specification MUST NOT mandate a trust relationship between 499 the source and destination server. The NFSv4 security model 500 requires mutual authentication between a principal on an NFS 501 client and a principal on an NFS server. This model MUST continue 502 with the introduction of COPY. 504 4.4. Implementation Considerations 506 4.4.1. Locking the Files 508 Both the source and destination file may need to be locked to protect 509 the content during the copy operations. A client can achieve this by 510 a combination of OPEN and LOCK operations. I.e., either share or 511 byte range locks might be desired. 513 Note that when the client establishes a lock stateid on the source, 514 the context of that stateid is for the client and not the 515 destination. As such, there might already be an outstanding stateid, 516 issued to the destination as client of the source, with the same 517 value as that provided for the lock stateid. The source MUST equate 518 the lock stateid as that of the client, i.e., when the destination 519 presents it in the context of a inter-server copy, it is on behalf of 520 the client. 522 4.4.2. Client Caches 524 In a traditional copy, if the client is in the process of writing to 525 the file before the copy (and perhaps with a write delegation), it 526 will be straightforward to update the destination server. With an 527 inter-server copy, the source has no insight into the changes cached 528 on the client. The client SHOULD write back the data to the source. 529 If it does not do so, it is possible that the destination will 530 receive a corrupt copy of file. 532 4.5. Intra-Server Copy 534 To copy a file on a single server, the client uses a COPY operation. 535 The server may respond to the copy operation with the final results 536 of the copy or it may perform the copy asynchronously and deliver the 537 results using a CB_OFFLOAD operation callback. If the copy is 538 performed asynchronously, the client may poll the status of the copy 539 using OFFLOAD_STATUS or cancel the copy using OFFLOAD_CANCEL. 541 A synchronous intra-server copy is shown in Figure 1. In this 542 example, the NFS server chooses to perform the copy synchronously. 543 The copy operation is completed, either successfully or 544 unsuccessfully, before the server replies to the client's request. 545 The server's reply contains the final result of the operation. 547 Client Server 548 + + 549 | | 550 |--- OPEN ---------------------------->| Client opens 551 |<------------------------------------/| the source file 552 | | 553 |--- OPEN ---------------------------->| Client opens 554 |<------------------------------------/| the destination file 555 | | 556 |--- COPY ---------------------------->| Client requests 557 |<------------------------------------/| a file copy 558 | | 559 |--- CLOSE --------------------------->| Client closes 560 |<------------------------------------/| the destination file 561 | | 562 |--- CLOSE --------------------------->| Client closes 563 |<------------------------------------/| the source file 564 | | 565 | | 567 Figure 1: A synchronous intra-server copy. 569 An asynchronous intra-server copy is shown in Figure 2. In this 570 example, the NFS server performs the copy asynchronously. The 571 server's reply to the copy request indicates that the copy operation 572 was initiated and the final result will be delivered at a later time. 573 The server's reply also contains a copy stateid. The client may use 574 this copy stateid to poll for status information (as shown) or to 575 cancel the copy using an OFFLOAD_CANCEL. When the server completes 576 the copy, the server performs a callback to the client and reports 577 the results. 579 Client Server 580 + + 581 | | 582 |--- OPEN ---------------------------->| Client opens 583 |<------------------------------------/| the source file 584 | | 585 |--- OPEN ---------------------------->| Client opens 586 |<------------------------------------/| the destination file 587 | | 588 |--- COPY ---------------------------->| Client requests 589 |<------------------------------------/| a file copy 590 | | 591 | | 592 |--- OFFLOAD_STATUS ------------------>| Client may poll 593 |<------------------------------------/| for status 594 | | 595 | . | Multiple OFFLOAD_STATUS 596 | . | operations may be sent. 597 | . | 598 | | 599 |<-- CB_OFFLOAD -----------------------| Server reports results 600 |\------------------------------------>| 601 | | 602 |--- CLOSE --------------------------->| Client closes 603 |<------------------------------------/| the destination file 604 | | 605 |--- CLOSE --------------------------->| Client closes 606 |<------------------------------------/| the source file 607 | | 608 | | 610 Figure 2: An asynchronous intra-server copy. 612 4.6. Inter-Server Copy 614 A copy may also be performed between two servers. The copy protocol 615 is designed to accommodate a variety of network topologies. As shown 616 in Figure 3, the client and servers may be connected by multiple 617 networks. In particular, the servers may be connected by a 618 specialized, high speed network (network 192.0.2.0/24 in the diagram) 619 that does not include the client. The protocol allows the client to 620 setup the copy between the servers (over network 203.0.113.0/24 in 621 the diagram) and for the servers to communicate on the high speed 622 network if they choose to do so. 624 192.0.2.0/24 625 +-------------------------------------+ 626 | | 627 | | 628 | 192.0.2.18 | 192.0.2.56 629 +-------+------+ +------+------+ 630 | Source | | Destination | 631 +-------+------+ +------+------+ 632 | 203.0.113.18 | 203.0.113.56 633 | | 634 | | 635 | 203.0.113.0/24 | 636 +------------------+------------------+ 637 | 638 | 639 | 203.0.113.243 640 +-----+-----+ 641 | Client | 642 +-----------+ 644 Figure 3: An example inter-server network topology. 646 For an inter-server copy, the client notifies the source server that 647 a file will be copied by the destination server using a COPY_NOTIFY 648 operation. The client then initiates the copy by sending the COPY 649 operation to the destination server. The destination server may 650 perform the copy synchronously or asynchronously. 652 A synchronous inter-server copy is shown in Figure 4. In this case, 653 the destination server chooses to perform the copy before responding 654 to the client's COPY request. 656 An asynchronous copy is shown in Figure 5. In this case, the 657 destination server chooses to respond to the client's COPY request 658 immediately and then perform the copy asynchronously. 660 Client Source Destination 661 + + + 662 | | | 663 |--- OPEN --->| | Returns os1 664 |<------------------/| | 665 | | | 666 |--- COPY_NOTIFY --->| | 667 |<------------------/| | 668 | | | 669 |--- OPEN ---------------------------->| Returns os2 670 |<------------------------------------/| 671 | | | 672 |--- COPY ---------------------------->| 673 | | | 674 | | | 675 | |<----- read -----| 676 | |\--------------->| 677 | | | 678 | | . | Multiple reads may 679 | | . | be necessary 680 | | . | 681 | | | 682 | | | 683 |<------------------------------------/| Destination replies 684 | | | to COPY 685 | | | 686 |--- CLOSE --------------------------->| Release open state 687 |<------------------------------------/| 688 | | | 689 |--- CLOSE --->| | Release open state 690 |<------------------/| | 692 Figure 4: A synchronous inter-server copy. 694 Client Source Destination 695 + + + 696 | | | 697 |--- OPEN --->| | Returns os1 698 |<------------------/| | 699 | | | 700 |--- LOCK --->| | Optional, could be done 701 |<------------------/| | with a share lock 702 | | | 703 |--- COPY_NOTIFY --->| | Need to pass in 704 |<------------------/| | os1 or lock state 705 | | | 706 | | | 707 | | | 708 |--- OPEN ---------------------------->| Returns os2 709 |<------------------------------------/| 710 | | | 711 |--- LOCK ---------------------------->| Optional ... 712 |<------------------------------------/| 713 | | | 714 |--- COPY ---------------------------->| Need to pass in 715 |<------------------------------------/| os2 or lock state 716 | | | 717 | | | 718 | |<----- read -----| 719 | |\--------------->| 720 | | | 721 | | . | Multiple reads may 722 | | . | be necessary 723 | | . | 724 | | | 725 | | | 726 |--- OFFLOAD_STATUS ------------------>| Client may poll 727 |<------------------------------------/| for status 728 | | | 729 | | . | Multiple OFFLOAD_STATUS 730 | | . | operations may be sent 731 | | . | 732 | | | 733 | | | 734 | | | 735 |<-- CB_OFFLOAD -----------------------| Destination reports 736 |\------------------------------------>| results 737 | | | 738 |--- LOCKU --------------------------->| Only if LOCK was done 739 |<------------------------------------/| 740 | | | 741 |--- CLOSE --------------------------->| Release open state 742 |<------------------------------------/| 743 | | | 744 |--- LOCKU --->| | Only if LOCK was done 745 |<------------------/| | 746 | | | 747 |--- CLOSE --->| | Release open state 748 |<------------------/| | 749 | | | 751 Figure 5: An asynchronous inter-server copy. 753 4.7. Server-to-Server Copy Protocol 755 The choice of what protocol to use in an inter-server copy is 756 ultimately the destination server's decision. However, the 757 destination server has to be cognizant that it is working on behalf 758 of the client. 760 4.7.1. Considerations on Selecting a Copy Protocol 762 The client can have requirements over both the size of transactions 763 and error recovery semantics. It may want to split the copy up such 764 that each chunk is synchronously transferred. It may want the copy 765 protocol to copy the bytes in consecutive order such that upon an 766 error, the client can restart the copy at the last known good offset. 767 If the destination server cannot meet these requirements, the client 768 may prefer the traditional copy mechanism such that it can meet those 769 requirements. 771 4.7.2. Using NFSv4.x as the Copy Protocol 773 The destination server MAY use standard NFSv4.x (where x >= 1) 774 operations to read the data from the source server. If NFSv4.x is 775 used for the server-to-server copy protocol, the destination server 776 can use the source filehandle and ca_src_stateid provided in the COPY 777 request with standard NFSv4.x operations to read data from the source 778 server. 780 4.7.3. Using an Alternative Copy Protocol 782 In a homogeneous environment, the source and destination servers 783 might be able to perform the file copy extremely efficiently using 784 specialized protocols. For example the source and destination 785 servers might be two nodes sharing a common file system format for 786 the source and destination file systems. Thus the source and 787 destination are in an ideal position to efficiently render the image 788 of the source file to the destination file by replicating the file 789 system formats at the block level. Another possibility is that the 790 source and destination might be two nodes sharing a common storage 791 area network, and thus there is no need to copy any data at all, and 792 instead ownership of the file and its contents might simply be re- 793 assigned to the destination. To allow for these possibilities, the 794 destination server is allowed to use a server-to-server copy protocol 795 of its choice. 797 In a heterogeneous environment, using a protocol other than NFSv4.x 798 (e.g., HTTP [RFC2616] or FTP [RFC959]) presents some challenges. In 799 particular, the destination server is presented with the challenge of 800 accessing the source file given only an NFSv4.x filehandle. 802 One option for protocols that identify source files with path names 803 is to use an ASCII hexadecimal representation of the source 804 filehandle as the file name. 806 Another option for the source server is to use URLs to direct the 807 destination server to a specialized service. For example, the 808 response to COPY_NOTIFY could include the URL ftp:// 809 s1.example.com:9999/_FH/0x12345, where 0x12345 is the ASCII 810 hexadecimal representation of the source filehandle. When the 811 destination server receives the source server's URL, it would use 812 "_FH/0x12345" as the file name to pass to the FTP server listening on 813 port 9999 of s1.example.com. On port 9999 there would be a special 814 instance of the FTP service that understands how to convert NFS 815 filehandles to an open file descriptor (in many operating systems, 816 this would require a new system call, one which is the inverse of the 817 makefh() function that the pre-NFSv4 MOUNT service needs). 819 Authenticating and identifying the destination server to the source 820 server is also a challenge. Recommendations for how to accomplish 821 this are given in Section 4.10.1.3. 823 4.8. netloc4 - Network Locations 825 The server-side copy operations specify network locations using the 826 netloc4 data type shown below: 828 enum netloc_type4 { 829 NL4_NAME = 0, 830 NL4_URL = 1, 831 NL4_NETADDR = 2 832 }; 833 union netloc4 switch (netloc_type4 nl_type) { 834 case NL4_NAME: utf8str_cis nl_name; 835 case NL4_URL: utf8str_cis nl_url; 836 case NL4_NETADDR: netaddr4 nl_addr; 837 }; 839 If the netloc4 is of type NL4_NAME, the nl_name field MUST be 840 specified as a UTF-8 string. The nl_name is expected to be resolved 841 to a network address via DNS, LDAP, NIS, /etc/hosts, or some other 842 means. If the netloc4 is of type NL4_URL, a server URL [RFC3986] 843 appropriate for the server-to-server copy operation is specified as a 844 UTF-8 string. If the netloc4 is of type NL4_NETADDR, the nl_addr 845 field MUST contain a valid netaddr4 as defined in Section 3.3.9 of 846 [RFC5661]. 848 When netloc4 values are used for an inter-server copy as shown in 849 Figure 3, their values may be evaluated on the source server, 850 destination server, and client. The network environment in which 851 these systems operate should be configured so that the netloc4 values 852 are interpreted as intended on each system. 854 4.9. Copy Offload Stateids 856 A server may perform a copy offload operation asynchronously. An 857 asynchronous copy is tracked using a copy offload stateid. Copy 858 offload stateids are included in the COPY, OFFLOAD_CANCEL, 859 OFFLOAD_STATUS, and CB_OFFLOAD operations. 861 A copy offload stateid will be valid until either (A) the client or 862 server restarts or (B) the client returns the resource by issuing a 863 OFFLOAD_CANCEL operation or the client replies to a CB_OFFLOAD 864 operation. 866 A copy offload stateid's seqid MUST NOT be 0. In the context of a 867 copy offload operation, it is ambiguous to indicate the most recent 868 copy offload operation using a stateid with seqid of 0. Therefore a 869 copy offload stateid with seqid of 0 MUST be considered invalid. 871 4.10. Security Considerations 873 The security considerations pertaining to NFSv4.1 [RFC5661] apply to 874 this section. And as such, the standard security mechanisms used by 875 the protocol can be used to secure the server-to-server operations. 877 NFSv4 clients and servers supporting the inter-server copy operations 878 described in this chapter are REQUIRED to implement the mechanism 879 described in Section 4.10.1.1, and to support rejecting COPY_NOTIFY 880 requests that do not use RPCSEC_GSS with privacy. If the server-to- 881 server copy protocol is ONC RPC based, the servers are also REQUIRED 882 to implement [rpcsec_gssv3] including the RPCSEC_GSSv3 copy_to_auth, 883 copy_from_auth, and copy_confirm_auth structured privileges. This 884 requirement to implement is not a requirement to use; for example, a 885 server may depending on configuration also allow COPY_NOTIFY requests 886 that use only AUTH_SYS. 888 4.10.1. Inter-Server Copy Security 890 4.10.1.1. Inter-Server Copy via ONC RPC with RPCSEC_GSSv3 892 When the client sends a COPY_NOTIFY to the source server to expect 893 the destination to attempt to copy data from the source server, it is 894 expected that this copy is being done on behalf of the principal 895 (called the "user principal") that sent the RPC request that encloses 896 the COMPOUND procedure that contains the COPY_NOTIFY operation. The 897 user principal is identified by the RPC credentials. A mechanism 898 that allows the user principal to authorize the destination server to 899 perform the copy, that lets the source server properly authenticate 900 the destination's copy, and does not allow the destination server to 901 exceed this authorization, is necessary. 903 An approach that sends delegated credentials of the client's user 904 principal to the destination server is not used for the following 905 reason. If the client's user delegated its credentials, the 906 destination would authenticate as the user principal. If the 907 destination were using the NFSv4 protocol to perform the copy, then 908 the source server would authenticate the destination server as the 909 user principal, and the file copy would securely proceed. However, 910 this approach would allow the destination server to copy other files. 911 The user principal would have to trust the destination server to not 912 do so. This is counter to the requirements, and therefore is not 913 considered. 915 Instead, a feature of the RPCSEC_GSSv3 [rpcsec_gssv3] protocol can be 916 used: RPC application defined structured privilege assertion. This 917 features allow the destination server to authenticate to the source 918 server as acting on behalf of the user principal, and to authorize 919 the destination server to perform READs of the file to be copied from 920 the source on behalf of the user principal. Once the copy is 921 complete, the client can destroy the RPCSEC_GSSv3 handles to end the 922 authorization of both the source and destination servers to copy. 924 We define three RPCSEC_GSSv3 structured privilege assertions that 925 work in tandem to authorize the copy: 927 copy_from_auth: A user principal is authorizing a source principal 928 ("nfs@") to allow a destination principal 929 ("nfs@") to setup the copy_confirm_auth privilege 930 required to copy a file from the source to the destination on 931 behalf of the user principal. This privilege is established on 932 the source server before the user principal sends a COPY_NOTIFY 933 operation to the source server, and the resultant RPCSEC_GSSv3 934 context is used to secure the COPY_NOTIFY operation. 936 struct copy_from_auth_priv { 937 secret4 cfap_shared_secret; 938 netloc4 cfap_destination; 939 /* the NFSv4 user name that the user principal maps to */ 940 utf8str_mixed cfap_username; 941 }; 943 cfp_shared_secret is an automatically generated random number 944 secret value. 946 copy_to_auth: A user principal is authorizing a destination 947 principal ("nfs@") to setup a copy_confirm_auth 948 privilege with a source principal ("nfs@") to allow it to 949 copy a file from the source to the destination on behalf of the 950 user principal. This privilege is established on the destination 951 server before the user principal sends a COPY operation to the 952 destination server, and the resultant RPCSEC_GSSv3 context is used 953 to secure the COPY operation. 955 struct copy_to_auth_priv { 956 /* equal to cfap_shared_secret */ 957 secret4 ctap_shared_secret; 958 netloc4 ctap_source<>; 959 /* the NFSv4 user name that the user principal maps to */ 960 utf8str_mixed ctap_username; 961 }; 963 ctap_shared_secret is the automatically generated secret value 964 used to establish the copy_from_auth privilege with the source 965 principal. See Section 4.10.1.1.1. 967 copy_confirm_auth: A destination principal ("nfs@") is 968 confirming with the source principal ("nfs@") that it is 969 authorized to copy data from the source. This privilege is 970 established on the destination server before the file is copied 971 from the source to the destination. The resultant RPCSEC_GSSv3 972 context is used to secure the READ operations from the source to 973 the destination server. 975 struct copy_confirm_auth_priv { 976 /* equal to GSS_GetMIC() of cfap_shared_secret */ 977 opaque ccap_shared_secret_mic<>; 978 /* the NFSv4 user name that the user principal maps to */ 979 utf8str_mixed ccap_username; 980 }; 982 4.10.1.1.1. Establishing a Security Context 984 When the user principal wants to COPY a file between two servers, if 985 it has not established copy_from_auth and copy_to_auth privileges on 986 the servers, it establishes them: 988 o As noted in [rpcsec_gssv3] the client uses an existing 989 RPCSEC_GSSv3 context termed the "parent" handle to establish and 990 protect RPCSEC_GSSv3 structured privilege assertion exchanges. 991 The copy_from_auth privilege will use the context established 992 between the user principal and the source server used to OPEN the 993 source file as the RPCSEC_GSSv3 parent handle. The copy_to_auth 994 privilege will use the context established between the user 995 principal and the destination server used to OPEN the destination 996 file as the RPCSEC_GSSv3 parent handle. 998 o A random number is generated to use as a secret to be shared 999 between the two servers. This shared secret will be placed in the 1000 cfap_shared_secret and ctap_shared_secret fields of the 1001 appropriate privilege data types, copy_from_auth_priv and 1002 copy_to_auth_priv. Because of this shared_secret the 1003 RPCSEC_GSS3_CREATE control messages for copy_from_auth and 1004 copy_to_auth MUST use a QOP of rpc_gss_svc_privacy. 1006 o An instance of copy_from_auth_priv is filled in with the shared 1007 secret, the destination server, and the NFSv4 user id of the user 1008 principal and is placed in rpc_gss3_create_args 1009 assertions[0].assertion.privs.privilege. The string 1010 "copy_from_auth" is placed in assertions[0].assertion.privs.name. 1011 The source server unwraps the rpc_gss_svc_privacy 1012 RPCSEC_GSS3_CREATE payload and verifies that the NFSv4 user id 1013 being asserted matches the source server's mapping of the user 1014 principal. If it does, the privilege is established on the source 1015 server as: <"copy_from_auth", user id, destination>. The field 1016 "handle" in a successful reply is the RPCSEC_GSSv3 copy_from_auth 1017 "child" handle that the client will use on COPY_NOTIFY requests to 1018 the source server. 1020 o An instance of copy_to_auth_priv is filled in with the shared 1021 secret, the cnr_source_server list returned by COPY_NOTIFY, and 1022 the NFSv4 user id of the user principal. The copy_to_auth_priv 1023 instance is placed in rpc_gss3_create_args 1024 assertions[0].assertion.privs.privilege. The string 1025 "copy_to_auth" is placed in assertions[0].assertion.privs.name. 1026 The destination server unwraps the rpc_gss_svc_privacy 1027 RPCSEC_GSS3_CREATE payload and verifies that the NFSv4 user id 1028 being asserted matches the destination server's mapping of the 1029 user principal. If it does, the privilege is established on the 1030 destination server as: <"copy_to_auth", user id, source list>. 1031 The field "handle" in a successful reply is the RPCSEC_GSSv3 1032 copy_to_auth "child" handle that the client will use on COPY 1033 requests to the destination server involving the source server. 1035 As noted in [rpcsec_gssv3] Section 2.3.1 "Create Request", both the 1036 client and the source server should associate the RPCSEC_GSSv3 1037 "child" handle with the parent RPCSEC_GSSv3 handle used to create the 1038 RPCSEC_GSSv3 child handle. 1040 4.10.1.1.2. Starting a Secure Inter-Server Copy 1042 When the client sends a COPY_NOTIFY request to the source server, it 1043 uses the privileged "copy_from_auth" RPCSEC_GSSv3 handle. 1044 cna_destination_server in COPY_NOTIFY MUST be the same as 1045 cfap_destination specified in copy_from_auth_priv. Otherwise, 1046 COPY_NOTIFY will fail with NFS4ERR_ACCESS. The source server 1047 verifies that the privilege <"copy_from_auth", user id, destination> 1048 exists, and annotates it with the source filehandle, if the user 1049 principal has read access to the source file, and if administrative 1050 policies give the user principal and the NFS client read access to 1051 the source file (i.e., if the ACCESS operation would grant read 1052 access). Otherwise, COPY_NOTIFY will fail with NFS4ERR_ACCESS. 1054 When the client sends a COPY request to the destination server, it 1055 uses the privileged "copy_to_auth" RPCSEC_GSSv3 handle. 1056 ca_source_server list in COPY MUST be the same as ctap_source list 1057 specified in copy_to_auth_priv. Otherwise, COPY will fail with 1058 NFS4ERR_ACCESS. The destination server verifies that the privilege 1059 <"copy_to_auth", user id, source list> exists, and annotates it with 1060 the source and destination filehandles. If the COPY returns a 1061 wr_callback_id, then this is an asynchronous copy and the 1062 wr_callback_id must also must be annotated to the copy_to_auth 1063 privilege. If the client has failed to establish the "copy_to_auth" 1064 privilege it will reject the request with NFS4ERR_PARTNER_NO_AUTH. 1066 If either the COPY_NOTIFY, or the COPY operations fail, the 1067 associated "copy_from_auth" and "copy_to_auth" RPCSEC_GSSv3 handles 1068 MUST be destroyed. 1070 4.10.1.1.3. Securing ONC RPC Server-to-Server Copy Protocols 1072 After a destination server has a "copy_to_auth" privilege established 1073 on it, and it receives a COPY request, if it knows it will use an ONC 1074 RPC protocol to copy data, it will establish a "copy_confirm_auth" 1075 privilege on the source server prior to responding to the COPY 1076 operation as follows: 1078 o Before establishing an RPCSEC_GSSv3 context, a parent context 1079 needs to exist between nfs@ as the initiator 1080 principal, and nfs@ as the target principal. If NFS is to 1081 be used as the copy protocol, this means that the destination 1082 server must mount the source server using RPCSEC_GSSv3. 1084 o An instance of copy_confirm_auth_priv is filled in with 1085 information from the established "copy_to_auth" privilege. The 1086 value of the field ccap_shared_secret_mic is a GSS_GetMIC() of the 1087 ctap_shared_secret in the copy_to_auth privilege using the parent 1088 handle context. The field ccap_username is the mapping of the 1089 user principal to an NFSv4 user name ("user"@"domain" form), and 1090 MUST be the same as the ctap_username in the copy_to_auth 1091 privilege. The copy_confirm_auth_priv instance is placed in 1092 rpc_gss3_create_args assertions[0].assertion.privs.privilege. The 1093 string "copy_confirm_auth" is placed in 1094 assertions[0].assertion.privs.name. 1096 o The RPCSEC_GSS3_CREATE copy_from_auth message is sent to the 1097 source server with a QOP of rpc_gss_svc_privacy. The source 1098 server unwraps the rpc_gss_svc_privacy RPCSEC_GSS3_CREATE payload 1099 and verifies the cap_shared_secret_mic by calling GSS_VerifyMIC() 1100 using the parent context on the cfap_shared_secret from the 1101 established "copy_from_auth" privilege, and verifies the that the 1102 ccap_username equals the cfap_username. 1104 o If all verification succeeds, the "copy_confirm_auth" privilege is 1105 established on the source server as < "copy_confirm_auth", 1106 shared_secret_mic, user id> Because the shared secret has been 1107 verified, the resultant copy_confirm_auth RPCSEC_GSSv3 child 1108 handle is noted to be acting on behalf of the user principal. 1110 o If the source server fails to verify the copy_from_auth privilege 1111 the COPY operation will be rejected with NFS4ERR_PARTNER_NO_AUTH, 1112 causing in turn the client to destroy the associated 1113 copy_from_auth and copy_to_auth RPCSEC_GSSv3 structured privilege 1114 assertion handles. 1116 o All subsequent ONC RPC READ requests sent from the destination to 1117 copy data from the source to the destination will use the 1118 RPCSEC_GSSv3 copy_confirm_auth child handle. 1120 Note that the use of the "copy_confirm_auth" privilege accomplishes 1121 the following: 1123 o If a protocol like NFS is being used, with export policies, export 1124 policies can be overridden in case the destination server as-an- 1125 NFS-client is not authorized 1127 o Manual configuration to allow a copy relationship between the 1128 source and destination is not needed. 1130 4.10.1.1.4. Maintaining a Secure Inter-Server Copy 1132 If the client determines that either the copy_from_auth or the 1133 copy_to_auth handle becomes invalid during a copy, then the copy MUST 1134 be aborted by the client sending an OFFLOAD_CANCEL to both the source 1135 and destination servers and destroying the respective copy related 1136 context handles as described in Section 4.10.1.1.5. 1138 4.10.1.1.5. Finishing or Stopping a Secure Inter-Server Copy 1140 Under normal operation, the client MUST destroy the copy_from_auth 1141 and the copy_to_auth RPCSEC_GSSv3 handle once the COPY operation 1142 returns for a synchronous inter-server copy or a CB_OFFLOAD reports 1143 the result of an asynchronous copy. 1145 The copy_confirm_auth privilege constructed from information held by 1146 the copy_to_auth privilege, and MUST be destroyed by the destination 1147 server (via an RPCSEC_GSS3_DESTROY call) when the copy_to_auth 1148 RPCSEC_GSSv3 handle is destroyed. 1150 The copy_confirm_auth RPCSEC_GSS3 handle is associated with a 1151 copy_from_auth RPCSEC_GSS3 handle on the source server via the shared 1152 secret and MUST be locally destroyed (there is no RPCSEC_GSS3_DESTROY 1153 as the source server is not the initiator) when the copy_from_auth 1154 RPCSEC_GSSv3 handle is destroyed. 1156 If the client sends an OFFLOAD_CANCEL to the source server to rescind 1157 the destination server's synchronous copy privilege, it uses the 1158 privileged "copy_from_auth" RPCSEC_GSSv3 handle and the 1159 cra_destination_server in OFFLOAD_CANCEL MUST be the same as the name 1160 of the destination server specified in copy_from_auth_priv. The 1161 source server will then delete the <"copy_from_auth", user id, 1162 destination> privilege and fail any subsequent copy requests sent 1163 under the auspices of this privilege from the destination server. 1164 The client MUST destroy both the "copy_from_auth" and the 1165 "copy_to_auth" RPCSEC_GSSv3 handles. 1167 If the client sends an OFFLOAD_STATUS to the destination server to 1168 check on the status of an asynchronous copy, it uses the privileged 1169 "copy_to_auth" RPCSEC_GSSv3 handle and the osa_stateid in 1170 OFFLOAD_STATUS MUST be the same as the wr_callback_id specified in 1171 the "copy_to_auth" privilege stored on the destination server. 1173 If the client sends an OFFLOAD_CANCEL to the destination server to 1174 cancel an asynchronous copy, it uses the privileged "copy_to_auth" 1175 RPCSEC_GSSv3 handle and the oaa_stateid in OFFLOAD_CANCEL MUST be the 1176 same as the wr_callback_id specified in the "copy_to_auth" privilege 1177 stored on the destination server. The destination server will then 1178 delete the <"copy_to_auth", user id, source list, nounce, nounce MIC, 1179 context handle, handle version> privilege and the associated 1180 "copy_confirm_auth" RPCSEC_GSSv3 handle. The client MUST destroy 1181 both the copy_to_auth and copy_from_auth RPCSEC_GSSv3 handles. 1183 4.10.1.2. Inter-Server Copy via ONC RPC without RPCSEC_GSS 1185 ONC RPC security flavors other than RPCSEC_GSS MAY be used with the 1186 server-side copy offload operations described in this chapter. In 1187 particular, host-based ONC RPC security flavors such as AUTH_NONE and 1188 AUTH_SYS MAY be used. If a host-based security flavor is used, a 1189 minimal level of protection for the server-to-server copy protocol is 1190 possible. 1192 In the absence of a strong security mechanism designed for the 1193 purpose, the challenge is how the source server and destination 1194 server identify themselves to each other, especially in the presence 1195 of multi-homed source and destination servers. In a multi-homed 1196 environment, the destination server might not contact the source 1197 server from the same network address specified by the client in the 1198 COPY_NOTIFY. This can be overcome using the procedure described 1199 below. 1201 When the client sends the source server the COPY_NOTIFY operation, 1202 the source server may reply to the client with a list of target 1203 addresses, names, and/or URLs and assign them to the unique 1204 quadruple: . If the destination uses one of these target netlocs to contact 1206 the source server, the source server will be able to uniquely 1207 identify the destination server, even if the destination server does 1208 not connect from the address specified by the client in COPY_NOTIFY. 1209 The level of assurance in this identification depends on the 1210 unpredictability, strength and secrecy of the random number. 1212 For example, suppose the network topology is as shown in Figure 3. 1213 If the source filehandle is 0x12345, the source server may respond to 1214 a COPY_NOTIFY for destination 203.0.113.56 with the URLs: 1216 nfs://203.0.113.18//_COPY/FvhH1OKbu8VrxvV1erdjvR7N/203.0.113.56/ 1217 _FH/0x12345 1219 nfs://192.0.2.18//_COPY/FvhH1OKbu8VrxvV1erdjvR7N/203.0.113.56/_FH/ 1220 0x12345 1222 The name component after _COPY is 24 characters of base 64, more than 1223 enough to encode a 128 bit random number. 1225 The client will then send these URLs to the destination server in the 1226 COPY operation. Suppose that the 192.0.2.0/24 network is a high 1227 speed network and the destination server decides to transfer the file 1228 over this network. If the destination contacts the source server 1229 from 192.0.2.56 over this network using NFSv4.1, it does the 1230 following: 1232 COMPOUND { PUTROOTFH, LOOKUP "_COPY" ; LOOKUP 1233 "FvhH1OKbu8VrxvV1erdjvR7N" ; LOOKUP "203.0.113.56"; LOOKUP "_FH" ; 1234 OPEN "0x12345" ; GETFH } 1236 Provided that the random number is unpredictable and has been kept 1237 secret by the parties involved, the source server will therefore know 1238 that these NFSv4.x operations are being issued by the destination 1239 server identified in the COPY_NOTIFY. This random number technique 1240 only provides initial authentication of the destination server, and 1241 cannot defend against man-in-the-middle attacks after authentication 1242 or an eavesdropper that observes the random number on the wire. 1243 Other secure communication techniques (e.g., IPsec) are necessary to 1244 block these attacks. 1246 Servers SHOULD reject COPY_NOTIFY requests that do not use RPCSEC_GSS 1247 with privacy, thus ensuring the URL in the COPY_NOTIFY reply is 1248 encrypted. For the same reason, clients SHOULD send COPY requests to 1249 the destination using RPCSEC_GSS with privacy. 1251 4.10.1.3. Inter-Server Copy without ONC RPC 1253 The same techniques as Section 4.10.1.2, using unique URLs for each 1254 destination server, can be used for other protocols (e.g., HTTP 1255 [RFC2616] and FTP [RFC959]) as well. 1257 5. Support for Application IO Hints 1259 Applications can issue client I/O hints via posix_fadvise() 1260 [posix_fadvise] to the NFS client. While this can help the NFS 1261 client optimize I/O and caching for a file, it does not allow the NFS 1262 server and its exported file system to do likewise. We add an 1263 IO_ADVISE procedure (Section 15.5) to communicate the client file 1264 access patterns to the NFS server. The NFS server upon receiving a 1265 IO_ADVISE operation MAY choose to alter its I/O and caching behavior, 1266 but is under no obligation to do so. 1268 Application specific NFS clients such as those used by hypervisors 1269 and databases can also leverage application hints to communicate 1270 their specialized requirements. 1272 6. Sparse Files 1274 6.1. Introduction 1276 A sparse file is a common way of representing a large file without 1277 having to utilize all of the disk space for it. Consequently, a 1278 sparse file uses less physical space than its size indicates. This 1279 means the file contains 'holes', byte ranges within the file that 1280 contain no data. Most modern file systems support sparse files, 1281 including most UNIX file systems and NTFS, but notably not Apple's 1282 HFS+. Common examples of sparse files include Virtual Machine (VM) 1283 OS/disk images, database files, log files, and even checkpoint 1284 recovery files most commonly used by the HPC community. 1286 In addition many modern file systems support the concept of 1287 'unwritten' or 'uninitialized' blocks, which have uninitialized space 1288 allocated to them on disk, but will return zeros until data is 1289 written to them. Such functionality is already present in the data 1290 model of the pNFS Block/Volume Layout (see [RFC5663]). Uninitialized 1291 blocks can thought as holes inside a space reservation window. 1293 If an application reads a hole in a sparse file, the file system must 1294 return all zeros to the application. For local data access there is 1295 little penalty, but with NFS these zeroes must be transferred back to 1296 the client. If an application uses the NFS client to read data into 1297 memory, this wastes time and bandwidth as the application waits for 1298 the zeroes to be transferred. 1300 A sparse file is typically created by initializing the file to be all 1301 zeros - nothing is written to the data in the file, instead the hole 1302 is recorded in the metadata for the file. So a 8G disk image might 1303 be represented initially by a couple hundred bits in the inode and 1304 nothing on the disk. If the VM then writes 100M to a file in the 1305 middle of the image, there would now be two holes represented in the 1306 metadata and 100M in the data. 1308 No new operation is needed to allow the creation of a sparsely 1309 populated file, when a file is created and a write occurs past the 1310 current size of the file, the non-allocated region will either be a 1311 hole or filled with zeros. The choice of behavior is dictated by the 1312 underlying file system and is transparent to the application. What 1313 is needed are the abilities to read sparse files and to punch holes 1314 to reinitialize the contents of a file. 1316 Two new operations DEALLOCATE (Section 15.4) and READ_PLUS 1317 (Section 15.10) are introduced. DEALLOCATE allows for the hole 1318 punching. I.e., an application might want to reset the allocation 1319 and reservation status of a range of the file. READ_PLUS supports 1320 all the features of READ but includes an extension to support sparse 1321 files. READ_PLUS is guaranteed to perform no worse than READ, and 1322 can dramatically improve performance with sparse files. READ_PLUS 1323 does not depend on pNFS protocol features, but can be used by pNFS to 1324 support sparse files. 1326 6.2. Terminology 1328 Regular file: An object of file type NF4REG or NF4NAMEDATTR. 1330 Sparse file: A Regular file that contains one or more holes. 1332 Hole: A byte range within a Sparse file that contains regions of all 1333 zeroes. A hole might or might not have space allocated or 1334 reserved to it. 1336 6.3. New Operations 1338 6.3.1. READ_PLUS 1340 READ_PLUS is a new variant of the NFSv4.1 READ operation [RFC5661]. 1341 Besides being able to support all of the data semantics of the READ 1342 operation, it can also be used by the client and server to 1343 efficiently transfer holes. Note that as the client has no a priori 1344 knowledge of whether a hole is present or not, if the client supports 1345 READ_PLUS and so does the server, then it should always use the 1346 READ_PLUS operation in preference to the READ operation. 1348 READ_PLUS extends the response with a new arm representing holes to 1349 avoid returning data for portions of the file which are initialized 1350 to zero and may or may not contain a backing store. Returning data 1351 blocks of uninitialized data wastes computational and network 1352 resources, thus reducing performance. 1354 When a client sends a READ operation, it is not prepared to accept a 1355 READ_PLUS-style response providing a compact encoding of the scope of 1356 holes. If a READ occurs on a sparse file, then the server must 1357 expand such data to be raw bytes. If a READ occurs in the middle of 1358 a hole, the server can only send back bytes starting from that 1359 offset. By contrast, if a READ_PLUS occurs in the middle of a hole, 1360 the server can send back a range which starts before the offset and 1361 extends past the range. 1363 6.3.2. DEALLOCATE 1365 DEALLOCATE can be used to hole punch, which allows the client to 1366 avoid the transfer of a repetitive pattern of zeros across the 1367 network. 1369 7. Space Reservation 1371 Applications want to be able to reserve space for a file, report the 1372 amount of actual disk space a file occupies, and free-up the backing 1373 space of a file when it is not required. 1375 One example is the posix_fallocate ([posix_fallocate]) which allows 1376 applications to ask for space reservations from the operating system, 1377 usually to provide a better file layout and reduce overhead for 1378 random or slow growing file appending workloads. 1380 Another example is space reservation for virtual disks in a 1381 hypervisor. In virtualized environments, virtual disk files are 1382 often stored on NFS mounted volumes. When a hypervisor creates a 1383 virtual disk file, it often tries to preallocate the space for the 1384 file so that there are no future allocation related errors during the 1385 operation of the virtual machine. Such errors prevent a virtual 1386 machine from continuing execution and result in downtime. 1388 Currently, in order to achieve such a guarantee, applications zero 1389 the entire file. The initial zeroing allocates the backing blocks 1390 and all subsequent writes are overwrites of already allocated blocks. 1391 This approach is not only inefficient in terms of the amount of I/O 1392 done, it is also not guaranteed to work on file systems that are log 1393 structured or deduplicated. An efficient way of guaranteeing space 1394 reservation would be beneficial to such applications. 1396 The new ALLOCATE operation (see Section 15.1) allows a client to 1397 request a guarantee that space will be available. The ALLOCATE 1398 operation guarantees that any future writes to the region it was 1399 successfully called for will not fail with NFS4ERR_NOSPC. 1401 Another useful feature is the ability to report the number of blocks 1402 that would be freed when a file is deleted. Currently, NFS reports 1403 two size attributes: 1405 size The logical file size of the file. 1407 space_used The size in bytes that the file occupies on disk 1409 While these attributes are sufficient for space accounting in 1410 traditional file systems, they prove to be inadequate in modern file 1411 systems that support block sharing. In such file systems, multiple 1412 inodes can point to a single block with a block reference count to 1413 guard against premature freeing. Having a way to tell the number of 1414 blocks that would be freed if the file was deleted would be useful to 1415 applications that wish to migrate files when a volume is low on 1416 space. 1418 Since virtual disks represent a hard drive in a virtual machine, a 1419 virtual disk can be viewed as a file system within a file. Since not 1420 all blocks within a file system are in use, there is an opportunity 1421 to reclaim blocks that are no longer in use. A call to deallocate 1422 blocks could result in better space efficiency. Lesser space MAY be 1423 consumed for backups after block deallocation. 1425 The following operations and attributes can be used to resolve these 1426 issues: 1428 space_freed This attribute specifies the space freed when a file is 1429 deleted, taking block sharing into consideration. 1431 DEALLOCATE This operation delallocates the blocks backing a region 1432 of the file. 1434 If space_used of a file is interpreted to mean the size in bytes of 1435 all disk blocks pointed to by the inode of the file, then shared 1436 blocks get double counted, over-reporting the space utilization. 1437 This also has the adverse effect that the deletion of a file with 1438 shared blocks frees up less than space_used bytes. 1440 On the other hand, if space_used is interpreted to mean the size in 1441 bytes of those disk blocks unique to the inode of the file, then 1442 shared blocks are not counted in any file, resulting in under- 1443 reporting of the space utilization. 1445 For example, two files A and B have 10 blocks each. Let 6 of these 1446 blocks be shared between them. Thus, the combined space utilized by 1447 the two files is 14 * BLOCK_SIZE bytes. In the former case, the 1448 combined space utilization of the two files would be reported as 20 * 1449 BLOCK_SIZE. However, deleting either would only result in 4 * 1450 BLOCK_SIZE being freed. Conversely, the latter interpretation would 1451 report that the space utilization is only 8 * BLOCK_SIZE. 1453 Adding another size attribute, space_freed (see Section 12.2.3), is 1454 helpful in solving this problem. space_freed is the number of blocks 1455 that are allocated to the given file that would be freed on its 1456 deletion. In the example, both A and B would report space_freed as 4 1457 * BLOCK_SIZE and space_used as 10 * BLOCK_SIZE. If A is deleted, B 1458 will report space_freed as 10 * BLOCK_SIZE as the deletion of B would 1459 result in the deallocation of all 10 blocks. 1461 The addition of these attributes does not solve the problem of space 1462 being over-reported. However, over-reporting is better than under- 1463 reporting. 1465 8. Application Data Block Support 1467 At the OS level, files are contained on disk blocks. Applications 1468 are also free to impose structure on the data contained in a file and 1469 we can define an Application Data Block (ADB) to be such a structure. 1471 From the application's viewpoint, it only wants to handle ADBs and 1472 not raw bytes (see [Strohm11]). An ADB is typically comprised of two 1473 sections: header and data. The header describes the characteristics 1474 of the block and can provide a means to detect corruption in the data 1475 payload. The data section is typically initialized to all zeros. 1477 The format of the header is application specific, but there are two 1478 main components typically encountered: 1480 1. An Application Data Block Number (ADBN) which allows the 1481 application to determine which data block is being referenced. 1482 This is useful when the client is not storing the blocks in 1483 contiguous memory, i.e., a logical block number. 1485 2. Fields to describe the state of the ADB and a means to detect 1486 block corruption. For both pieces of data, a useful property is 1487 that allowed values be unique in that if passed across the 1488 network, corruption due to translation between big and little 1489 endian architectures are detectable. For example, 0xF0DEDEF0 has 1490 the same bit pattern in both architectures. 1492 Applications already impose structures on files [Strohm11] and detect 1493 corruption in data blocks [Ashdown08]. What they are not able to do 1494 is efficiently transfer and store ADBs. To initialize a file with 1495 ADBs, the client must send each full ADB to the server and that must 1496 be stored on the server. 1498 In this section, we define a framework for transferring the ADB from 1499 client to server and present one approach to detecting corruption in 1500 a given ADB implementation. 1502 8.1. Generic Framework 1504 We want the representation of the ADB to be flexible enough to 1505 support many different applications. The most basic approach is no 1506 imposition of a block at all, which means we are working with the raw 1507 bytes. Such an approach would be useful for storing holes, punching 1508 holes, etc. In more complex deployments, a server might be 1509 supporting multiple applications, each with their own definition of 1510 the ADB. One might store the ADBN at the start of the block and then 1511 have a guard pattern to detect corruption [McDougall07]. The next 1512 might store the ADBN at an offset of 100 bytes within the block and 1513 have no guard pattern at all, i.e., existing applications might 1514 already have well defined formats for their data blocks. 1516 The guard pattern can be used to represent the state of the block, to 1517 protect against corruption, or both. Again, it needs to be able to 1518 be placed anywhere within the ADB. 1520 We need to be able to represent the starting offset of the block and 1521 the size of the block. Note that nothing prevents the application 1522 from defining different sized blocks in a file. 1524 8.1.1. Data Block Representation 1526 struct app_data_block4 { 1527 offset4 adb_offset; 1528 length4 adb_block_size; 1529 length4 adb_block_count; 1530 length4 adb_reloff_blocknum; 1531 count4 adb_block_num; 1532 length4 adb_reloff_pattern; 1533 opaque adb_pattern<>; 1534 }; 1536 The app_data_block4 structure captures the abstraction presented for 1537 the ADB. The additional fields present are to allow the transmission 1538 of adb_block_count ADBs at one time. We also use adb_block_num to 1539 convey the ADBN of the first block in the sequence. Each ADB will 1540 contain the same adb_pattern string. 1542 As both adb_block_num and adb_pattern are optional, if either 1543 adb_reloff_pattern or adb_reloff_blocknum is set to NFS4_UINT64_MAX, 1544 then the corresponding field is not set in any of the ADB. 1546 8.2. An Example of Detecting Corruption 1548 In this section, we define an ADB format in which corruption can be 1549 detected. Note that this is just one possible format and means to 1550 detect corruption. 1552 Consider a very basic implementation of an operating system's disk 1553 blocks. A block is either data or it is an indirect block which 1554 allows for files to be larger than one block. It is desired to be 1555 able to initialize a block. Lastly, to quickly unlink a file, a 1556 block can be marked invalid. The contents remain intact - which 1557 would enable this OS application to undelete a file. 1559 The application defines 4k sized data blocks, with an 8 byte block 1560 counter occurring at offset 0 in the block, and with the guard 1561 pattern occurring at offset 8 inside the block. Furthermore, the 1562 guard pattern can take one of four states: 1564 0xfeedface - This is the FREE state and indicates that the ADB 1565 format has been applied. 1567 0xcafedead - This is the DATA state and indicates that real data 1568 has been written to this block. 1570 0xe4e5c001 - This is the INDIRECT state and indicates that the 1571 block contains block counter numbers that are chained off of this 1572 block. 1574 0xba1ed4a3 - This is the INVALID state and indicates that the block 1575 contains data whose contents are garbage. 1577 Finally, it also defines an 8 byte checksum [Baira08] starting at 1578 byte 16 which applies to the remaining contents of the block. If the 1579 state is FREE, then that checksum is trivially zero. As such, the 1580 application has no need to transfer the checksum implicitly inside 1581 the ADB - it need not make the transfer layer aware of the fact that 1582 there is a checksum (see [Ashdown08] for an example of checksums used 1583 to detect corruption in application data blocks). 1585 Corruption in each ADB can thus be detected: 1587 o If the guard pattern is anything other than one of the allowed 1588 values, including all zeros. 1590 o If the guard pattern is FREE and any other byte in the remainder 1591 of the ADB is anything other than zero. 1593 o If the guard pattern is anything other than FREE, then if the 1594 stored checksum does not match the computed checksum. 1596 o If the guard pattern is INDIRECT and one of the stored indirect 1597 block numbers has a value greater than the number of ADBs in the 1598 file. 1600 o If the guard pattern is INDIRECT and one of the stored indirect 1601 block numbers is a duplicate of another stored indirect block 1602 number. 1604 As can be seen, the application can detect errors based on the 1605 combination of the guard pattern state and the checksum. But also, 1606 the application can detect corruption based on the state and the 1607 contents of the ADB. This last point is important in validating the 1608 minimum amount of data we incorporated into our generic framework. 1609 I.e., the guard pattern is sufficient in allowing applications to 1610 design their own corruption detection. 1612 Finally, it is important to note that none of these corruption checks 1613 occur in the transport layer. The server and client components are 1614 totally unaware of the file format and might report everything as 1615 being transferred correctly even in the case the application detects 1616 corruption. 1618 8.3. Example of READ_PLUS 1620 The hypothetical application presented in Section 8.2 can be used to 1621 illustrate how READ_PLUS would return an array of results. A file is 1622 created and initialized with 100 4k ADBs in the FREE state with the 1623 WRITE_SAME operation (see Section 15.12): 1625 WRITE_SAME {0, 4k, 100, 0, 0, 8, 0xfeedface} 1627 Further, assume the application writes a single ADB at 16k, changing 1628 the guard pattern to 0xcafedead, we would then have in memory: 1630 0k -> (4k - 1) : 00 00 00 00 fe ed fa ce 00 00 ... 00 00 1631 4k -> (8k - 1) : 00 00 00 01 fe ed fa ce 00 00 ... 00 00 1632 8k -> (12k - 1) : 00 00 00 02 fe ed fa ce 00 00 ... 00 00 1633 12k -> (16k - 1) : 00 00 00 03 fe ed fa ce 00 00 ... 00 00 1634 16k -> (20k - 1) : 00 00 00 04 ca fe de ad 00 00 ... 00 00 1635 20k -> (24k - 1) : 00 00 00 05 fe ed fa ce 00 00 ... 00 00 1636 24k -> (28k - 1) : 00 00 00 06 fe ed fa ce 00 00 ... 00 00 1637 ... 1638 396k -> (400k - 1) : 00 00 00 63 fe ed fa ce 00 00 ... 00 00 1640 And when the client did a READ_PLUS of 64k at the start of the file, 1641 it could get back a result of data: 1643 0k -> (4k - 1) : 00 00 00 00 fe ed fa ce 00 00 ... 00 00 1644 4k -> (8k - 1) : 00 00 00 01 fe ed fa ce 00 00 ... 00 00 1645 8k -> (12k - 1) : 00 00 00 02 fe ed fa ce 00 00 ... 00 00 1646 12k -> (16k - 1) : 00 00 00 03 fe ed fa ce 00 00 ... 00 00 1647 16k -> (20k - 1) : 00 00 00 04 ca fe de ad 00 00 ... 00 00 1648 20k -> (24k - 1) : 00 00 00 05 fe ed fa ce 00 00 ... 00 00 1649 24k -> (24k - 1) : 00 00 00 06 fe ed fa ce 00 00 ... 00 00 1650 ... 1651 62k -> (64k - 1) : 00 00 00 15 fe ed fa ce 00 00 ... 00 00 1653 8.4. An Example of Zeroing Space 1655 A simpler use case for WRITE_SAME are applications that want to 1656 efficiently zero out a file, but do not want to modify space 1657 reservations. This can easily be archived by a call to WRITE_SAME 1658 without a ADB block numbers and pattern, e.g.: 1660 WRITE_SAME {0, 1k, 10000, 0, 0, 0, 0} 1662 9. Labeled NFS 1664 9.1. Introduction 1666 Access control models such as Unix permissions or Access Control 1667 Lists are commonly referred to as Discretionary Access Control (DAC) 1668 models. These systems base their access decisions on user identity 1669 and resource ownership. In contrast Mandatory Access Control (MAC) 1670 models base their access control decisions on the label on the 1671 subject (usually a process) and the object it wishes to access 1672 [RFC7204]. These labels may contain user identity information but 1673 usually contain additional information. In DAC systems users are 1674 free to specify the access rules for resources that they own. MAC 1675 models base their security decisions on a system wide policy 1676 established by an administrator or organization which the users do 1677 not have the ability to override. In this section, we add a MAC 1678 model to NFSv4.2. 1680 First we provide a method for transporting and storing security label 1681 data on NFSv4 file objects. Security labels have several semantics 1682 that are met by NFSv4 recommended attributes such as the ability to 1683 set the label value upon object creation. Access control on these 1684 attributes are done through a combination of two mechanisms. As with 1685 other recommended attributes on file objects the usual DAC checks 1686 (ACLs and permission bits) will be performed to ensure that proper 1687 file ownership is enforced. In addition a MAC system MAY be employed 1688 on the client, server, or both to enforce additional policy on what 1689 subjects may modify security label information. 1691 Second, we describe a method for the client to determine if an NFSv4 1692 file object security label has changed. A client which needs to know 1693 if a label on a file or set of files is going to change SHOULD 1694 request a delegation on each labeled file. In order to change such a 1695 security label, the server will have to recall delegations on any 1696 file affected by the label change, so informing clients of the label 1697 change. 1699 An additional useful feature would be modification to the RPC layer 1700 used by NFSv4 to allow RPC calls to carry security labels and enable 1701 full mode enforcement as described in Section 9.6.1. Such 1702 modifications are outside the scope of this document (see 1703 [rpcsec_gssv3]). 1705 9.2. Definitions 1707 Label Format Specifier (LFS): is an identifier used by the client to 1708 establish the syntactic format of the security label and the 1709 semantic meaning of its components. These specifiers exist in a 1710 registry associated with documents describing the format and 1711 semantics of the label. 1713 Label Format Registry: is the IANA registry (see [Quigley14]) 1714 containing all registered LFSes along with references to the 1715 documents that describe the syntactic format and semantics of the 1716 security label. 1718 Policy Identifier (PI): is an optional part of the definition of a 1719 Label Format Specifier which allows for clients and server to 1720 identify specific security policies. 1722 Object: is a passive resource within the system that we wish to be 1723 protected. Objects can be entities such as files, directories, 1724 pipes, sockets, and many other system resources relevant to the 1725 protection of the system state. 1727 Subject: is an active entity usually a process which is requesting 1728 access to an object. 1730 MAC-Aware: is a server which can transmit and store object labels. 1732 MAC-Functional: is a client or server which is Labeled NFS enabled. 1733 Such a system can interpret labels and apply policies based on the 1734 security system. 1736 Multi-Level Security (MLS): is a traditional model where objects are 1737 given a sensitivity level (Unclassified, Secret, Top Secret, etc) 1738 and a category set (see [BL73], [RFC1108], and [RFC2401]). 1740 9.3. MAC Security Attribute 1742 MAC models base access decisions on security attributes bound to 1743 subjects and objects. This information can range from a user 1744 identity for an identity based MAC model, sensitivity levels for 1745 Multi-level security, or a type for Type Enforcement. These models 1746 base their decisions on different criteria but the semantics of the 1747 security attribute remain the same. The semantics required by the 1748 security attributes are listed below: 1750 o MUST provide flexibility with respect to the MAC model. 1752 o MUST provide the ability to atomically set security information 1753 upon object creation. 1755 o MUST provide the ability to enforce access control decisions both 1756 on the client and the server. 1758 o MUST NOT expose an object to either the client or server name 1759 space before its security information has been bound to it. 1761 NFSv4 implements the security attribute as a recommended attribute. 1762 These attributes have a fixed format and semantics, which conflicts 1763 with the flexible nature of the security attribute. To resolve this 1764 the security attribute consists of two components. The first 1765 component is a LFS as defined in [Quigley14] to allow for 1766 interoperability between MAC mechanisms. The second component is an 1767 opaque field which is the actual security attribute data. To allow 1768 for various MAC models, NFSv4 should be used solely as a transport 1769 mechanism for the security attribute. It is the responsibility of 1770 the endpoints to consume the security attribute and make access 1771 decisions based on their respective models. In addition, creation of 1772 objects through OPEN and CREATE allows for the security attribute to 1773 be specified upon creation. By providing an atomic create and set 1774 operation for the security attribute it is possible to enforce the 1775 second and fourth requirements. The recommended attribute 1776 FATTR4_SEC_LABEL (see Section 12.2.2) will be used to satisfy this 1777 requirement. 1779 9.3.1. Delegations 1781 In the event that a security attribute is changed on the server while 1782 a client holds a delegation on the file, both the server and the 1783 client MUST follow the NFSv4.1 protocol (see Chapter 10 of [RFC5661]) 1784 with respect to attribute changes. It SHOULD flush all changes back 1785 to the server and relinquish the delegation. 1787 9.3.2. Permission Checking 1789 It is not feasible to enumerate all possible MAC models and even 1790 levels of protection within a subset of these models. This means 1791 that the NFSv4 client and servers cannot be expected to directly make 1792 access control decisions based on the security attribute. Instead 1793 NFSv4 should defer permission checking on this attribute to the host 1794 system. These checks are performed in addition to existing DAC and 1795 ACL checks outlined in the NFSv4 protocol. Section 9.6 gives a 1796 specific example of how the security attribute is handled under a 1797 particular MAC model. 1799 9.3.3. Object Creation 1801 When creating files in NFSv4 the OPEN and CREATE operations are used. 1802 One of the parameters to these operations is an fattr4 structure 1803 containing the attributes the file is to be created with. This 1804 allows NFSv4 to atomically set the security attribute of files upon 1805 creation. When a client is MAC-Functional it must always provide the 1806 initial security attribute upon file creation. In the event that the 1807 server is MAC-Functional as well, it should determine by policy 1808 whether it will accept the attribute from the client or instead make 1809 the determination itself. If the client is not MAC-Functional, then 1810 the MAC-Functional server must decide on a default label. A more in 1811 depth explanation can be found in Section 9.6. 1813 9.3.4. Existing Objects 1815 Note that under the MAC model, all objects must have labels. 1816 Therefore, if an existing server is upgraded to include Labeled NFS 1817 support, then it is the responsibility of the security system to 1818 define the behavior for existing objects. 1820 9.3.5. Label Changes 1822 Consider a guest mode system (Section 9.6.2) in which the clients 1823 enforce MAC checks and the server has only a DAC security system 1824 which stores the labels along with the file data. In this type of 1825 system, a user with the appropriate DAC credentials on a client with 1826 poorly configured or disabled MAC labeling enforcement is allowed 1827 access to the file label (and data) on the server and can change the 1828 label. 1830 Clients which need to know if a label on a file or set of files has 1831 changed SHOULD request a delegation on each labeled file so that a 1832 label change by another client will be known via the process 1833 described in Section 9.3.1 which must be followed: the delegation 1834 will be recalled, which effectively notifies the client of the 1835 change. 1837 Note that the MAC security policies on a client can be such that the 1838 client does not have access to the file unless it has a delegation. 1840 9.4. pNFS Considerations 1842 The new FATTR4_SEC_LABEL attribute is metadata information and as 1843 such the DS is not aware of the value contained on the MDS. 1844 Fortunately, the NFSv4.1 protocol [RFC5661] already has provisions 1845 for doing access level checks from the DS to the MDS. In order for 1846 the DS to validate the subject label presented by the client, it 1847 SHOULD utilize this mechanism. 1849 9.5. Discovery of Server Labeled NFS Support 1851 The server can easily determine that a client supports Labeled NFS 1852 when it queries for the FATTR4_SEC_LABEL label for an object. The 1853 client might need to discover which LFS the server supports. 1855 The following compound MUST NOT be denied by any MAC label check: 1857 PUTROOTFH, GETATTR {FATTR4_SEC_LABEL} 1859 Note that the server might have imposed a security flavor on the root 1860 that precludes such access. I.e., if the server requires kerberized 1861 access and the client presents a compound with AUTH_SYS, then the 1862 server is allowed to return NFS4ERR_WRONGSEC in this case. But if 1863 the client presents a correct security flavor, then the server MUST 1864 return the FATTR4_SEC_LABEL attribute with the supported LFS filled 1865 in. 1867 9.6. MAC Security NFS Modes of Operation 1869 A system using Labeled NFS may operate in two modes. The first mode 1870 provides the most protection and is called "full mode". In this mode 1871 both the client and server implement a MAC model allowing each end to 1872 make an access control decision. The remaining mode is called the 1873 "guest mode" and in this mode one end of the connection is not 1874 implementing a MAC model and thus offers less protection than full 1875 mode. 1877 9.6.1. Full Mode 1879 Full mode environments consist of MAC-Functional NFSv4 servers and 1880 clients and may be composed of mixed MAC models and policies. The 1881 system requires that both the client and server have an opportunity 1882 to perform an access control check based on all relevant information 1883 within the network. The file object security attribute is provided 1884 using the mechanism described in Section 9.3. 1886 Fully MAC-Functional NFSv4 servers are not possible in the absence of 1887 RPC layer modifications to support subject label transport. However, 1888 servers may make decisions based on the RPC credential information 1889 available and future specifications may provide subject label 1890 transport. 1892 9.6.1.1. Initial Labeling and Translation 1894 The ability to create a file is an action that a MAC model may wish 1895 to mediate. The client is given the responsibility to determine the 1896 initial security attribute to be placed on a file. This allows the 1897 client to make a decision as to the acceptable security attributes to 1898 create a file with before sending the request to the server. Once 1899 the server receives the creation request from the client it may 1900 choose to evaluate if the security attribute is acceptable. 1902 Security attributes on the client and server may vary based on MAC 1903 model and policy. To handle this the security attribute field has an 1904 LFS component. This component is a mechanism for the host to 1905 identify the format and meaning of the opaque portion of the security 1906 attribute. A full mode environment may contain hosts operating in 1907 several different LFSes. In this case a mechanism for translating 1908 the opaque portion of the security attribute is needed. The actual 1909 translation function will vary based on MAC model and policy and is 1910 out of the scope of this document. If a translation is unavailable 1911 for a given LFS then the request MUST be denied. Another recourse is 1912 to allow the host to provide a fallback mapping for unknown security 1913 attributes. 1915 9.6.1.2. Policy Enforcement 1917 In full mode access control decisions are made by both the clients 1918 and servers. When a client makes a request it takes the security 1919 attribute from the requesting process and makes an access control 1920 decision based on that attribute and the security attribute of the 1921 object it is trying to access. If the client denies that access an 1922 RPC call to the server is never made. If however the access is 1923 allowed the client will make a call to the NFS server. 1925 When the server receives the request from the client it uses any 1926 credential information conveyed in the RPC request and the attributes 1927 of the object the client is trying to access to make an access 1928 control decision. If the server's policy allows this access it will 1929 fulfill the client's request, otherwise it will return 1930 NFS4ERR_ACCESS. 1932 Future protocol extensions may also allow the server to factor into 1933 the decision a security label extracted from the RPC request. 1935 Implementations MAY validate security attributes supplied over the 1936 network to ensure that they are within a set of attributes permitted 1937 from a specific peer, and if not, reject them. Note that a system 1938 may permit a different set of attributes to be accepted from each 1939 peer. 1941 9.6.1.3. Limited Server 1943 A Limited Server mode (see Section 4.2 of [RFC7204]) consists of a 1944 server which is label aware, but does not enforce policies. Such a 1945 server will store and retrieve all object labels presented by 1946 clients, utilize the methods described in Section 9.3.5 to allow the 1947 clients to detect changing labels, but may not factor the label into 1948 access decisions. Instead, it will expect the clients to enforce all 1949 such access locally. 1951 9.6.2. Guest Mode 1953 Guest mode implies that either the client or the server does not 1954 handle labels. If the client is not Labeled NFS aware, then it will 1955 not offer subject labels to the server. The server is the only 1956 entity enforcing policy, and may selectively provide standard NFS 1957 services to clients based on their authentication credentials and/or 1958 associated network attributes (e.g., IP address, network interface). 1959 The level of trust and access extended to a client in this mode is 1960 configuration-specific. If the server is not Labeled NFS aware, then 1961 it will not return object labels to the client. Clients in this 1962 environment are may consist of groups implementing different MAC 1963 model policies. The system requires that all clients in the 1964 environment be responsible for access control checks. 1966 9.7. Security Considerations for Labeled NFS 1968 This entire chapter deals with security issues. 1970 Depending on the level of protection the MAC system offers there may 1971 be a requirement to tightly bind the security attribute to the data. 1973 When only one of the client or server enforces labels, it is 1974 important to realize that the other side is not enforcing MAC 1975 protections. Alternate methods might be in use to handle the lack of 1976 MAC support and care should be taken to identify and mitigate threats 1977 from possible tampering outside of these methods. 1979 An example of this is that a server that modifies READDIR or LOOKUP 1980 results based on the client's subject label might want to always 1981 construct the same subject label for a client which does not present 1982 one. This will prevent a non-Labeled NFS client from mixing entries 1983 in the directory cache. 1985 10. Sharing change attribute implementation details with NFSv4 clients 1987 Although both the NFSv4 [I-D.ietf-nfsv4-rfc3530bis] and NFSv4.1 1988 protocol [RFC5661], define the change attribute as being mandatory to 1989 implement, there is little in the way of guidance as to its 1990 construction. The only mandated constraint is that the value must 1991 change whenever the file data or metadata change. 1993 While this allows for a wide range of implementations, it also leaves 1994 the client with no way to determine which is the most recent value 1995 for the change attribute in a case where several RPC calls have been 1996 issued in parallel. In other words if two COMPOUNDs, both containing 1997 WRITE and GETATTR requests for the same file, have been issued in 1998 parallel, how does the client determine which of the two change 1999 attribute values returned in the replies to the GETATTR requests 2000 correspond to the most recent state of the file? In some cases, the 2001 only recourse may be to send another COMPOUND containing a third 2002 GETATTR that is fully serialized with the first two. 2004 NFSv4.2 avoids this kind of inefficiency by allowing the server to 2005 share details about how the change attribute is expected to evolve, 2006 so that the client may immediately determine which, out of the 2007 several change attribute values returned by the server, is the most 2008 recent. change_attr_type is defined as a new recommended attribute 2009 (see Section 12.2.1), and is per file system. 2011 11. Error Values 2013 NFS error numbers are assigned to failed operations within a Compound 2014 (COMPOUND or CB_COMPOUND) request. A Compound request contains a 2015 number of NFS operations that have their results encoded in sequence 2016 in a Compound reply. The results of successful operations will 2017 consist of an NFS4_OK status followed by the encoded results of the 2018 operation. If an NFS operation fails, an error status will be 2019 entered in the reply and the Compound request will be terminated. 2021 11.1. Error Definitions 2023 Protocol Error Definitions 2025 +-------------------------+--------+------------------+ 2026 | Error | Number | Description | 2027 +-------------------------+--------+------------------+ 2028 | NFS4ERR_BADLABEL | 10093 | Section 11.1.3.1 | 2029 | NFS4ERR_OFFLOAD_DENIED | 10091 | Section 11.1.2.1 | 2030 | NFS4ERR_OFFLOAD_NO_REQS | 10094 | Section 11.1.2.2 | 2031 | NFS4ERR_PARTNER_NO_AUTH | 10089 | Section 11.1.2.3 | 2032 | NFS4ERR_PARTNER_NOTSUPP | 10088 | Section 11.1.2.4 | 2033 | NFS4ERR_UNION_NOTSUPP | 10090 | Section 11.1.1.1 | 2034 | NFS4ERR_WRONG_LFS | 10092 | Section 11.1.3.2 | 2035 +-------------------------+--------+------------------+ 2037 Table 1 2039 11.1.1. General Errors 2041 This section deals with errors that are applicable to a broad set of 2042 different purposes. 2044 11.1.1.1. NFS4ERR_UNION_NOTSUPP (Error Code 10090) 2046 One of the arguments to the operation is a discriminated union and 2047 while the server supports the given operation, it does not support 2048 the selected arm of the discriminated union. 2050 11.1.2. Server to Server Copy Errors 2052 These errors deal with the interaction between server to server 2053 copies. 2055 11.1.2.1. NFS4ERR_OFFLOAD_DENIED (Error Code 10091) 2057 The copy offload operation is supported by both the source and the 2058 destination, but the destination is not allowing it for this file. 2059 If the client sees this error, it should fall back to the normal copy 2060 semantics. 2062 11.1.2.2. NFS4ERR_OFFLOAD_NO_REQS (Error Code 10094) 2064 The copy offload operation is supported by both the source and the 2065 destination, but the destination can not meet the client requirements 2066 for either consecutive byte copy or synchronous copy. If the client 2067 sees this error, it should either relax the requirements (if any) or 2068 fall back to the normal copy semantics. 2070 11.1.2.3. NFS4ERR_PARTNER_NO_AUTH (Error Code 10089) 2072 The source server does not authorize a server-to-server copy offload 2073 operation. This may be due to the client's failure to send the 2074 COPY_NOTIFY operation to the source server, the source server 2075 receiving a server-to-server copy offload request after the copy 2076 lease time expired, or for some other permission problem. 2078 11.1.2.4. NFS4ERR_PARTNER_NOTSUPP (Error Code 10088) 2080 The remote server does not support the server-to-server copy offload 2081 protocol. 2083 11.1.3. Labeled NFS Errors 2085 These errors are used in Labeled NFS. 2087 11.1.3.1. NFS4ERR_BADLABEL (Error Code 10093) 2089 The label specified is invalid in some manner. 2091 11.1.3.2. NFS4ERR_WRONG_LFS (Error Code 10092) 2093 The LFS specified in the subject label is not compatible with the LFS 2094 in the object label. 2096 11.2. New Operations and Their Valid Errors 2098 This section contains a table that gives the valid error returns for 2099 each new NFSv4.2 protocol operation. The error code NFS4_OK 2100 (indicating no error) is not listed but should be understood to be 2101 returnable by all new operations. The error values for all other 2102 operations are defined in Section 15.2 of [RFC5661]. 2104 Valid Error Returns for Each New Protocol Operation 2106 +----------------+--------------------------------------------------+ 2107 | Operation | Errors | 2108 +----------------+--------------------------------------------------+ 2109 | ALLOCATE | NFS4ERR_ACCESS, NFS4ERR_ADMIN_REVOKED, | 2110 | | NFS4ERR_BADXDR, NFS4ERR_BAD_STATEID, | 2111 | | NFS4ERR_DEADSESSION, NFS4ERR_DELAY, | 2112 | | NFS4ERR_DELEG_REVOKED, NFS4ERR_DQUOT, | 2113 | | NFS4ERR_EXPIRED, NFS4ERR_FBIG, | 2114 | | NFS4ERR_FHEXPIRED, NFS4ERR_GRACE, NFS4ERR_INVAL, | 2115 | | NFS4ERR_IO, NFS4ERR_ISDIR, NFS4ERR_MOVED, | 2116 | | NFS4ERR_NOFILEHANDLE, NFS4ERR_NOSPC, | 2117 | | NFS4ERR_NOTSUPP, NFS4ERR_OLD_STATEID, | 2118 | | NFS4ERR_OPENMODE, NFS4ERR_OP_NOT_IN_SESSION, | 2119 | | NFS4ERR_REP_TOO_BIG, | 2120 | | NFS4ERR_REP_TOO_BIG_TO_CACHE, | 2121 | | NFS4ERR_REQ_TOO_BIG, NFS4ERR_RETRY_UNCACHED_REP, | 2122 | | NFS4ERR_ROFS, NFS4ERR_SERVERFAULT, | 2123 | | NFS4ERR_STALE, NFS4ERR_SYMLINK, | 2124 | | NFS4ERR_TOO_MANY_OPS, NFS4ERR_WRONG_TYPE | 2125 | COPY | NFS4ERR_ACCESS, NFS4ERR_ADMIN_REVOKED, | 2126 | | NFS4ERR_BADXDR, NFS4ERR_BAD_STATEID, | 2127 | | NFS4ERR_DEADSESSION, NFS4ERR_DELAY, | 2128 | | NFS4ERR_DELEG_REVOKED, NFS4ERR_DQUOT, | 2129 | | NFS4ERR_EXPIRED, NFS4ERR_FBIG, | 2130 | | NFS4ERR_FHEXPIRED, NFS4ERR_GRACE, NFS4ERR_INVAL, | 2131 | | NFS4ERR_IO, NFS4ERR_ISDIR, NFS4ERR_LOCKED, | 2132 | | NFS4ERR_METADATA_NOTSUPP, NFS4ERR_MOVED, | 2133 | | NFS4ERR_NOFILEHANDLE, NFS4ERR_NOSPC, | 2134 | | NFS4ERR_OFFLOAD_DENIED, NFS4ERR_OLD_STATEID, | 2135 | | NFS4ERR_OPENMODE, NFS4ERR_OP_NOT_IN_SESSION, | 2136 | | NFS4ERR_PARTNER_NO_AUTH, | 2137 | | NFS4ERR_PARTNER_NOTSUPP, NFS4ERR_PNFS_IO_HOLE, | 2138 | | NFS4ERR_PNFS_NO_LAYOUT, NFS4ERR_REP_TOO_BIG, | 2139 | | NFS4ERR_REP_TOO_BIG_TO_CACHE, | 2140 | | NFS4ERR_REQ_TOO_BIG, NFS4ERR_RETRY_UNCACHED_REP, | 2141 | | NFS4ERR_ROFS, NFS4ERR_SERVERFAULT, | 2142 | | NFS4ERR_STALE, NFS4ERR_SYMLINK, | 2143 | | NFS4ERR_TOO_MANY_OPS, NFS4ERR_WRONG_TYPE | 2144 | COPY_NOTIFY | NFS4ERR_ACCESS, NFS4ERR_ADMIN_REVOKED, | 2145 | | NFS4ERR_BADXDR, NFS4ERR_BAD_STATEID, | 2146 | | NFS4ERR_DEADSESSION, NFS4ERR_DELAY, | 2147 | | NFS4ERR_DELEG_REVOKED, NFS4ERR_EXPIRED, | 2148 | | NFS4ERR_FHEXPIRED, NFS4ERR_GRACE, NFS4ERR_INVAL, | 2149 | | NFS4ERR_ISDIR, NFS4ERR_IO, NFS4ERR_LOCKED, | 2150 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 2151 | | NFS4ERR_OLD_STATEID, NFS4ERR_OPENMODE, | 2152 | | NFS4ERR_OP_NOT_IN_SESSION, NFS4ERR_PNFS_IO_HOLE, | 2153 | | NFS4ERR_PNFS_NO_LAYOUT, NFS4ERR_REP_TOO_BIG, | 2154 | | NFS4ERR_REP_TOO_BIG_TO_CACHE, | 2155 | | NFS4ERR_REQ_TOO_BIG, NFS4ERR_RETRY_UNCACHED_REP, | 2156 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE, | 2157 | | NFS4ERR_SYMLINK, NFS4ERR_TOO_MANY_OPS, | 2158 | | NFS4ERR_WRONG_TYPE | 2159 | DEALLOCATE | NFS4ERR_ACCESS, NFS4ERR_ADMIN_REVOKED, | 2160 | | NFS4ERR_BADXDR, NFS4ERR_BAD_STATEID, | 2161 | | NFS4ERR_DEADSESSION, NFS4ERR_DELAY, | 2162 | | NFS4ERR_DELEG_REVOKED, NFS4ERR_EXPIRED, | 2163 | | NFS4ERR_FBIG, NFS4ERR_FHEXPIRED, NFS4ERR_GRACE, | 2164 | | NFS4ERR_INVAL, NFS4ERR_IO, NFS4ERR_ISDIR, | 2165 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 2166 | | NFS4ERR_NOTSUPP, NFS4ERR_OLD_STATEID, | 2167 | | NFS4ERR_OPENMODE, NFS4ERR_OP_NOT_IN_SESSION, | 2168 | | NFS4ERR_REP_TOO_BIG, | 2169 | | NFS4ERR_REP_TOO_BIG_TO_CACHE, | 2170 | | NFS4ERR_REQ_TOO_BIG, NFS4ERR_RETRY_UNCACHED_REP, | 2171 | | NFS4ERR_ROFS, NFS4ERR_SERVERFAULT, | 2172 | | NFS4ERR_STALE, NFS4ERR_SYMLINK, | 2173 | | NFS4ERR_TOO_MANY_OPS, NFS4ERR_WRONG_TYPE | 2174 | GETDEVICELIST | NFS4ERR_NOTSUPP | 2175 | LAYOUTERROR | NFS4ERR_ADMIN_REVOKED, NFS4ERR_BADXDR, | 2176 | | NFS4ERR_BAD_STATEID, NFS4ERR_DEADSESSION, | 2177 | | NFS4ERR_DELAY, NFS4ERR_DELEG_REVOKED, | 2178 | | NFS4ERR_EXPIRED, NFS4ERR_FHEXPIRED, | 2179 | | NFS4ERR_GRACE, NFS4ERR_INVAL, NFS4ERR_ISDIR, | 2180 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 2181 | | NFS4ERR_NOTSUPP, NFS4ERR_NO_GRACE, | 2182 | | NFS4ERR_OLD_STATEID, NFS4ERR_OP_NOT_IN_SESSION, | 2183 | | NFS4ERR_REP_TOO_BIG, | 2184 | | NFS4ERR_REP_TOO_BIG_TO_CACHE, | 2185 | | NFS4ERR_REQ_TOO_BIG, NFS4ERR_RETRY_UNCACHED_REP, | 2186 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE, | 2187 | | NFS4ERR_TOO_MANY_OPS, | 2188 | | NFS4ERR_UNKNOWN_LAYOUTTYPE, NFS4ERR_WRONG_CRED, | 2189 | | NFS4ERR_WRONG_TYPE | 2190 | LAYOUTSTATS | NFS4ERR_ADMIN_REVOKED, NFS4ERR_BADXDR, | 2191 | | NFS4ERR_BAD_STATEID, NFS4ERR_DEADSESSION, | 2192 | | NFS4ERR_DELAY, NFS4ERR_DELEG_REVOKED, | 2193 | | NFS4ERR_EXPIRED, NFS4ERR_FHEXPIRED, | 2194 | | NFS4ERR_GRACE, NFS4ERR_INVAL, NFS4ERR_ISDIR, | 2195 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 2196 | | NFS4ERR_NOTSUPP, NFS4ERR_NO_GRACE, | 2197 | | NFS4ERR_OLD_STATEID, NFS4ERR_OP_NOT_IN_SESSION, | 2198 | | NFS4ERR_REP_TOO_BIG, | 2199 | | NFS4ERR_REP_TOO_BIG_TO_CACHE, | 2200 | | NFS4ERR_REQ_TOO_BIG, NFS4ERR_RETRY_UNCACHED_REP, | 2201 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE, | 2202 | | NFS4ERR_TOO_MANY_OPS, | 2203 | | NFS4ERR_UNKNOWN_LAYOUTTYPE, NFS4ERR_WRONG_CRED, | 2204 | | NFS4ERR_WRONG_TYPE | 2205 | OFFLOAD_CANCEL | NFS4ERR_ADMIN_REVOKED, NFS4ERR_BADXDR, | 2206 | | NFS4ERR_BAD_STATEID, NFS4ERR_COMPLETE_ALREADY, | 2207 | | NFS4ERR_DEADSESSION, NFS4ERR_EXPIRED, | 2208 | | NFS4ERR_DELAY, NFS4ERR_GRACE, NFS4ERR_NOTSUPP, | 2209 | | NFS4ERR_OLD_STATEID, NFS4ERR_OP_NOT_IN_SESSION, | 2210 | | NFS4ERR_SERVERFAULT, NFS4ERR_TOO_MANY_OPS | 2211 | OFFLOAD_STATUS | NFS4ERR_ADMIN_REVOKED, NFS4ERR_BADXDR, | 2212 | | NFS4ERR_BAD_STATEID, NFS4ERR_COMPLETE_ALREADY, | 2213 | | NFS4ERR_DEADSESSION, NFS4ERR_EXPIRED, | 2214 | | NFS4ERR_DELAY, NFS4ERR_GRACE, NFS4ERR_NOTSUPP, | 2215 | | NFS4ERR_OLD_STATEID, NFS4ERR_OP_NOT_IN_SESSION, | 2216 | | NFS4ERR_SERVERFAULT, NFS4ERR_TOO_MANY_OPS | 2217 | READ_PLUS | NFS4ERR_ACCESS, NFS4ERR_ADMIN_REVOKED, | 2218 | | NFS4ERR_BADXDR, NFS4ERR_BAD_STATEID, | 2219 | | NFS4ERR_DEADSESSION, NFS4ERR_DELAY, | 2220 | | NFS4ERR_DELEG_REVOKED, NFS4ERR_EXPIRED, | 2221 | | NFS4ERR_FHEXPIRED, NFS4ERR_GRACE, NFS4ERR_INVAL, | 2222 | | NFS4ERR_ISDIR, NFS4ERR_IO, NFS4ERR_LOCKED, | 2223 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 2224 | | NFS4ERR_NOTSUPP, NFS4ERR_OLD_STATEID, | 2225 | | NFS4ERR_OPENMODE, NFS4ERR_OP_NOT_IN_SESSION, | 2226 | | NFS4ERR_PNFS_IO_HOLE, NFS4ERR_PNFS_NO_LAYOUT, | 2227 | | NFS4ERR_REP_TOO_BIG, | 2228 | | NFS4ERR_REP_TOO_BIG_TO_CACHE, | 2229 | | NFS4ERR_REQ_TOO_BIG, NFS4ERR_RETRY_UNCACHED_REP, | 2230 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE, | 2231 | | NFS4ERR_SYMLINK, NFS4ERR_TOO_MANY_OPS, | 2232 | | NFS4ERR_WRONG_TYPE | 2233 | SEEK | NFS4ERR_ACCESS, NFS4ERR_ADMIN_REVOKED, | 2234 | | NFS4ERR_BADXDR, NFS4ERR_BAD_STATEID, | 2235 | | NFS4ERR_DEADSESSION, NFS4ERR_DELAY, | 2236 | | NFS4ERR_DELEG_REVOKED, NFS4ERR_EXPIRED, | 2237 | | NFS4ERR_FHEXPIRED, NFS4ERR_GRACE, NFS4ERR_INVAL, | 2238 | | NFS4ERR_ISDIR, NFS4ERR_IO, NFS4ERR_LOCKED, | 2239 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 2240 | | NFS4ERR_NOTSUPP, NFS4ERR_OLD_STATEID, | 2241 | | NFS4ERR_OPENMODE, NFS4ERR_OP_NOT_IN_SESSION, | 2242 | | NFS4ERR_PNFS_IO_HOLE, NFS4ERR_PNFS_NO_LAYOUT, | 2243 | | NFS4ERR_REP_TOO_BIG, | 2244 | | NFS4ERR_REP_TOO_BIG_TO_CACHE, | 2245 | | NFS4ERR_REQ_TOO_BIG, NFS4ERR_RETRY_UNCACHED_REP, | 2246 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE, | 2247 | | NFS4ERR_SYMLINK, NFS4ERR_TOO_MANY_OPS, | 2248 | | NFS4ERR_UNION_NOTSUPP, NFS4ERR_WRONG_TYPE | 2249 | WRITE_SAME | NFS4ERR_ACCESS, NFS4ERR_ADMIN_REVOKED, | 2250 | | NFS4ERR_BADXDR, NFS4ERR_BAD_STATEID, | 2251 | | NFS4ERR_DEADSESSION, NFS4ERR_DELAY, | 2252 | | NFS4ERR_DELEG_REVOKED, NFS4ERR_DQUOT, | 2253 | | NFS4ERR_EXPIRED, NFS4ERR_FBIG, | 2254 | | NFS4ERR_FHEXPIRED, NFS4ERR_GRACE, NFS4ERR_INVAL, | 2255 | | NFS4ERR_IO, NFS4ERR_ISDIR, NFS4ERR_LOCKED, | 2256 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 2257 | | NFS4ERR_NOSPC, NFS4ERR_NOTSUPP, | 2258 | | NFS4ERR_OLD_STATEID, NFS4ERR_OPENMODE, | 2259 | | NFS4ERR_OP_NOT_IN_SESSION, NFS4ERR_PNFS_IO_HOLE, | 2260 | | NFS4ERR_PNFS_NO_LAYOUT, NFS4ERR_REP_TOO_BIG, | 2261 | | NFS4ERR_REP_TOO_BIG_TO_CACHE, | 2262 | | NFS4ERR_REQ_TOO_BIG, NFS4ERR_RETRY_UNCACHED_REP, | 2263 | | NFS4ERR_ROFS, NFS4ERR_SERVERFAULT, | 2264 | | NFS4ERR_STALE, NFS4ERR_SYMLINK, | 2265 | | NFS4ERR_TOO_MANY_OPS, NFS4ERR_WRONG_TYPE | 2266 +----------------+--------------------------------------------------+ 2268 Table 2 2270 11.3. New Callback Operations and Their Valid Errors 2272 This section contains a table that gives the valid error returns for 2273 each new NFSv4.2 callback operation. The error code NFS4_OK 2274 (indicating no error) is not listed but should be understood to be 2275 returnable by all new callback operations. The error values for all 2276 other callback operations are defined in Section 15.3 of [RFC5661]. 2278 Valid Error Returns for Each New Protocol Callback Operation 2280 +------------+------------------------------------------------------+ 2281 | Callback | Errors | 2282 | Operation | | 2283 +------------+------------------------------------------------------+ 2284 | CB_OFFLOAD | NFS4ERR_BADHANDLE, NFS4ERR_BADXDR, | 2285 | | NFS4ERR_BAD_STATEID, NFS4ERR_DELAY, | 2286 | | NFS4ERR_OP_NOT_IN_SESSION, NFS4ERR_REP_TOO_BIG, | 2287 | | NFS4ERR_REP_TOO_BIG_TO_CACHE, NFS4ERR_REQ_TOO_BIG, | 2288 | | NFS4ERR_RETRY_UNCACHED_REP, NFS4ERR_SERVERFAULT, | 2289 | | NFS4ERR_TOO_MANY_OPS | 2290 +------------+------------------------------------------------------+ 2292 Table 3 2294 12. New File Attributes 2296 12.1. New RECOMMENDED Attributes - List and Definition References 2298 The list of new RECOMMENDED attributes appears in Table 4. The 2299 meaning of the columns of the table are: 2301 Name: The name of the attribute. 2303 Id: The number assigned to the attribute. In the event of conflicts 2304 between the assigned number and [NFSv42xdr], the latter is likely 2305 authoritative, but should be resolved with Errata to this document 2306 and/or [NFSv42xdr]. See [IESG08] for the Errata process. 2308 Data Type: The XDR data type of the attribute. 2310 Acc: Access allowed to the attribute. 2312 R means read-only (GETATTR may retrieve, SETATTR may not set). 2314 W means write-only (SETATTR may set, GETATTR may not retrieve). 2316 R W means read/write (GETATTR may retrieve, SETATTR may set). 2318 Defined in: The section of this specification that describes the 2319 attribute. 2321 +------------------+----+-------------------+-----+----------------+ 2322 | Name | Id | Data Type | Acc | Defined in | 2323 +------------------+----+-------------------+-----+----------------+ 2324 | space_freed | 77 | length4 | R | Section 12.2.3 | 2325 | change_attr_type | 78 | change_attr_type4 | R | Section 12.2.1 | 2326 | sec_label | 79 | sec_label4 | R W | Section 12.2.2 | 2327 +------------------+----+-------------------+-----+----------------+ 2329 Table 4 2331 12.2. Attribute Definitions 2333 12.2.1. Attribute 78: change_attr_type 2335 enum change_attr_type4 { 2336 NFS4_CHANGE_TYPE_IS_MONOTONIC_INCR = 0, 2337 NFS4_CHANGE_TYPE_IS_VERSION_COUNTER = 1, 2338 NFS4_CHANGE_TYPE_IS_VERSION_COUNTER_NOPNFS = 2, 2339 NFS4_CHANGE_TYPE_IS_TIME_METADATA = 3, 2340 NFS4_CHANGE_TYPE_IS_UNDEFINED = 4 2341 }; 2343 change_attr_type is a per file system attribute which enables the 2344 NFSv4.2 server to provide additional information about how it expects 2345 the change attribute value to evolve after the file data, or metadata 2346 has changed. While Section 5.4 of [RFC5661] discusses per file 2347 system attributes, it is expected that the value of change_attr_type 2348 not depend on the value of "homogeneous" and only changes in the 2349 event of a migration. 2351 NFS4_CHANGE_TYPE_IS_UNDEFINED: The change attribute does not take 2352 values that fit into any of these categories. 2354 NFS4_CHANGE_TYPE_IS_MONOTONIC_INCR: The change attribute value MUST 2355 monotonically increase for every atomic change to the file 2356 attributes, data, or directory contents. 2358 NFS4_CHANGE_TYPE_IS_VERSION_COUNTER: The change attribute value MUST 2359 be incremented by one unit for every atomic change to the file 2360 attributes, data, or directory contents. This property is 2361 preserved when writing to pNFS data servers. 2363 NFS4_CHANGE_TYPE_IS_VERSION_COUNTER_NOPNFS: The change attribute 2364 value MUST be incremented by one unit for every atomic change to 2365 the file attributes, data, or directory contents. In the case 2366 where the client is writing to pNFS data servers, the number of 2367 increments is not guaranteed to exactly match the number of 2368 writes. 2370 NFS4_CHANGE_TYPE_IS_TIME_METADATA: The change attribute is 2371 implemented as suggested in [I-D.ietf-nfsv4-rfc3530bis] in terms 2372 of the time_metadata attribute. 2374 If either NFS4_CHANGE_TYPE_IS_MONOTONIC_INCR, 2375 NFS4_CHANGE_TYPE_IS_VERSION_COUNTER, or 2376 NFS4_CHANGE_TYPE_IS_TIME_METADATA are set, then the client knows at 2377 the very least that the change attribute is monotonically increasing, 2378 which is sufficient to resolve the question of which value is the 2379 most recent. 2381 If the client sees the value NFS4_CHANGE_TYPE_IS_TIME_METADATA, then 2382 by inspecting the value of the 'time_delta' attribute it additionally 2383 has the option of detecting rogue server implementations that use 2384 time_metadata in violation of the spec. 2386 If the client sees NFS4_CHANGE_TYPE_IS_VERSION_COUNTER, it has the 2387 ability to predict what the resulting change attribute value should 2388 be after a COMPOUND containing a SETATTR, WRITE, or CREATE. This 2389 again allows it to detect changes made in parallel by another client. 2390 The value NFS4_CHANGE_TYPE_IS_VERSION_COUNTER_NOPNFS permits the 2391 same, but only if the client is not doing pNFS WRITEs. 2393 Finally, if the server does not support change_attr_type or if 2394 NFS4_CHANGE_TYPE_IS_UNDEFINED is set, then the server SHOULD make an 2395 effort to implement the change attribute in terms of the 2396 time_metadata attribute. 2398 12.2.2. Attribute 79: sec_label 2400 typedef uint32_t policy4; 2402 struct labelformat_spec4 { 2403 policy4 lfs_lfs; 2404 policy4 lfs_pi; 2405 }; 2407 struct sec_label4 { 2408 labelformat_spec4 slai_lfs; 2409 opaque slai_data<>; 2410 }; 2412 The FATTR4_SEC_LABEL contains an array of two components with the 2413 first component being an LFS. It serves to provide the receiving end 2414 with the information necessary to translate the security attribute 2415 into a form that is usable by the endpoint. Label Formats assigned 2416 an LFS may optionally choose to include a Policy Identifier field to 2417 allow for complex policy deployments. The LFS and Label Format 2418 Registry are described in detail in [Quigley14]. The translation 2419 used to interpret the security attribute is not specified as part of 2420 the protocol as it may depend on various factors. The second 2421 component is an opaque section which contains the data of the 2422 attribute. This component is dependent on the MAC model to interpret 2423 and enforce. 2425 In particular, it is the responsibility of the LFS specification to 2426 define a maximum size for the opaque section, slai_data<>. When 2427 creating or modifying a label for an object, the client needs to be 2428 guaranteed that the server will accept a label that is sized 2429 correctly. By both client and server being part of a specific MAC 2430 model, the client will be aware of the size. 2432 12.2.3. Attribute 77: space_freed 2434 space_freed gives the number of bytes freed if the file is deleted. 2435 This attribute is read only and is of type length4. It is a per file 2436 attribute. 2438 13. Operations: REQUIRED, RECOMMENDED, or OPTIONAL 2440 The following tables summarize the operations of the NFSv4.2 protocol 2441 and the corresponding designation of REQUIRED, RECOMMENDED, and 2442 OPTIONAL to implement or MUST NOT implement. The designation of MUST 2443 NOT implement is reserved for those operations that were defined in 2444 either NFSv4.0 or NFSV4.1 and MUST NOT be implemented in NFSv4.2. 2446 For the most part, the REQUIRED, RECOMMENDED, or OPTIONAL designation 2447 for operations sent by the client is for the server implementation. 2448 The client is generally required to implement the operations needed 2449 for the operating environment for which it serves. For example, a 2450 read-only NFSv4.2 client would have no need to implement the WRITE 2451 operation and is not required to do so. 2453 The REQUIRED or OPTIONAL designation for callback operations sent by 2454 the server is for both the client and server. Generally, the client 2455 has the option of creating the backchannel and sending the operations 2456 on the fore channel that will be a catalyst for the server sending 2457 callback operations. A partial exception is CB_RECALL_SLOT; the only 2458 way the client can avoid supporting this operation is by not creating 2459 a backchannel. 2461 Since this is a summary of the operations and their designation, 2462 there are subtleties that are not presented here. Therefore, if 2463 there is a question of the requirements of implementation, the 2464 operation descriptions themselves must be consulted along with other 2465 relevant explanatory text within this either specification or that of 2466 NFSv4.1 [RFC5661]. 2468 The abbreviations used in the second and third columns of the table 2469 are defined as follows. 2471 REQ: REQUIRED to implement 2473 REC: RECOMMENDED to implement 2475 OPT: OPTIONAL to implement 2477 MNI: MUST NOT implement 2479 For the NFSv4.2 features that are OPTIONAL, the operations that 2480 support those features are OPTIONAL, and the server MUST return 2481 NFS4ERR_NOTSUPP in response to the client's use of those operations, 2482 when those operations are not implemented by the server. If an 2483 OPTIONAL feature is supported, it is possible that a set of 2484 operations related to the feature become REQUIRED to implement. The 2485 third column of the table designates the feature(s) and if the 2486 operation is REQUIRED or OPTIONAL in the presence of support for the 2487 feature. 2489 The OPTIONAL features identified and their abbreviations are as 2490 follows: 2492 pNFS: Parallel NFS 2494 FDELG: File Delegations 2496 DDELG: Directory Delegations 2498 COPYra: Intra-server Server Side Copy 2500 COPYer: Inter-server Server Side Copy 2502 ADB: Application Data Blocks 2504 Operations 2506 +----------------------+---------------------+----------------------+ 2507 | Operation | EOL, REQ, REC, OPT, | Feature (REQ, REC, | 2508 | | or MNI | or OPT) | 2509 +----------------------+---------------------+----------------------+ 2510 | ALLOCATE | OPT | | 2511 | ACCESS | REQ | | 2512 | BACKCHANNEL_CTL | REQ | | 2513 | BIND_CONN_TO_SESSION | REQ | | 2514 | CLOSE | REQ | | 2515 | COMMIT | REQ | | 2516 | COPY | OPT | COPYer (REQ), COPYra | 2517 | | | (REQ) | 2518 | COPY_NOTIFY | OPT | COPYer (REQ) | 2519 | DEALLOCATE | OPT | | 2520 | CREATE | REQ | | 2521 | CREATE_SESSION | REQ | | 2522 | DELEGPURGE | OPT | FDELG (REQ) | 2523 | DELEGRETURN | OPT | FDELG, DDELG, pNFS | 2524 | | | (REQ) | 2525 | DESTROY_CLIENTID | REQ | | 2526 | DESTROY_SESSION | REQ | | 2527 | EXCHANGE_ID | REQ | | 2528 | FREE_STATEID | REQ | | 2529 | GETATTR | REQ | | 2530 | GETDEVICEINFO | OPT | pNFS (REQ) | 2531 | GETDEVICELIST | MNI | pNFS (MNI) | 2532 | GETFH | REQ | | 2533 | GET_DIR_DELEGATION | OPT | DDELG (REQ) | 2534 | LAYOUTCOMMIT | OPT | pNFS (REQ) | 2535 | LAYOUTGET | OPT | pNFS (REQ) | 2536 | LAYOUTRETURN | OPT | pNFS (REQ) | 2537 | LAYOUTERROR | OPT | pNFS (OPT) | 2538 | LAYOUTSTATS | OPT | pNFS (OPT) | 2539 | LINK | OPT | | 2540 | LOCK | REQ | | 2541 | LOCKT | REQ | | 2542 | LOCKU | REQ | | 2543 | LOOKUP | REQ | | 2544 | LOOKUPP | REQ | | 2545 | NVERIFY | REQ | | 2546 | OFFLOAD_CANCEL | OPT | COPYer (REQ), COPYra | 2547 | | | (REQ) | 2548 | OFFLOAD_STATUS | OPT | COPYer (REQ), COPYra | 2549 | | | (REQ) | 2550 | OPEN | REQ | | 2551 | OPENATTR | OPT | | 2552 | OPEN_CONFIRM | MNI | | 2553 | OPEN_DOWNGRADE | REQ | | 2554 | PUTFH | REQ | | 2555 | PUTPUBFH | REQ | | 2556 | PUTROOTFH | REQ | | 2557 | READ | REQ | | 2558 | READDIR | REQ | | 2559 | READLINK | OPT | | 2560 | READ_PLUS | OPT | | 2561 | RECLAIM_COMPLETE | REQ | | 2562 | RELEASE_LOCKOWNER | MNI | | 2563 | REMOVE | REQ | | 2564 | RENAME | REQ | | 2565 | RENEW | MNI | | 2566 | RESTOREFH | REQ | | 2567 | SAVEFH | REQ | | 2568 | SECINFO | REQ | | 2569 | SECINFO_NO_NAME | REC | pNFS file layout | 2570 | | | (REQ) | 2571 | SEQUENCE | REQ | | 2572 | SETATTR | REQ | | 2573 | SETCLIENTID | MNI | | 2574 | SETCLIENTID_CONFIRM | MNI | | 2575 | SET_SSV | REQ | | 2576 | TEST_STATEID | REQ | | 2577 | VERIFY | REQ | | 2578 | WANT_DELEGATION | OPT | FDELG (OPT) | 2579 | WRITE | REQ | | 2580 | WRITE_SAME | OPT | ADB (REQ) | 2581 +----------------------+---------------------+----------------------+ 2583 Callback Operations 2585 +-------------------------+------------------+----------------------+ 2586 | Operation | REQ, REC, OPT, | Feature (REQ, REC, | 2587 | | or MNI | or OPT) | 2588 +-------------------------+------------------+----------------------+ 2589 | CB_OFFLOAD | OPT | COPYer (REQ), COPYra | 2590 | | | (REQ) | 2591 | CB_GETATTR | OPT | FDELG (REQ) | 2592 | CB_LAYOUTRECALL | OPT | pNFS (REQ) | 2593 | CB_NOTIFY | OPT | DDELG (REQ) | 2594 | CB_NOTIFY_DEVICEID | OPT | pNFS (OPT) | 2595 | CB_NOTIFY_LOCK | OPT | | 2596 | CB_PUSH_DELEG | OPT | FDELG (OPT) | 2597 | CB_RECALL | OPT | FDELG, DDELG, pNFS | 2598 | | | (REQ) | 2599 | CB_RECALL_ANY | OPT | FDELG, DDELG, pNFS | 2600 | | | (REQ) | 2601 | CB_RECALL_SLOT | REQ | | 2602 | CB_RECALLABLE_OBJ_AVAIL | OPT | DDELG, pNFS (REQ) | 2603 | CB_SEQUENCE | OPT | FDELG, DDELG, pNFS | 2604 | | | (REQ) | 2605 | CB_WANTS_CANCELLED | OPT | FDELG, DDELG, pNFS | 2606 | | | (REQ) | 2607 +-------------------------+------------------+----------------------+ 2609 14. Modifications to NFSv4.1 Operations 2611 14.1. Operation 42: EXCHANGE_ID - Instantiate Client ID 2613 14.1.1. ARGUMENT 2615 /* new */ 2616 const EXCHGID4_FLAG_SUPP_FENCE_OPS = 0x00000004; 2618 14.1.2. RESULT 2620 Unchanged 2622 14.1.3. MOTIVATION 2624 Enterprise applications require guarantees that an operation has 2625 either aborted or completed. NFSv4.1 provides this guarantee as long 2626 as the session is alive: simply send a SEQUENCE operation on the same 2627 slot with a new sequence number, and the successful return of 2628 SEQUENCE indicates the previous operation has completed. However, if 2629 the session is lost, there is no way to know when any in progress 2630 operations have aborted or completed. In hindsight, the NFSv4.1 2631 specification should have mandated that DESTROY_SESSION either abort 2632 or complete all outstanding operations. 2634 14.1.4. DESCRIPTION 2636 A client SHOULD request the EXCHGID4_FLAG_SUPP_FENCE_OPS capability 2637 when it sends an EXCHANGE_ID operation. The server SHOULD set this 2638 capability in the EXCHANGE_ID reply whether the client requests it or 2639 not. It is the server's return that determines whether this 2640 capability is in effect. When it is in effect, the following will 2641 occur: 2643 o The server will not reply to any DESTROY_SESSION invoked with the 2644 client ID until all operations in progress are completed or 2645 aborted. 2647 o The server will not reply to subsequent EXCHANGE_ID invoked on the 2648 same client owner with a new verifier until all operations in 2649 progress on the client ID's session are completed or aborted. 2651 o In implementations where the NFS server is deployed as a cluster, 2652 it does support client ID trunking, and the 2653 EXCHGID4_FLAG_SUPP_FENCE_OPS capability is enabled, then a session 2654 ID created on one node of the storage cluster MUST be destroyable 2655 via DESTROY_SESSION. In addition, DESTROY_CLIENTID and an 2656 EXCHANGE_ID with a new verifier affects all sessions regardless 2657 what node the sessions were created on. 2659 14.2. Operation 48: GETDEVICELIST - Get All Device Mappings for a File 2660 System 2662 14.2.1. ARGUMENT 2664 struct GETDEVICELIST4args { 2665 /* CURRENT_FH: object belonging to the file system */ 2666 layouttype4 gdla_layout_type; 2668 /* number of deviceIDs to return */ 2669 count4 gdla_maxdevices; 2671 nfs_cookie4 gdla_cookie; 2672 verifier4 gdla_cookieverf; 2673 }; 2675 14.2.2. RESULT 2677 struct GETDEVICELIST4resok { 2678 nfs_cookie4 gdlr_cookie; 2679 verifier4 gdlr_cookieverf; 2680 deviceid4 gdlr_deviceid_list<>; 2681 bool gdlr_eof; 2682 }; 2684 union GETDEVICELIST4res switch (nfsstat4 gdlr_status) { 2685 case NFS4_OK: 2686 GETDEVICELIST4resok gdlr_resok4; 2687 default: 2688 void; 2689 }; 2691 14.2.3. MOTIVATION 2693 The GETDEVICELIST operation was introduced in [RFC5661] specifically 2694 to request a list of devices at filesystem mount time from block 2695 layout type servers. However use of the GETDEVICELIST operation 2696 introduces a race condition versus notification about changes to pNFS 2697 device IDs as provided by CB_NOTIFY_DEVICEID. Implementation 2698 experience with block layout servers has shown there is no need for 2699 GETDEVICELIST. Clients have to be able to request new devices using 2700 GETDEVICEINFO at any time in response either to a new deviceid in 2701 LAYOUTGET results or to the CB_NOTIFY_DEVICEID callback operation. 2703 14.2.4. DESCRIPTION 2705 Clients and servers MUST NOT implement the GETDEVICELIST operation. 2707 15. NFSv4.2 Operations 2709 15.1. Operation 59: ALLOCATE - Reserve Space in A Region of a File 2711 15.1.1. ARGUMENT 2713 struct ALLOCATE4args { 2714 /* CURRENT_FH: file */ 2715 stateid4 aa_stateid; 2716 offset4 aa_offset; 2717 length4 aa_length; 2718 }; 2720 15.1.2. RESULT 2722 struct ALLOCATE4res { 2723 nfsstat4 ar_status; 2724 }; 2726 15.1.3. DESCRIPTION 2728 Whenever a client wishes to reserve space for a region in a file it 2729 calls the ALLOCATE operation with the current filehandle set to the 2730 filehandle of the file in question, and the start offset and length 2731 in bytes of the region set in aa_offset and aa_length respectively. 2733 The server will ensure that backing blocks are reserved to the region 2734 specified by aa_offset and aa_length, and that no future writes into 2735 this region will return NFS4ERR_NOSPC. If the region lies partially 2736 or fully outside the current file size the file size will be set to 2737 aa_offset + aa_length implicitly. If the server cannot guarantee 2738 this, it must return NFS4ERR_NOSPC. 2740 The ALLOCATE operation can also be used to extend the size of a file 2741 if the region specified by aa_offset and aa_length extends beyond the 2742 current file size. In that case any data outside of the previous 2743 file size will return zeroes when read before data is written to it. 2745 It is not required that the server allocate the space to the file 2746 before returning success. The allocation can be deferred, however, 2747 it must be guaranteed that it will not fail for lack of space. The 2748 deferral does not result in an asynchronous reply. 2750 The ALLOCATE operation will result in the space_used attribute and 2751 space_freed attributes being increased by the number of bytes 2752 reserved unless they were previously reserved or written and not 2753 shared. 2755 15.2. Operation 60: COPY - Initiate a server-side copy 2757 15.2.1. ARGUMENT 2759 struct COPY4args { 2760 /* SAVED_FH: source file */ 2761 /* CURRENT_FH: destination file */ 2762 stateid4 ca_src_stateid; 2763 stateid4 ca_dst_stateid; 2764 offset4 ca_src_offset; 2765 offset4 ca_dst_offset; 2766 length4 ca_count; 2767 bool ca_consecutive; 2768 bool ca_synchronous; 2769 netloc4 ca_source_server<>; 2770 }; 2772 15.2.2. RESULT 2774 struct write_response4 { 2775 stateid4 wr_callback_id<1>; 2776 length4 wr_count; 2777 stable_how4 wr_committed; 2778 verifier4 wr_writeverf; 2779 }; 2781 struct COPY4res { 2782 nfsstat4 cr_status; 2783 write_response4 cr_response; 2784 bool cr_consecutive; 2785 bool cr_synchronous; 2786 }; 2788 15.2.3. DESCRIPTION 2790 The COPY operation is used for both intra-server and inter-server 2791 copies. In both cases, the COPY is always sent from the client to 2792 the destination server of the file copy. The COPY operation requests 2793 that a file be copied from the location specified by the SAVED_FH 2794 value to the location specified by the CURRENT_FH. 2796 The SAVED_FH must be a regular file. If SAVED_FH is not a regular 2797 file, the operation MUST fail and return NFS4ERR_WRONG_TYPE. 2799 In order to set SAVED_FH to the source file handle, the compound 2800 procedure requesting the COPY will include a sub-sequence of 2801 operations such as 2803 PUTFH source-fh 2804 SAVEFH 2806 If the request is for a server-to-server copy, the source-fh is a 2807 filehandle from the source server and the compound procedure is being 2808 executed on the destination server. In this case, the source-fh is a 2809 foreign filehandle on the server receiving the COPY request. If 2810 either PUTFH or SAVEFH checked the validity of the filehandle, the 2811 operation would likely fail and return NFS4ERR_STALE. 2813 If a server supports the server-to-server COPY feature, a PUTFH 2814 followed by a SAVEFH MUST NOT return NFS4ERR_STALE for either 2815 operation. These restrictions do not pose substantial difficulties 2816 for servers. The CURRENT_FH and SAVED_FH may be validated in the 2817 context of the operation referencing them and an NFS4ERR_STALE error 2818 returned for an invalid file handle at that point. 2820 For an intra-server copy, both the ca_src_stateid and ca_dst_stateid 2821 MUST refer to either open or locking states provided earlier by the 2822 server. If either stateid is invalid, then the operation MUST fail. 2823 If the request is for a inter-server copy, then the ca_src_stateid 2824 can be ignored. If ca_dst_stateid is invalid, then the operation 2825 MUST fail. 2827 The CURRENT_FH specifies the destination of the copy operation. The 2828 CURRENT_FH MUST be a regular file and not a directory. Note, the 2829 file MUST exist before the COPY operation begins. It is the 2830 responsibility of the client to create the file if necessary, 2831 regardless of the actual copy protocol used. If the file cannot be 2832 created in the destination file system (due to file name 2833 restrictions, such as case or length), the COPY operation MUST NOT be 2834 called. 2836 The ca_src_offset is the offset within the source file from which the 2837 data will be read, the ca_dst_offset is the offset within the 2838 destination file to which the data will be written, and the ca_count 2839 is the number of bytes that will be copied. An offset of 0 (zero) 2840 specifies the start of the file. A count of 0 (zero) requests that 2841 all bytes from ca_src_offset through EOF be copied to the 2842 destination. If concurrent modifications to the source file overlap 2843 with the source file region being copied, the data copied may include 2844 all, some, or none of the modifications. The client can use standard 2845 NFS operations (e.g., OPEN with OPEN4_SHARE_DENY_WRITE or mandatory 2846 byte range locks) to protect against concurrent modifications if the 2847 client is concerned about this. If the source file's end of file is 2848 being modified in parallel with a copy that specifies a count of 0 2849 (zero) bytes, the amount of data copied is implementation dependent 2850 (clients may guard against this case by specifying a non-zero count 2851 value or preventing modification of the source file as mentioned 2852 above). 2854 If the source offset or the source offset plus count is greater than 2855 or equal to the size of the source file, the operation will fail with 2856 NFS4ERR_INVAL. The destination offset or destination offset plus 2857 count may be greater than the size of the destination file. This 2858 allows for the client to issue parallel copies to implement 2859 operations such as 2861 % cat file1 file2 file3 file4 > dest 2863 If the ca_source_server list is specified, then this is an inter- 2864 server copy operation and the source file is on a remote server. The 2865 client is expected to have previously issued a successful COPY_NOTIFY 2866 request to the remote source server. The ca_source_server list MUST 2867 be the same as the COPY_NOTIFY response's cnr_source_server list. If 2868 the client includes the entries from the COPY_NOTIFY response's 2869 cnr_source_server list in the ca_source_server list, the source 2870 server can indicate a specific copy protocol for the destination 2871 server to use by returning a URL, which specifies both a protocol 2872 service and server name. Server-to-server copy protocol 2873 considerations are described in Section 4.7 and Section 4.10.1. 2875 If ca_consecutive is set, then the client has specified that the copy 2876 protocol selected MUST copy bytes in consecutive order from 2877 ca_src_offset to ca_count. If the destination server cannot meet 2878 this requirement, then it MUST return an error of 2879 NFS4ERR_OFFLOAD_NO_REQS and set cr_consecutive to be false. 2880 Likewise, if ca_synchronous is set, then the client has required that 2881 the copy protocol selected MUST perform a synchronous copy. If the 2882 destination server cannot meet this requirement, then it MUST return 2883 an error of NFS4ERR_OFFLOAD_NO_REQS and set cr_synchronous to be 2884 false. 2886 If both are set by the client, then the destination SHOULD try to 2887 determine if it can respond to both requirements at the same time. 2888 If it cannot make that determination, it must set to false the one it 2889 can and set to true the other. The client, upon getting an 2890 NFS4ERR_OFFLOAD_NO_REQS error, has to examine both cr_consecutive and 2891 cr_synchronous against the respective values of ca_consecutive and 2892 ca_synchronous to determine the possible requirement not met. It 2893 MUST be prepared for the destination server not being able to 2894 determine both requirements at the same time. 2896 Upon receiving the NFS4ERR_OFFLOAD_NO_REQS error, the client has to 2897 determine if it wants to either re-request the copy with a relaxed 2898 set of requirements or if it wants to revert to manually copying the 2899 data. If it decides to manually copy the data and this is a remote 2900 copy, then the client is responsible for informing the source that 2901 the earlier COPY_NOTIFY is no longer valid by sending it an 2902 OFFLOAD_CANCEL. 2904 The copying of any and all attributes on the source file is the 2905 responsibility of both the client and the copy protocol. Any 2906 attribute which is both exposed via the NFS protocol on the source 2907 file and set SHOULD be copied to the destination file. Any attribute 2908 supported by the destination server that is not set on the source 2909 file SHOULD be left unset. If the client cannot copy an attribute 2910 from the source to destination, it MAY fail the copy transaction. 2912 Metadata attributes not exposed via the NFS protocol SHOULD be copied 2913 to the destination file where appropriate via the copy protocol. 2914 Note that if the copy protocol is NFSv4.x, then these attributes will 2915 be lost. 2917 The destination file's named attributes are not duplicated from the 2918 source file. After the copy process completes, the client MAY 2919 attempt to duplicate named attributes using standard NFSv4 2920 operations. However, the destination file's named attribute 2921 capabilities MAY be different from the source file's named attribute 2922 capabilities. 2924 If the operation does not result in an immediate failure, the server 2925 will return NFS4_OK, and the CURRENT_FH will remain the destination's 2926 filehandle. 2928 If the wr_callback_id is returned, this indicates that the operation 2929 was initiated and a CB_OFFLOAD callback will deliver the final 2930 results of the operation. The wr_callback_id stateid is termed a 2931 copy stateid in this context. The server is given the option of 2932 returning the results in a callback because the data may require a 2933 relatively long period of time to copy. 2935 If no wr_callback_id is returned, the operation completed 2936 synchronously and no callback will be issued by the server. The 2937 completion status of the operation is indicated by cr_status. 2939 If the copy completes successfully, either synchronously or 2940 asynchronously, the data copied from the source file to the 2941 destination file MUST appear identical to the NFS client. However, 2942 the NFS server's on disk representation of the data in the source 2943 file and destination file MAY differ. For example, the NFS server 2944 might encrypt, compress, deduplicate, or otherwise represent the on 2945 disk data in the source and destination file differently. 2947 If a failure does occur for a synchronous copy, wr_count will be set 2948 to the number of bytes copied to the destination file before the 2949 error occurred. If cr_consecutive is true, then the bytes were 2950 copied in order. If the failure occurred for an asynchronous copy, 2951 then the client will have gotten the notification of the consecutive 2952 copy order when it got the copy stateid. It will be able to 2953 determine the bytes copied from the coa_bytes_copied in the 2954 CB_OFFLOAD argument. 2956 In either case, if cr_consecutive was not true, there is no assurance 2957 as to exactly which bytes in the range were copied. The client MUST 2958 assume that there exists a mixture of the original contents of the 2959 range and the new bytes. If the COPY wrote past the end of the file 2960 on the destination, then the last byte written to will determine the 2961 new file size. The contents of any block not written to and past the 2962 original size of the file will be as if a normal WRITE extended the 2963 file. 2965 15.3. Operation 61: COPY_NOTIFY - Notify a source server of a future 2966 copy 2968 15.3.1. ARGUMENT 2970 struct COPY_NOTIFY4args { 2971 /* CURRENT_FH: source file */ 2972 stateid4 cna_src_stateid; 2973 netloc4 cna_destination_server; 2974 }; 2976 15.3.2. RESULT 2977 struct COPY_NOTIFY4resok { 2978 nfstime4 cnr_lease_time; 2979 netloc4 cnr_source_server<>; 2980 }; 2982 union COPY_NOTIFY4res switch (nfsstat4 cnr_status) { 2983 case NFS4_OK: 2984 COPY_NOTIFY4resok resok4; 2985 default: 2986 void; 2987 }; 2989 15.3.3. DESCRIPTION 2991 This operation is used for an inter-server copy. A client sends this 2992 operation in a COMPOUND request to the source server to authorize a 2993 destination server identified by cna_destination_server to read the 2994 file specified by CURRENT_FH on behalf of the given user. 2996 The cna_src_stateid MUST refer to either open or locking states 2997 provided earlier by the server. If it is invalid, then the operation 2998 MUST fail. 3000 The cna_destination_server MUST be specified using the netloc4 3001 network location format. The server is not required to resolve the 3002 cna_destination_server address before completing this operation. 3004 If this operation succeeds, the source server will allow the 3005 cna_destination_server to copy the specified file on behalf of the 3006 given user as long as both of the following conditions are met: 3008 o The destination server begins reading the source file before the 3009 cnr_lease_time expires. If the cnr_lease_time expires while the 3010 destination server is still reading the source file, the 3011 destination server is allowed to finish reading the file. 3013 o The client has not issued a COPY_REVOKE for the same combination 3014 of user, filehandle, and destination server. 3016 The cnr_lease_time is chosen by the source server. A cnr_lease_time 3017 of 0 (zero) indicates an infinite lease. To avoid the need for 3018 synchronized clocks, copy lease times are granted by the server as a 3019 time delta. To renew the copy lease time the client should resend 3020 the same copy notification request to the source server. 3022 A successful response will also contain a list of netloc4 network 3023 location formats called cnr_source_server, on which the source is 3024 willing to accept connections from the destination. These might not 3025 be reachable from the client and might be located on networks to 3026 which the client has no connection. 3028 For a copy only involving one server (the source and destination are 3029 on the same server), this operation is unnecessary. 3031 15.4. Operation 62: DEALLOCATE - Unreserve Space in a Region of a File 3033 15.4.1. ARGUMENT 3035 struct DEALLOCATE4args { 3036 /* CURRENT_FH: file */ 3037 stateid4 da_stateid; 3038 offset4 da_offset; 3039 length4 da_length; 3040 }; 3042 15.4.2. RESULT 3044 struct DEALLOCATE4res { 3045 nfsstat4 dr_status; 3046 }; 3048 15.4.3. DESCRIPTION 3050 Whenever a client wishes to unreserve space for a region in a file it 3051 calls the DEALLOCATE operation with the current filehandle set to the 3052 filehandle of the file in question, and the start offset and length 3053 in bytes of the region set in da_offset and da_length respectively. 3054 If no space was allocated or reserved for all or parts of the region, 3055 the DEALLOCATE operation will have no effect for the region that 3056 already is in unreserved state. All further reads from the region 3057 passed to DEALLOCATE MUST return zeros until overwritten. The 3058 filehandle specified must be that of a regular file. 3060 Situations may arise where da_offset and/or da_offset + da_length 3061 will not be aligned to a boundary for which the server does 3062 allocations or deallocations. For most file systems, this is the 3063 block size of the file system. In such a case, the server can 3064 deallocate as many bytes as it can in the region. The blocks that 3065 cannot be deallocated MUST be zeroed. 3067 DEALLOCATE will result in the space_used attribute being decreased by 3068 the number of bytes that were deallocated. The space_freed attribute 3069 may or may not decrease, depending on the support and whether the 3070 blocks backing the specified range were shared or not. The size 3071 attribute will remain unchanged. 3073 15.5. Operation 63: IO_ADVISE - Application I/O access pattern hints 3075 15.5.1. ARGUMENT 3077 enum IO_ADVISE_type4 { 3078 IO_ADVISE4_NORMAL = 0, 3079 IO_ADVISE4_SEQUENTIAL = 1, 3080 IO_ADVISE4_SEQUENTIAL_BACKWARDS = 2, 3081 IO_ADVISE4_RANDOM = 3, 3082 IO_ADVISE4_WILLNEED = 4, 3083 IO_ADVISE4_WILLNEED_OPPORTUNISTIC = 5, 3084 IO_ADVISE4_DONTNEED = 6, 3085 IO_ADVISE4_NOREUSE = 7, 3086 IO_ADVISE4_READ = 8, 3087 IO_ADVISE4_WRITE = 9, 3088 IO_ADVISE4_INIT_PROXIMITY = 10 3089 }; 3091 struct IO_ADVISE4args { 3092 /* CURRENT_FH: file */ 3093 stateid4 iaa_stateid; 3094 offset4 iaa_offset; 3095 length4 iaa_count; 3096 bitmap4 iaa_hints; 3097 }; 3099 15.5.2. RESULT 3101 struct IO_ADVISE4resok { 3102 bitmap4 ior_hints; 3103 }; 3105 union IO_ADVISE4res switch (nfsstat4 ior_status) { 3106 case NFS4_OK: 3107 IO_ADVISE4resok resok4; 3108 default: 3109 void; 3110 }; 3112 15.5.3. DESCRIPTION 3114 The IO_ADVISE operation sends an I/O access pattern hint to the 3115 server for the owner of the stateid for a given byte range specified 3116 by iar_offset and iar_count. The byte range specified by iaa_offset 3117 and iaa_count need not currently exist in the file, but the iaa_hints 3118 will apply to the byte range when it does exist. If iaa_count is 0, 3119 all data following iaa_offset is specified. The server MAY ignore 3120 the advice. 3122 The following are the allowed hints for a stateid holder: 3124 IO_ADVISE4_NORMAL There is no advice to give, this is the default 3125 behavior. 3127 IO_ADVISE4_SEQUENTIAL Expects to access the specified data 3128 sequentially from lower offsets to higher offsets. 3130 IO_ADVISE4_SEQUENTIAL_BACKWARDS Expects to access the specified data 3131 sequentially from higher offsets to lower offsets. 3133 IO_ADVISE4_RANDOM Expects to access the specified data in a random 3134 order. 3136 IO_ADVISE4_WILLNEED Expects to access the specified data in the near 3137 future. 3139 IO_ADVISE4_WILLNEED_OPPORTUNISTIC Expects to possibly access the 3140 data in the near future. This is a speculative hint, and 3141 therefore the server should prefetch data or indirect blocks only 3142 if it can be done at a marginal cost. 3144 IO_ADVISE_DONTNEED Expects that it will not access the specified 3145 data in the near future. 3147 IO_ADVISE_NOREUSE Expects to access the specified data once and then 3148 not reuse it thereafter. 3150 IO_ADVISE4_READ Expects to read the specified data in the near 3151 future. 3153 IO_ADVISE4_WRITE Expects to write the specified data in the near 3154 future. 3156 IO_ADVISE4_INIT_PROXIMITY Informs the server that the data in the 3157 byte range remains important to the client. 3159 Since IO_ADVISE is a hint, a server SHOULD NOT return an error and 3160 invalidate a entire Compound request if one of the sent hints in 3161 iar_hints is not supported by the server. Also, the server MUST NOT 3162 return an error if the client sends contradictory hints to the 3163 server, e.g., IO_ADVISE4_SEQUENTIAL and IO_ADVISE4_RANDOM in a single 3164 IO_ADVISE operation. In these cases, the server MUST return success 3165 and a ior_hints value that indicates the hint it intends to 3166 implement. This may mean simply returning IO_ADVISE4_NORMAL. 3168 The ior_hints returned by the server is primarily for debugging 3169 purposes since the server is under no obligation to carry out the 3170 hints that it describes in the ior_hints result. In addition, while 3171 the server may have intended to implement the hints returned in 3172 ior_hints, as time progresses, the server may need to change its 3173 handling of a given file due to several reasons including, but not 3174 limited to, memory pressure, additional IO_ADVISE hints sent by other 3175 clients, and heuristically detected file access patterns. 3177 The server MAY return different advice than what the client 3178 requested. If it does, then this might be due to one of several 3179 conditions, including, but not limited to another client advising of 3180 a different I/O access pattern; a different I/O access pattern from 3181 another client that that the server has heuristically detected; or 3182 the server is not able to support the requested I/O access pattern, 3183 perhaps due to a temporary resource limitation. 3185 Each issuance of the IO_ADVISE operation overrides all previous 3186 issuances of IO_ADVISE for a given byte range. This effectively 3187 follows a strategy of last hint wins for a given stateid and byte 3188 range. 3190 Clients should assume that hints included in an IO_ADVISE operation 3191 will be forgotten once the file is closed. 3193 15.5.4. IMPLEMENTATION 3195 The NFS client may choose to issue an IO_ADVISE operation to the 3196 server in several different instances. 3198 The most obvious is in direct response to an application's execution 3199 of posix_fadvise(). In this case, IO_ADVISE4_WRITE and 3200 IO_ADVISE4_READ may be set based upon the type of file access 3201 specified when the file was opened. 3203 15.5.5. IO_ADVISE4_INIT_PROXIMITY 3205 The IO_ADVISE4_INIT_PROXIMITY hint is non-posix in origin and can be 3206 used to convey that the client has recently accessed the byte range 3207 in its own cache. I.e., it has not accessed it on the server, but it 3208 has locally. When the server reaches resource exhaustion, knowing 3209 which data is more important allows the server to make better choices 3210 about which data to, for example purge from a cache, or move to 3211 secondary storage. It also informs the server which delegations are 3212 more important, since if delegations are working correctly, once 3213 delegated to a client and the client has read the content for that 3214 byte range, a server might never receive another read request for 3215 that byte range. 3217 The IO_ADVISE4_INIT_PROXIMITY hint can also be used in a pNFS setting 3218 to let the client inform the metadata server as to the I/O statistics 3219 between the client and the storage devices. The metadata server is 3220 then free to use this information about client I/O to optimize the 3221 data storage location. 3223 This hint is also useful in the case of NFS clients which are network 3224 booting from a server. If the first client to be booted sends this 3225 hint, then it keeps the cache warm for the remaining clients. 3227 15.5.6. pNFS File Layout Data Type Considerations 3229 The IO_ADVISE considerations for pNFS are very similar to the COMMIT 3230 considerations for pNFS. That is, as with COMMIT, some NFS server 3231 implementations prefer IO_ADVISE be done on the DS, and some prefer 3232 it be done on the MDS. 3234 For the file's layout type, it is proposed that NFSv4.2 include an 3235 additional hint NFL42_CARE_IO_ADVISE_THRU_MDS which is valid only on 3236 metadata servers running NFSv4.2 or higher. Any file's layout 3237 obtained from a NFSv4.1 metadata server MUST NOT have 3238 NFL42_UFLG_IO_ADVISE_THRU_MDS set. Any file's layout obtained with a 3239 NFSv4.2 metadata server MAY have NFL42_UFLG_IO_ADVISE_THRU_MDS set. 3240 However, if the layout utilizes NFSv4.1 storage devices, the 3241 IO_ADVISE operation cannot be sent to them. 3243 If NFL42_UFLG_IO_ADVISE_THRU_MDS is set, the client MUST send the 3244 IO_ADVISE operation to the MDS in order for it to be honored by the 3245 DS. Once the MDS receives the IO_ADVISE operation, it will 3246 communicate the advice to each DS. 3248 If NFL42_UFLG_IO_ADVISE_THRU_MDS is not set, then the client SHOULD 3249 send an IO_ADVISE operation to the appropriate DS for the specified 3250 byte range. While the client MAY always send IO_ADVISE to the MDS, 3251 if the server has not set NFL42_UFLG_IO_ADVISE_THRU_MDS, the client 3252 should expect that such an IO_ADVISE is futile. Note that a client 3253 SHOULD use the same set of arguments on each IO_ADVISE sent to a DS 3254 for the same open file reference. 3256 The server is not required to support different advice for different 3257 DS's with the same open file reference. 3259 15.5.6.1. Dense and Sparse Packing Considerations 3261 The IO_ADVISE operation MUST use the iar_offset and byte range as 3262 dictated by the presence or absence of NFL4_UFLG_DENSE. 3264 E.g., if NFL4_UFLG_DENSE is present, and a READ or WRITE to the DS 3265 for iaa_offset 0 really means iaa_offset 10000 in the logical file, 3266 then an IO_ADVISE for iaa_offset 0 means iaa_offset 10000. 3268 E.g., if NFL4_UFLG_DENSE is absent, then a READ or WRITE to the DS 3269 for iaa_offset 0 really means iaa_offset 0 in the logical file, then 3270 an IO_ADVISE for iaa_offset 0 means iaa_offset 0 in the logical file. 3272 E.g., if NFL4_UFLG_DENSE is present, the stripe unit is 1000 bytes 3273 and the stripe count is 10, and the dense DS file is serving 3274 iar_offset 0. A READ or WRITE to the DS for iaa_offsets 0, 1000, 3275 2000, and 3000, really mean iaa_offsets 10000, 20000, 30000, and 3276 40000 (implying a stripe count of 10 and a stripe unit of 1000), then 3277 an IO_ADVISE sent to the same DS with an iaa_offset of 500, and an 3278 iaa_count of 3000 means that the IO_ADVISE applies to these byte 3279 ranges of the dense DS file: 3281 - 500 to 999 3282 - 1000 to 1999 3283 - 2000 to 2999 3284 - 3000 to 3499 3286 I.e., the contiguous range 500 to 3499 as specified in IO_ADVISE. 3288 It also applies to these byte ranges of the logical file: 3290 - 10500 to 10999 (500 bytes) 3291 - 20000 to 20999 (1000 bytes) 3292 - 30000 to 30999 (1000 bytes) 3293 - 40000 to 40499 (500 bytes) 3294 (total 3000 bytes) 3296 E.g., if NFL4_UFLG_DENSE is absent, the stripe unit is 250 bytes, the 3297 stripe count is 4, and the sparse DS file is serving iaa_offset 0. 3298 Then a READ or WRITE to the DS for iaa_offsets 0, 1000, 2000, and 3299 3000, really means iaa_offsets 0, 1000, 2000, and 3000 in the logical 3300 file, keeping in mind that on the DS file, byte ranges 250 to 999, 3301 1250 to 1999, 2250 to 2999, and 3250 to 3999 are not accessible. 3302 Then an IO_ADVISE sent to the same DS with an iaa_offset of 500, and 3303 a iaa_count of 3000 means that the IO_ADVISE applies to these byte 3304 ranges of the logical file and the sparse DS file: 3306 - 500 to 999 (500 bytes) - no effect 3307 - 1000 to 1249 (250 bytes) - effective 3308 - 1250 to 1999 (750 bytes) - no effect 3309 - 2000 to 2249 (250 bytes) - effective 3310 - 2250 to 2999 (750 bytes) - no effect 3311 - 3000 to 3249 (250 bytes) - effective 3312 - 3250 to 3499 (250 bytes) - no effect 3313 (subtotal 2250 bytes) - no effect 3314 (subtotal 750 bytes) - effective 3315 (grand total 3000 bytes) - no effect + effective 3317 If neither of the flags NFL42_UFLG_IO_ADVISE_THRU_MDS and 3318 NFL4_UFLG_DENSE are set in the layout, then any IO_ADVISE request 3319 sent to the data server with a byte range that overlaps stripe unit 3320 that the data server does not serve MUST NOT result in the status 3321 NFS4ERR_PNFS_IO_HOLE. Instead, the response SHOULD be successful and 3322 if the server applies IO_ADVISE hints on any stripe units that 3323 overlap with the specified range, those hints SHOULD be indicated in 3324 the response. 3326 15.6. Operation 64: LAYOUTERROR - Provide Errors for the Layout 3328 15.6.1. ARGUMENT 3330 struct device_error4 { 3331 deviceid4 de_deviceid; 3332 nfsstat4 de_status; 3333 nfs_opnum4 de_opnum; 3334 }; 3336 struct LAYOUTERROR4args { 3337 /* CURRENT_FH: file */ 3338 offset4 lea_offset; 3339 length4 lea_length; 3340 stateid4 lea_stateid; 3341 device_error4 lea_errors; 3342 }; 3344 15.6.2. RESULT 3346 struct LAYOUTERROR4res { 3347 nfsstat4 ler_status; 3348 }; 3350 15.6.3. DESCRIPTION 3352 The client can use LAYOUTERROR to inform the metadata server about 3353 errors in its interaction with the layout represented by the current 3354 filehandle, client ID (derived from the session ID in the preceding 3355 SEQUENCE operation), byte-range (lea_offset + lea_length), and 3356 lea_stateid. 3358 Each individual device_error4 describes a single error associated 3359 with a storage device, which is identified via de_deviceid. If the 3360 Layout Type supports NFSv4 operations, then the operation which 3361 returned the error is identified via de_opnum. If the Layout Type 3362 does not support NFSv4 operations, then it MAY chose to either map 3363 the operation onto one of the allowed operations which can be sent to 3364 a storage device with the File Layout Type (see Section 3.3) or it 3365 can signal no support for operations by marking de_opnum with the 3366 ILLEGAL operation. Finally the NFS error value (nfsstat4) 3367 encountered is provided via de_status and may consist of the 3368 following error codes: 3370 NFS4ERR_NXIO: The client was unable to establish any communication 3371 with the storage device. 3373 NFS4ERR_*: The client was able to establish communication with the 3374 storage device and is returning one of the allowed error codes for 3375 the operation denoted by de_opnum. 3377 Note that while the metadata server may return an error associated 3378 with the layout stateid or the open file, it MUST NOT return an error 3379 in the processing of the errors. If LAYOUTERROR is in a compound 3380 before LAYOUTRETURN, it MUST NOT introduce an error other than what 3381 LAYOUTRETURN would already encounter. 3383 15.6.4. IMPLEMENTATION 3385 There are two broad classes of errors, transient and persistent. The 3386 client SHOULD strive to only use this new mechanism to report 3387 persistent errors. It MUST be able to deal with transient issues by 3388 itself. Also, while the client might consider an issue to be 3389 persistent, it MUST be prepared for the metadata server to consider 3390 such issues to be transient. A prime example of this is if the 3391 metadata server fences off a client from either a stateid or a 3392 filehandle. The client will get an error from the storage device and 3393 might relay either NFS4ERR_ACCESS or NFS4ERR_BAD_STATEID back to the 3394 metadata server, with the belief that this is a hard error. If the 3395 metadata server is informed by the client that there is an error, it 3396 can safely ignore that. For it, the mission is accomplished in that 3397 the client has returned a layout that the metadata server had most 3398 likely recalled. 3400 The client might also need to inform the metadata server that it 3401 cannot reach one or more of the storage devices. While the metadata 3402 server can detect the connectivity of both of these paths: 3404 o metadata server to storage device 3406 o metadata server to client 3408 it cannot determine if the client and storage device path is working. 3409 As with the case of the storage device passing errors to the client, 3410 it must be prepared for the metadata server to consider such outages 3411 as being transitory. 3413 Clients are expected to tolerate transient storage device errors, and 3414 hence clients SHOULD NOT use the LAYOUTERROR error handling for 3415 device access problems that may be transient. The methods by which a 3416 client decides whether a device access problem is transient vs 3417 persistent are implementation-specific, but may include retrying I/Os 3418 to a data server under appropriate conditions. 3420 When an I/O fails to a storage device, the client SHOULD retry the 3421 failed I/O via the metadata server. In this situation, before 3422 retrying the I/O, the client SHOULD return the layout, or the 3423 affected portion thereof, and SHOULD indicate which storage device or 3424 devices was problematic. The client needs to do this when the 3425 storage device is being unresponsive in order to fence off any failed 3426 write attempts, and ensure that they do not end up overwriting any 3427 later data being written through the metadata server. If the client 3428 does not do this, the metadata server MAY issue a layout recall 3429 callback in order to perform the retried I/O. 3431 The client needs to be cognizant that since this error handling is 3432 optional in the metadata server, the metadata server may silently 3433 ignore this functionality. Also, as the metadata server may consider 3434 some issues the client reports to be expected, the client might find 3435 it difficult to detect a metadata server which has not implemented 3436 error handling via LAYOUTERROR. 3438 If an metadata server is aware that a storage device is proving 3439 problematic to a client, the metadata server SHOULD NOT include that 3440 storage device in any pNFS layouts sent to that client. If the 3441 metadata server is aware that a storage device is affecting many 3442 clients, then the metadata server SHOULD NOT include that storage 3443 device in any pNFS layouts sent out. If a client asks for a new 3444 layout for the file from the metadata server, it MUST be prepared for 3445 the metadata server to return that storage device in the layout. The 3446 metadata server might not have any choice in using the storage 3447 device, i.e., there might only be one possible layout for the system. 3448 Also, in the case of existing files, the metadata server might have 3449 no choice in which storage devices to hand out to clients. 3451 The metadata server is not required to indefinitely retain per-client 3452 storage device error information. An metadata server is also not 3453 required to automatically reinstate use of a previously problematic 3454 storage device; administrative intervention may be required instead. 3456 15.7. Operation 65: LAYOUTSTATS - Provide Statistics for the Layout 3458 15.7.1. ARGUMENT 3460 struct layoutupdate4 { 3461 layouttype4 lou_type; 3462 opaque lou_body<>; 3463 }; 3465 struct io_info4 { 3466 uint32_t ii_count; 3467 uint64_t ii_bytes; 3468 }; 3470 struct LAYOUTSTATS4args { 3471 /* CURRENT_FH: file */ 3472 offset4 lsa_offset; 3473 length4 lsa_length; 3474 stateid4 lsa_stateid; 3475 io_info4 lsa_read; 3476 io_info4 lsa_write; 3477 layoutupdate4 lsa_layoutupdate; 3478 }; 3480 15.7.2. RESULT 3481 struct LAYOUTSTATS4res { 3482 nfsstat4 lsr_status; 3483 }; 3485 15.7.3. DESCRIPTION 3487 The client can use LAYOUTSTATS to inform the metadata server about 3488 its interaction with the layout represented by the current 3489 filehandle, client ID (derived from the session ID in the preceding 3490 SEQUENCE operation), byte-range (lea_offset + lea_length), and 3491 lea_stateid. lsa_read and lsa_write allow for non-Layout Type 3492 specific statistics to be reported. The remaining information the 3493 client is presenting is specific to the Layout Type and presented in 3494 the lea_layoutupdate field. Each Layout Type MUST define the 3495 contents of lea_layoutupdate in their respective specifications. 3497 LAYOUTSTATS can be combined with IO_ADVISE (see Section 15.5) to 3498 augment the decision making process of how the metadata server 3499 handles a file. I.e., IO_ADVISE lets the server know that a byte 3500 range has a certain characteristic, but not necessarily the intensity 3501 of that characteristic. 3503 The client MUST reset the statistics after getting a successfully 3504 reply from the metadata server. The first LAYOUTSTATS sent by the 3505 client SHOULD be from the opening of the file. The choice of how 3506 often to update the metadata server is made by the client. 3508 Note that while the metadata server may return an error associated 3509 with the layout stateid or the open file, it MUST NOT return an error 3510 in the processing of the statistics. 3512 15.8. Operation 66: OFFLOAD_CANCEL - Stop an Offloaded Operation 3514 15.8.1. ARGUMENT 3516 struct OFFLOAD_CANCEL4args { 3517 /* CURRENT_FH: file to cancel */ 3518 stateid4 oca_stateid; 3519 }; 3521 15.8.2. RESULT 3523 struct OFFLOAD_CANCEL4res { 3524 nfsstat4 ocr_status; 3525 }; 3527 15.8.3. DESCRIPTION 3529 OFFLOAD_CANCEL is used by the client to terminate an asynchronous 3530 operation, which is identified both by CURRENT_FH and the 3531 oca_stateid. I.e., there can be multiple offloaded operations acting 3532 on the file, the stateid will identify to the server exactly which 3533 one is to be stopped. Currently there are only two operations which 3534 can decide to be asynchronous: COPY and WRITE_SAME. 3536 In the context of server-to-server copy, the client can send 3537 OFFLOAD_CANCEL to either the source or destination server, albeit 3538 with a different stateid. The client uses OFFLOAD_CANCEL to inform 3539 the destination to stop the active transfer and uses the stateid it 3540 got back from the COPY operation. The client uses OFFLOAD_CANCEL and 3541 the stateid it used in the COPY_NOTIFY to inform the source to not 3542 allow any more copying from the destination. 3544 OFFLOAD_CANCEL is also useful in situations in which the source 3545 server granted a very long or infinite lease on the destination 3546 server's ability to read the source file and all copy operations on 3547 the source file have been completed. 3549 15.9. Operation 67: OFFLOAD_STATUS - Poll for Status of Asynchronous 3550 Operation 3552 15.9.1. ARGUMENT 3554 struct OFFLOAD_STATUS4args { 3555 /* CURRENT_FH: destination file */ 3556 stateid4 osa_stateid; 3557 }; 3559 15.9.2. RESULT 3561 struct OFFLOAD_STATUS4resok { 3562 length4 osr_count; 3563 nfsstat4 osr_complete<1>; 3564 }; 3566 union OFFLOAD_STATUS4res switch (nfsstat4 osr_status) { 3567 case NFS4_OK: 3568 OFFLOAD_STATUS4resok osr_resok4; 3569 default: 3570 void; 3571 }; 3573 15.9.3. DESCRIPTION 3575 OFFLOAD_STATUS can be used by the client to query the progress of an 3576 asynchronous operation, which is identified both by CURRENT_FH and 3577 the osa_stateid. If this operation is successful, the number of 3578 bytes processed are returned to the client in the osr_count field. 3580 If the optional osr_complete field is present, the asynchronous 3581 operation has completed. In this case the status value indicates the 3582 result of the asynchronous operation. In all cases, the server will 3583 also deliver the final results of the asynchronous operation in a 3584 CB_OFFLOAD operation. 3586 The failure of this operation does not indicate the result of the 3587 asynchronous operation in any way. 3589 15.10. Operation 68: READ_PLUS - READ Data or Holes from a File 3591 15.10.1. ARGUMENT 3593 struct READ_PLUS4args { 3594 /* CURRENT_FH: file */ 3595 stateid4 rpa_stateid; 3596 offset4 rpa_offset; 3597 count4 rpa_count; 3598 }; 3600 15.10.2. RESULT 3602 enum data_content4 { 3603 NFS4_CONTENT_DATA = 0, 3604 NFS4_CONTENT_HOLE = 1 3605 }; 3607 struct data_info4 { 3608 offset4 di_offset; 3609 length4 di_length; 3610 }; 3612 struct data4 { 3613 offset4 d_offset; 3614 opaque d_data<>; 3615 }; 3616 union read_plus_content switch (data_content4 rpc_content) { 3617 case NFS4_CONTENT_DATA: 3618 data4 rpc_data; 3619 case NFS4_CONTENT_HOLE: 3620 data_info4 rpc_hole; 3621 default: 3622 void; 3623 }; 3625 /* 3626 * Allow a return of an array of contents. 3627 */ 3628 struct read_plus_res4 { 3629 bool rpr_eof; 3630 read_plus_content rpr_contents<>; 3631 }; 3633 union READ_PLUS4res switch (nfsstat4 rp_status) { 3634 case NFS4_OK: 3635 read_plus_res4 rp_resok4; 3636 default: 3637 void; 3638 }; 3640 15.10.3. DESCRIPTION 3642 The READ_PLUS operation is based upon the NFSv4.1 READ operation (see 3643 Section 18.22 of [RFC5661]) and similarly reads data from the regular 3644 file identified by the current filehandle. 3646 The client provides a rpa_offset of where the READ_PLUS is to start 3647 and a rpa_count of how many bytes are to be read. A rpa_offset of 3648 zero means to read data starting at the beginning of the file. If 3649 rpa_offset is greater than or equal to the size of the file, the 3650 status NFS4_OK is returned with di_length (the data length) set to 3651 zero and eof set to TRUE. 3653 The READ_PLUS result is comprised of an array of rpr_contents, each 3654 of which describe a data_content4 type of data. For NFSv4.2, the 3655 allowed values are data and hole. A server MUST support both the 3656 data type and the hole if it uses READ_PLUS. If it does not want to 3657 support a hole, it MUST use READ. The array contents MUST be 3658 contiguous in the file. 3660 Holes SHOULD be returned in their entirety - clients must be prepared 3661 to get more information than they requested. Both the start and the 3662 end of the hole may exceed what was requested. If data to be 3663 returned is comprised entirely of zeros, then the server SHOULD 3664 return that data as a hole instead. 3666 The server may elect to return adjacent elements of the same type. 3667 For example, if the server has a range of data comprised entirely of 3668 zeros and then a hole, it might want to return two adjacent holes to 3669 the client. 3671 If the client specifies a rpa_count value of zero, the READ_PLUS 3672 succeeds and returns zero bytes of data. In all situations, the 3673 server may choose to return fewer bytes than specified by the client. 3674 The client needs to check for this condition and handle the condition 3675 appropriately. 3677 If the client specifies an rpa_offset and rpa_count value that is 3678 entirely contained within a hole of the file, then the di_offset and 3679 di_length returned MAY be for the entire hole. If the the owner has 3680 a locked byte range covering rpa_offset and rpa_count entirely the 3681 di_offset and di_length MUST NOT be extended outside the locked byte 3682 range. This result is considered valid until the file is changed 3683 (detected via the change attribute). The server MUST provide the 3684 same semantics for the hole as if the client read the region and 3685 received zeroes; the implied holes contents lifetime MUST be exactly 3686 the same as any other read data. 3688 If the client specifies an rpa_offset and rpa_count value that begins 3689 in a non-hole of the file but extends into hole the server should 3690 return an array comprised of both data and a hole. The client MUST 3691 be prepared for the server to return a short read describing just the 3692 data. The client will then issue another READ_PLUS for the remaining 3693 bytes, which the server will respond with information about the hole 3694 in the file. 3696 Except when special stateids are used, the stateid value for a 3697 READ_PLUS request represents a value returned from a previous byte- 3698 range lock or share reservation request or the stateid associated 3699 with a delegation. The stateid identifies the associated owners if 3700 any and is used by the server to verify that the associated locks are 3701 still valid (e.g., have not been revoked). 3703 If the read ended at the end-of-file (formally, in a correctly formed 3704 READ_PLUS operation, if rpa_offset + rpa_count is equal to the size 3705 of the file), or the READ_PLUS operation extends beyond the size of 3706 the file (if rpa_offset + rpa_count is greater than the size of the 3707 file), eof is returned as TRUE; otherwise, it is FALSE. A successful 3708 READ_PLUS of an empty file will always return eof as TRUE. 3710 If the current filehandle is not an ordinary file, an error will be 3711 returned to the client. In the case that the current filehandle 3712 represents an object of type NF4DIR, NFS4ERR_ISDIR is returned. If 3713 the current filehandle designates a symbolic link, NFS4ERR_SYMLINK is 3714 returned. In all other cases, NFS4ERR_WRONG_TYPE is returned. 3716 For a READ_PLUS with a stateid value of all bits equal to zero, the 3717 server MAY allow the READ_PLUS to be serviced subject to mandatory 3718 byte-range locks or the current share deny modes for the file. For a 3719 READ_PLUS with a stateid value of all bits equal to one, the server 3720 MAY allow READ_PLUS operations to bypass locking checks at the 3721 server. 3723 On success, the current filehandle retains its value. 3725 15.10.3.1. Note on Client Support of Arms of the Union 3727 It was decided not to add a means for the client to inform the server 3728 as to which arms of READ_PLUS it would support. In a later minor 3729 version, it may become necessary for the introduction of a new 3730 operation which would allow the client to inform the server as to 3731 whether it supported the new arms of the union of data types 3732 available in READ_PLUS. 3734 15.10.4. IMPLEMENTATION 3736 In general, the IMPLEMENTATION notes for READ in Section 18.22.4 of 3737 [RFC5661] also apply to READ_PLUS. 3739 15.10.4.1. Additional pNFS Implementation Information 3741 With pNFS, the semantics of using READ_PLUS remains the same. Any 3742 data server MAY return a hole result for a READ_PLUS request that it 3743 receives. When a data server chooses to return such a result, it has 3744 the option of returning information for the data stored on that data 3745 server (as defined by the data layout), but it MUST NOT return 3746 results for a byte range that includes data managed by another data 3747 server. 3749 If mandatory locking is enforced, then the data server must also 3750 ensure that to return only information that is within the owner's 3751 locked byte range. 3753 15.10.5. READ_PLUS with Sparse Files Example 3755 The following table describes a sparse file. For each byte range, 3756 the file contains either non-zero data or a hole. In addition, the 3757 server in this example will only create a hole if it is greater than 3758 32K. 3760 +-------------+----------+ 3761 | Byte-Range | Contents | 3762 +-------------+----------+ 3763 | 0-15999 | Hole | 3764 | 16K-31999 | Non-Zero | 3765 | 32K-255999 | Hole | 3766 | 256K-287999 | Non-Zero | 3767 | 288K-353999 | Hole | 3768 | 354K-417999 | Non-Zero | 3769 +-------------+----------+ 3771 Table 5 3773 Under the given circumstances, if a client was to read from the file 3774 with a max read size of 64K, the following will be the results for 3775 the given READ_PLUS calls. This assumes the client has already 3776 opened the file, acquired a valid stateid ('s' in the example), and 3777 just needs to issue READ_PLUS requests. 3779 1. READ_PLUS(s, 0, 64K) --> NFS_OK, eof = false, . Since the first hole is less than the server's 3781 minimum hole size, the first 32K of the file is returned as data 3782 and the remaining 32K is returned as a hole which actually 3783 extends to 256K. 3785 2. READ_PLUS(s, 32K, 64K) --> NFS_OK, eof = false, 3786 The requested range was all zeros, and the current hole begins at 3787 offset 32K and is 224K in length. Note that the client should 3788 not have followed up the previous READ_PLUS request with this one 3789 as the hole information from the previous call extended past what 3790 the client was requesting. 3792 3. READ_PLUS(s, 256K, 64K) --> NFS_OK, eof = false, . Returns an array of the 32K data and 3794 the hole which extends to 354K. 3796 4. READ_PLUS(s, 354K, 64K) --> NFS_OK, eof = true, . Returns the final 64K of data and informs the client 3798 there is no more data in the file. 3800 15.11. Operation 69: SEEK - Find the Next Data or Hole 3802 15.11.1. ARGUMENT 3804 enum data_content4 { 3805 NFS4_CONTENT_DATA = 0, 3806 NFS4_CONTENT_HOLE = 1 3807 }; 3809 struct SEEK4args { 3810 /* CURRENT_FH: file */ 3811 stateid4 sa_stateid; 3812 offset4 sa_offset; 3813 data_content4 sa_what; 3814 }; 3816 15.11.2. RESULT 3818 struct seek_res4 { 3819 bool sr_eof; 3820 offset4 sr_offset; 3821 }; 3823 union SEEK4res switch (nfsstat4 sa_status) { 3824 case NFS4_OK: 3825 seek_res4 resok4; 3826 default: 3827 void; 3828 }; 3830 15.11.3. DESCRIPTION 3832 SEEK is an operation that allows a client to determine the location 3833 of the next data_content4 in a file. It allows an implementation of 3834 the emerging extension to lseek(2) to allow clients to determine the 3835 next hole whilst in data or the next data whilst in a hole. 3837 From the given sa_offset, find the next data_content4 of type sa_what 3838 in the file. If the server can not find a corresponding sa_what, 3839 then the status will still be NFS4_OK, but sr_eof would be TRUE. If 3840 the server can find the sa_what, then the sr_offset is the start of 3841 that content. If the sa_offset is beyond the end of the file, then 3842 SEEK MUST return NFS4ERR_NXIO. 3844 All files MUST have a virtual hole at the end of the file. I.e., if 3845 a filesystem does not support sparse files, then a compound with 3846 {SEEK 0 NFS4_CONTENT_HOLE;} would return a result of {SEEK 1 X;} 3847 where 'X' was the size of the file. 3849 SEEK must follow the same rules for stateids as READ_PLUS 3850 (Section 15.10.3). 3852 15.12. Operation 70: WRITE_SAME - WRITE an ADB Multiple Times to a File 3854 15.12.1. ARGUMENT 3856 enum stable_how4 { 3857 UNSTABLE4 = 0, 3858 DATA_SYNC4 = 1, 3859 FILE_SYNC4 = 2 3860 }; 3862 struct app_data_block4 { 3863 offset4 adb_offset; 3864 length4 adb_block_size; 3865 length4 adb_block_count; 3866 length4 adb_reloff_blocknum; 3867 count4 adb_block_num; 3868 length4 adb_reloff_pattern; 3869 opaque adb_pattern<>; 3870 }; 3872 struct WRITE_SAME4args { 3873 /* CURRENT_FH: file */ 3874 stateid4 wsa_stateid; 3875 stable_how4 wsa_stable; 3876 app_data_block4 wsa_adb; 3877 }; 3879 15.12.2. RESULT 3881 struct write_response4 { 3882 stateid4 wr_callback_id<1>; 3883 length4 wr_count; 3884 stable_how4 wr_committed; 3885 verifier4 wr_writeverf; 3886 }; 3887 union WRITE_SAME4res switch (nfsstat4 wsr_status) { 3888 case NFS4_OK: 3889 write_response4 resok4; 3890 default: 3891 void; 3892 }; 3894 15.12.3. DESCRIPTION 3896 The WRITE_SAME operation writes an application data block to the 3897 regular file identified by the current filehandle (see WRITE SAME 3898 (10) in [T10-SBC2]). The target file is specified by the current 3899 filehandle. The data to be written is specified by an 3900 app_data_block4 structure (Section 8.1.1). The client specifies with 3901 the wsa_stable parameter the method of how the data is to be 3902 processed by the server. It is treated like the stable parameter in 3903 the NFSv4.1 WRITE operation (see Section 18.2 of [RFC5661]). 3905 A successful WRITE_SAME will construct a reply for wr_count, 3906 wr_committed, and wr_writeverf as per the NFSv4.1 WRITE operation 3907 results. If wr_callback_id is set, it indicates an asynchronous 3908 reply (see Section 15.12.3.1). 3910 WRITE_SAME has to support all of the errors which are returned by 3911 WRITE plus NFS4ERR_NOTSUPP, i.e., it is an OPTIONAL operation. If 3912 the client supports WRITE_SAME, it MUST support CB_OFFLOAD. 3914 If the server supports ADBs, then it MUST support the WRITE_SAME 3915 operation. The server has no concept of the structure imposed by the 3916 application. It is only when the application writes to a section of 3917 the file does order get imposed. In order to detect corruption even 3918 before the application utilizes the file, the application will want 3919 to initialize a range of ADBs using WRITE_SAME. 3921 When the client invokes the WRITE_SAME operation, it wants to record 3922 the block structure described by the app_data_block4 on to the file. 3924 When the server receives the WRITE_SAME operation, it MUST populate 3925 adb_block_count ADBs in the file starting at adb_offset. The block 3926 size will be given by adb_block_size. The ADBN (if provided) will 3927 start at adb_reloff_blocknum and each block will be monotonically 3928 numbered starting from adb_block_num in the first block. The pattern 3929 (if provided) will be at adb_reloff_pattern of each block and will be 3930 provided in adb_pattern. 3932 The server SHOULD return an asynchronous result if it can determine 3933 the operation will be long running (see Section 15.12.3.1). Once 3934 either the WRITE_SAME finishes synchronously or the server uses 3935 CB_OFFLOAD to inform the client of the asynchronous completion of the 3936 WRITE_SAME, the server MUST return the ADBs to clients as data. 3938 15.12.3.1. Asynchronous Transactions 3940 ADB initialization may lead to server determining to service the 3941 operation asynchronously. If it decides to do so, it sets the 3942 stateid in wr_callback_id to be that of the wsa_stateid. If it does 3943 not set the wr_callback_id, then the result is synchronous. 3945 When the client determines that the reply will be given 3946 asynchronously, it should not assume anything about the contents of 3947 what it wrote until it is informed by the server that the operation 3948 is complete. It can use OFFLOAD_STATUS (Section 15.9) to monitor the 3949 operation and OFFLOAD_CANCEL (Section 15.8) to cancel the operation. 3950 An example of a asynchronous WRITE_SAME is shown in Figure 6. Note 3951 that as with the COPY operation, WRITE_SAME must provide a stateid 3952 for tracking the asynchronous operation. 3954 Client Server 3955 + + 3956 | | 3957 |--- OPEN ---------------------------->| Client opens 3958 |<------------------------------------/| the file 3959 | | 3960 |--- WRITE_SAME ----------------------->| Client initializes 3961 |<------------------------------------/| an ADB 3962 | | 3963 | | 3964 |--- OFFLOAD_STATUS ------------------>| Client may poll 3965 |<------------------------------------/| for status 3966 | | 3967 | . | Multiple OFFLOAD_STATUS 3968 | . | operations may be sent. 3969 | . | 3970 | | 3971 |<-- CB_OFFLOAD -----------------------| Server reports results 3972 |\------------------------------------>| 3973 | | 3974 |--- CLOSE --------------------------->| Client closes 3975 |<------------------------------------/| the file 3976 | | 3977 | | 3979 Figure 6: An asynchronous WRITE_SAME. 3981 When CB_OFFLOAD informs the client of the successful WRITE_SAME, the 3982 write_response4 embedded in the operation will provide the necessary 3983 information that a synchronous WRITE_SAME would have provided. 3985 Regardless of whether the operation is asynchronous or synchronous, 3986 it MUST still support the COMMIT operation semantics as outlined in 3987 Section 18.3 of [RFC5661]. I.e., COMMIT works on one or more WRITE 3988 operations and the WRITE_SAME operation can appear as several WRITE 3989 operations to the server. The client can use locking operations to 3990 control the behavior on the server with respect to long running 3991 asynchronous write operations. 3993 15.12.3.2. Error Handling of a Partially Complete WRITE_SAME 3995 WRITE_SAME will clone adb_block_count copies of the given ADB in 3996 consecutive order in the file starting at adb_offset. An error can 3997 occur after writing the Nth ADB to the file. WRITE_SAME MUST appear 3998 to populate the range of the file as if the client used WRITE to 3999 transfer the instantiated ADBs. I.e., the contents of the range will 4000 be easy for the client to determine in case of a partially complete 4001 WRITE_SAME. 4003 16. NFSv4.2 Callback Operations 4005 16.1. Operation 15: CB_OFFLOAD - Report results of an asynchronous 4006 operation 4008 16.1.1. ARGUMENT 4010 struct write_response4 { 4011 stateid4 wr_callback_id<1>; 4012 length4 wr_count; 4013 stable_how4 wr_committed; 4014 verifier4 wr_writeverf; 4015 }; 4017 union offload_info4 switch (nfsstat4 coa_status) { 4018 case NFS4_OK: 4019 write_response4 coa_resok4; 4020 default: 4021 length4 coa_bytes_copied; 4022 }; 4023 struct CB_OFFLOAD4args { 4024 nfs_fh4 coa_fh; 4025 stateid4 coa_stateid; 4026 offload_info4 coa_offload_info; 4027 }; 4029 16.1.2. RESULT 4031 struct CB_OFFLOAD4res { 4032 nfsstat4 cor_status; 4033 }; 4035 16.1.3. DESCRIPTION 4037 CB_OFFLOAD is used to report to the client the results of an 4038 asynchronous operation, e.g., Server Side Copy or WRITE_SAME. The 4039 coa_fh and coa_stateid identify the transaction and the coa_status 4040 indicates success or failure. The coa_resok4.wr_callback_id MUST NOT 4041 be set. If the transaction failed, then the coa_bytes_copied 4042 contains the number of bytes copied before the failure occurred. The 4043 coa_bytes_copied value indicates the number of bytes copied but not 4044 which specific bytes have been copied. 4046 If the client supports any of the following operations: 4048 COPY: for both intra-server and inter-server asynchronous copies 4050 WRITE_SAME: for ADB initialization 4052 then the client is REQUIRED to support the CB_OFFLOAD operation. 4054 There is a potential race between the reply to the original 4055 transaction on the forechannel and the CB_OFFLOAD callback on the 4056 backchannel. Sections 2.10.6.3 and 20.9.3 of [RFC5661] describe how 4057 to handle this type of issue. 4059 Upon success, the coa_resok4.wr_count presents for each operation: 4061 COPY: the total number of bytes copied 4063 WRITE_SAME: the same information that a synchronous WRITE_SAME would 4064 provide 4066 17. Security Considerations 4068 NFSv4.2 has all of the security concerns present in NFSv4.1 (see 4069 Section 21 of [RFC5661]) and those present in the Server Side Copy 4070 (see Section 4.10) and in Labeled NFS (see Section 9.7). 4072 18. IANA Considerations 4074 The IANA Considerations for Labeled NFS are addressed in [Quigley14]. 4076 19. References 4078 19.1. Normative References 4080 [NFSv42xdr] 4081 Haynes, T., "Network File System (NFS) Version 4 Minor 4082 Version 2 External Data Representation Standard (XDR) 4083 Description", November 2014. 4085 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 4086 Resource Identifier (URI): Generic Syntax", STD 66, RFC 4087 3986, January 2005. 4089 [RFC5661] Shepler, S., Eisler, M., and D. Noveck, "Network File 4090 System (NFS) Version 4 Minor Version 1 Protocol", RFC 4091 5661, January 2010. 4093 [RFC5662] Shepler, S., Eisler, M., and D. Noveck, "Network File 4094 System (NFS) Version 4 Minor Version 1 External Data 4095 Representation Standard (XDR) Description", RFC 5662, 4096 January 2010. 4098 [RFC5664] Halevy, B., Welch, B., and J. Zelenka, "Object-Based 4099 Parallel NFS (pNFS) Operations", RFC 5664, January 2010. 4101 [posix_fadvise] 4102 The Open Group, "Section 'posix_fadvise()' of System 4103 Interfaces of The Open Group Base Specifications Issue 6, 4104 IEEE Std 1003.1, 2004 Edition", 2004. 4106 [posix_fallocate] 4107 The Open Group, "Section 'posix_fallocate()' of System 4108 Interfaces of The Open Group Base Specifications Issue 6, 4109 IEEE Std 1003.1, 2004 Edition", 2004. 4111 [rpcsec_gssv3] 4112 Adamson, W. and N. Williams, "Remote Procedure Call (RPC) 4113 Security Version 3", November 2014. 4115 19.2. Informative References 4117 [Ashdown08] 4118 Ashdown, L., "Chapter 15, Validating Database Files and 4119 Backups, of Oracle Database Backup and Recovery User's 4120 Guide 11g Release 1 (11.1)", August 2008. 4122 [BL73] Bell, D. and L. LaPadula, "Secure Computer Systems: 4123 Mathematical Foundations and Model", Technical Report 4124 M74-244, The MITRE Corporation, Bedford, MA, May 1973. 4126 [Baira08] Bairavasundaram, L., Goodson, G., Schroeder, B., Arpaci- 4127 Dusseau, A., and R. Arpaci-Dusseau, "An Analysis of Data 4128 Corruption in the Storage Stack", Proceedings of the 6th 4129 USENIX Symposium on File and Storage Technologies (FAST 4130 '08) , 2008. 4132 [I-D.ietf-nfsv4-rfc3530bis] 4133 Haynes, T. and D. Noveck, "Network File System (NFS) 4134 version 4 Protocol", draft-ietf-nfsv4-rfc3530bis-33 (Work 4135 In Progress), April 2014. 4137 [IESG08] ISEG, "IESG Processing of RFC Errata for the IETF Stream", 4138 2008. 4140 [McDougall07] 4141 McDougall, R. and J. Mauro, "Section 11.4.3, Detecting 4142 Memory Corruption of Solaris Internals", 2007. 4144 [NFSv4-Versioning] 4145 Haynes, T. and D. Noveck, "NFSv4 Version Management", 4146 November 2014. 4148 [Quigley14] 4149 Quigley, D., Lu, J., and T. Haynes, "Registry 4150 Specification for Mandatory Access Control (MAC) Security 4151 Label Formats", draft-ietf-nfsv4-lfs-registry-01 (work in 4152 progress), September 2014. 4154 [RFC1108] Kent, S., "Security Options for the Internet Protocol", 4155 RFC 1108, November 1991. 4157 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 4158 Requirement Levels", March 1997. 4160 [RFC2401] Kent, S. and R. Atkinson, "Security Architecture for the 4161 Internet Protocol", RFC 2401, November 1998. 4163 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 4164 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 4165 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 4167 [RFC4506] Eisler, M., "XDR: External Data Representation Standard", 4168 RFC 4506, May 2006. 4170 [RFC5663] Black, D., Fridella, S., and J. Glasgow, "Parallel NFS 4171 (pNFS) Block/Volume Layout", RFC 5663, January 2010. 4173 [RFC7204] Haynes, T., "Requirements for Labeled NFS", RFC 7204, 4174 April 2014. 4176 [RFC959] Postel, J. and J. Reynolds, "File Transfer Protocol", STD 4177 9, RFC 959, October 1985. 4179 [Strohm11] 4180 Strohm, R., "Chapter 2, Data Blocks, Extents, and 4181 Segments, of Oracle Database Concepts 11g Release 1 4182 (11.1)", January 2011. 4184 [T10-SBC2] 4185 Elliott, R., Ed., "ANSI INCITS 405-2005, Information 4186 Technology - SCSI Block Commands - 2 (SBC-2)", November 4187 2004. 4189 Appendix A. Acknowledgments 4191 Tom Haynes would like to thank NetApp, Inc. for its funding of his 4192 time on this project. 4194 For the pNFS Access Permissions Check, the original draft was by 4195 Sorin Faibish, David Black, Mike Eisler, and Jason Glasgow. The work 4196 was influenced by discussions with Benny Halevy and Bruce Fields. A 4197 review was done by Tom Haynes. 4199 For the Sharing change attribute implementation details with NFSv4 4200 clients, the original draft was by Trond Myklebust. 4202 For the NFS Server Side Copy, the original draft was by James 4203 Lentini, Mike Eisler, Deepak Kenchammana, Anshul Madan, and Rahul 4204 Iyer. Tom Talpey co-authored an unpublished version of that 4205 document. It was also was reviewed by a number of individuals: 4206 Pranoop Erasani, Tom Haynes, Arthur Lent, Trond Myklebust, Dave 4207 Noveck, Theresa Lingutla-Raj, Manjunath Shankararao, Satyam Vaghani, 4208 and Nico Williams. Anna Schumaker's early prototyping experience 4209 helped us avoid some traps. 4211 For the NFS space reservation operations, the original draft was by 4212 Mike Eisler, James Lentini, Manjunath Shankararao, and Rahul Iyer. 4214 For the sparse file support, the original draft was by Dean 4215 Hildebrand and Marc Eshel. Valuable input and advice was received 4216 from Sorin Faibish, Bruce Fields, Benny Halevy, Trond Myklebust, and 4217 Richard Scheffenegger. 4219 For the Application IO Hints, the original draft was by Dean 4220 Hildebrand, Mike Eisler, Trond Myklebust, and Sam Falkner. Some 4221 early reviewers included Benny Halevy and Pranoop Erasani. 4223 For Labeled NFS, the original draft was by David Quigley, James 4224 Morris, Jarret Lu, and Tom Haynes. Peter Staubach, Trond Myklebust, 4225 Stephen Smalley, Sorin Faibish, Nico Williams, and David Black also 4226 contributed in the final push to get this accepted. 4228 Christoph Hellwig was very helpful in getting the WRITE_SAME 4229 semantics to model more of what T10 was doing for WRITE SAME (10) 4230 [T10-SBC2]. And he led the push to get space reservations to more 4231 closely model the posix_fallocate. 4233 Andy Adamson picked up the RPCSEC_GSSv3 work, which enabled both 4234 Labeled NFS and Server Side Copy to be present more secure options. 4236 Christoph Hellwig provided the update to GETDEVICELIST. 4238 During the review process, Talia Reyes-Ortiz helped the sessions run 4239 smoothly. While many people contributed here and there, the core 4240 reviewers were Andy Adamson, Pranoop Erasani, Bruce Fields, Chuck 4241 Lever, Trond Myklebust, David Noveck, Peter Staubach, and Mike 4242 Kupfer. 4244 Appendix B. RFC Editor Notes 4246 [RFC Editor: please remove this section prior to publishing this 4247 document as an RFC] 4249 [RFC Editor: prior to publishing this document as an RFC, please 4250 replace all occurrences of NFSv42xdr with RFCxxxx where xxxx is the 4251 RFC number of the companion XDR document] 4253 Author's Address 4254 Thomas Haynes 4255 Primary Data, Inc. 4256 4300 El Camino Real Ste 100 4257 Los Altos, CA 94022 4258 USA 4260 Phone: +1 408 215 1519 4261 Email: thomas.haynes@primarydata.com