idnits 2.17.1 draft-ietf-nfsv4-minorversion2-19.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 (March 14, 2013) is 4060 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 4034 == Missing Reference: '32K' is mentioned on line 4034, but not defined ** Obsolete normative reference: RFC 5661 (Obsoleted by RFC 8881) == Outdated reference: A later version (-05) exists of draft-ietf-nfsv4-labreqs-03 == Outdated reference: A later version (-35) exists of draft-ietf-nfsv4-rfc3530bis-25 -- Obsolete informational reference (is this intentional?): RFC 2616 (Obsoleted by RFC 7230, RFC 7231, RFC 7232, RFC 7233, RFC 7234, RFC 7235) -- Obsolete informational reference (is this intentional?): RFC 5226 (Obsoleted by RFC 8126) Summary: 1 error (**), 0 flaws (~~), 4 warnings (==), 6 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 NFSv4 T. Haynes, Ed. 3 Internet-Draft NetApp 4 Intended status: Standards Track March 14, 2013 5 Expires: September 15, 2013 7 NFS Version 4 Minor Version 2 8 draft-ietf-nfsv4-minorversion2-19.txt 10 Abstract 12 This Internet-Draft describes NFS version 4 minor version two, 13 focusing mainly on the protocol extensions made from NFS version 4 14 minor version 0 and NFS version 4 minor version 1. Major extensions 15 introduced in NFS version 4 minor version two include: Server-side 16 Copy, Application I/O Advise, Space Reservations, Sparse Files, 17 Application Data Blocks, and Labeled NFS. 19 Requirements Language 21 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 22 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 23 document are to be interpreted as described in RFC 2119 [RFC2119]. 25 Status of this Memo 27 This Internet-Draft is submitted in full conformance with the 28 provisions of BCP 78 and BCP 79. 30 Internet-Drafts are working documents of the Internet Engineering 31 Task Force (IETF). Note that other groups may also distribute 32 working documents as Internet-Drafts. The list of current Internet- 33 Drafts is at http://datatracker.ietf.org/drafts/current/. 35 Internet-Drafts are draft documents valid for a maximum of six months 36 and may be updated, replaced, or obsoleted by other documents at any 37 time. It is inappropriate to use Internet-Drafts as reference 38 material or to cite them other than as "work in progress." 40 This Internet-Draft will expire on September 15, 2013. 42 Copyright Notice 44 Copyright (c) 2013 IETF Trust and the persons identified as the 45 document authors. All rights reserved. 47 This document is subject to BCP 78 and the IETF Trust's Legal 48 Provisions Relating to IETF Documents 49 (http://trustee.ietf.org/license-info) in effect on the date of 50 publication of this document. Please review these documents 51 carefully, as they describe your rights and restrictions with respect 52 to this document. Code Components extracted from this document must 53 include Simplified BSD License text as described in Section 4.e of 54 the Trust Legal Provisions and are provided without warranty as 55 described in the Simplified BSD License. 57 Table of Contents 59 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 5 60 1.1. The NFS Version 4 Minor Version 2 Protocol . . . . . . . 5 61 1.2. Scope of This Document . . . . . . . . . . . . . . . . . 5 62 1.3. NFSv4.2 Goals . . . . . . . . . . . . . . . . . . . . . . 5 63 1.4. Overview of NFSv4.2 Features . . . . . . . . . . . . . . 6 64 1.4.1. Server-side Copy . . . . . . . . . . . . . . . . . . . 6 65 1.4.2. Application I/O Advise . . . . . . . . . . . . . . . . 6 66 1.4.3. Sparse Files . . . . . . . . . . . . . . . . . . . . . 6 67 1.4.4. Space Reservation . . . . . . . . . . . . . . . . . . 6 68 1.4.5. Application Data Hole (ADH) Support . . . . . . . . . 6 69 1.4.6. Labeled NFS . . . . . . . . . . . . . . . . . . . . . 6 70 1.5. Differences from NFSv4.1 . . . . . . . . . . . . . . . . 7 71 2. Minor Versioning . . . . . . . . . . . . . . . . . . . . . . . 7 72 3. Server-side Copy . . . . . . . . . . . . . . . . . . . . . . . 10 73 3.1. Introduction . . . . . . . . . . . . . . . . . . . . . . 10 74 3.2. Protocol Overview . . . . . . . . . . . . . . . . . . . . 11 75 3.2.1. Overview of Copy Operations . . . . . . . . . . . . . 11 76 3.2.2. Locking the Files . . . . . . . . . . . . . . . . . . 12 77 3.2.3. Intra-Server Copy . . . . . . . . . . . . . . . . . . 12 78 3.2.4. Inter-Server Copy . . . . . . . . . . . . . . . . . . 14 79 3.2.5. Server-to-Server Copy Protocol . . . . . . . . . . . . 18 80 3.3. Requirements for Operations . . . . . . . . . . . . . . . 19 81 3.3.1. netloc4 - Network Locations . . . . . . . . . . . . . 20 82 3.3.2. Copy Offload Stateids . . . . . . . . . . . . . . . . 20 83 3.4. Security Considerations . . . . . . . . . . . . . . . . . 21 84 3.4.1. Inter-Server Copy Security . . . . . . . . . . . . . . 21 85 4. Support for Application IO Hints . . . . . . . . . . . . . . . 29 86 5. Sparse Files . . . . . . . . . . . . . . . . . . . . . . . . . 29 87 5.1. Introduction . . . . . . . . . . . . . . . . . . . . . . 29 88 5.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 30 89 5.3. New Operations . . . . . . . . . . . . . . . . . . . . . 30 90 5.3.1. READ_PLUS . . . . . . . . . . . . . . . . . . . . . . 31 91 5.3.2. WRITE_PLUS . . . . . . . . . . . . . . . . . . . . . . 31 92 6. Space Reservation . . . . . . . . . . . . . . . . . . . . . . 31 93 6.1. Introduction . . . . . . . . . . . . . . . . . . . . . . 31 94 7. Application Data Hole Support . . . . . . . . . . . . . . . . 33 95 7.1. Generic Framework . . . . . . . . . . . . . . . . . . . . 34 96 7.1.1. Data Hole Representation . . . . . . . . . . . . . . . 35 97 7.1.2. Data Content . . . . . . . . . . . . . . . . . . . . . 35 98 7.2. An Example of Detecting Corruption . . . . . . . . . . . 36 99 7.3. Example of READ_PLUS . . . . . . . . . . . . . . . . . . 37 100 8. Labeled NFS . . . . . . . . . . . . . . . . . . . . . . . . . 38 101 8.1. Introduction . . . . . . . . . . . . . . . . . . . . . . 38 102 8.2. Definitions . . . . . . . . . . . . . . . . . . . . . . . 39 103 8.3. MAC Security Attribute . . . . . . . . . . . . . . . . . 39 104 8.3.1. Delegations . . . . . . . . . . . . . . . . . . . . . 40 105 8.3.2. Permission Checking . . . . . . . . . . . . . . . . . 40 106 8.3.3. Object Creation . . . . . . . . . . . . . . . . . . . 41 107 8.3.4. Existing Objects . . . . . . . . . . . . . . . . . . . 41 108 8.3.5. Label Changes . . . . . . . . . . . . . . . . . . . . 41 109 8.4. pNFS Considerations . . . . . . . . . . . . . . . . . . . 42 110 8.5. Discovery of Server Labeled NFS Support . . . . . . . . . 42 111 8.6. MAC Security NFS Modes of Operation . . . . . . . . . . . 42 112 8.6.1. Full Mode . . . . . . . . . . . . . . . . . . . . . . 43 113 8.6.2. Guest Mode . . . . . . . . . . . . . . . . . . . . . . 44 114 8.7. Security Considerations . . . . . . . . . . . . . . . . . 44 115 9. Sharing change attribute implementation details with NFSv4 116 clients . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 117 9.1. Introduction . . . . . . . . . . . . . . . . . . . . . . 45 118 10. Security Considerations . . . . . . . . . . . . . . . . . . . 45 119 11. Error Values . . . . . . . . . . . . . . . . . . . . . . . . . 45 120 11.1. Error Definitions . . . . . . . . . . . . . . . . . . . . 46 121 11.1.1. General Errors . . . . . . . . . . . . . . . . . . . . 46 122 11.1.2. Server to Server Copy Errors . . . . . . . . . . . . . 46 123 11.1.3. Labeled NFS Errors . . . . . . . . . . . . . . . . . . 47 124 11.2. New Operations and Their Valid Errors . . . . . . . . . . 47 125 11.3. New Callback Operations and Their Valid Errors . . . . . 50 126 12. New File Attributes . . . . . . . . . . . . . . . . . . . . . 51 127 12.1. New RECOMMENDED Attributes - List and Definition 128 References . . . . . . . . . . . . . . . . . . . . . . . 51 129 12.2. Attribute Definitions . . . . . . . . . . . . . . . . . . 52 130 13. Operations: REQUIRED, RECOMMENDED, or OPTIONAL . . . . . . . . 55 131 14. NFSv4.2 Operations . . . . . . . . . . . . . . . . . . . . . . 59 132 14.1. Operation 59: COPY - Initiate a server-side copy . . . . 59 133 14.2. Operation 60: OFFLOAD_ABORT - Cancel a server-side 134 copy . . . . . . . . . . . . . . . . . . . . . . . . . . 66 135 14.3. Operation 61: COPY_NOTIFY - Notify a source server of 136 a future copy . . . . . . . . . . . . . . . . . . . . . . 67 137 14.4. Operation 62: OFFLOAD_REVOKE - Revoke a destination 138 server's copy privileges . . . . . . . . . . . . . . . . 68 139 14.5. Operation 63: OFFLOAD_STATUS - Poll for status of a 140 server-side copy . . . . . . . . . . . . . . . . . . . . 69 141 14.6. Modification to Operation 42: EXCHANGE_ID - 142 Instantiate Client ID . . . . . . . . . . . . . . . . . . 70 143 14.7. Operation 64: WRITE_PLUS . . . . . . . . . . . . . . . . 71 144 14.8. Operation 67: IO_ADVISE - Application I/O access 145 pattern hints . . . . . . . . . . . . . . . . . . . . . . 77 146 14.9. Changes to Operation 51: LAYOUTRETURN . . . . . . . . . . 82 147 14.10. Operation 65: READ_PLUS . . . . . . . . . . . . . . . . . 85 148 14.11. Operation 66: SEEK . . . . . . . . . . . . . . . . . . . 90 149 15. NFSv4.2 Callback Operations . . . . . . . . . . . . . . . . . 91 150 15.1. Operation 15: CB_OFFLOAD - Report results of an 151 asynchronous operation . . . . . . . . . . . . . . . . . 91 152 16. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 92 153 17. References . . . . . . . . . . . . . . . . . . . . . . . . . . 93 154 17.1. Normative References . . . . . . . . . . . . . . . . . . 93 155 17.2. Informative References . . . . . . . . . . . . . . . . . 93 156 Appendix A. Acknowledgments . . . . . . . . . . . . . . . . . . . 95 157 Appendix B. RFC Editor Notes . . . . . . . . . . . . . . . . . . 96 158 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 96 160 1. Introduction 162 1.1. The NFS Version 4 Minor Version 2 Protocol 164 The NFS version 4 minor version 2 (NFSv4.2) protocol is the third 165 minor version of the NFS version 4 (NFSv4) protocol. The first minor 166 version, NFSv4.0, is described in [I-D.ietf-nfsv4-rfc3530bis] and the 167 second minor version, NFSv4.1, is described in [RFC5661]. It follows 168 the guidelines for minor versioning that are listed in Section 11 of 169 [I-D.ietf-nfsv4-rfc3530bis]. 171 As a minor version, NFSv4.2 is consistent with the overall goals for 172 NFSv4, but extends the protocol so as to better meet those goals, 173 based on experiences with NFSv4.1. In addition, NFSv4.2 has adopted 174 some additional goals, which motivate some of the major extensions in 175 NFSv4.2. 177 1.2. Scope of This Document 179 This document describes the NFSv4.2 protocol. With respect to 180 NFSv4.0 and NFSv4.1, this document does not: 182 o describe the NFSv4.0 or NFSv4.1 protocols, except where needed to 183 contrast with NFSv4.2 185 o modify the specification of the NFSv4.0 or NFSv4.1 protocols 187 o clarify the NFSv4.0 or NFSv4.1 protocols. I.e., any 188 clarifications made here apply to NFSv4.2 and neither of the prior 189 protocols 191 The full XDR for NFSv4.2 is presented in [4.2xdr]. 193 1.3. NFSv4.2 Goals 195 The goal of the design of NFSv4.2 is to take common local file system 196 features and offer them remotely. These features might 198 o already be available on the servers, e.g., sparse files 200 o be under development as a new standard, e.g., SEEK_HOLE and 201 SEEK_DATA 203 o be used by clients with the servers via some proprietary means, 204 e.g., Labeled NFS 206 but the clients are not able to leverage them on the server within 207 the confines of the NFS protocol. 209 1.4. Overview of NFSv4.2 Features 211 1.4.1. Server-side Copy 213 A traditional file copy from one server to another results in the 214 data being put on the network twice - source to client and then 215 client to destination. New operations are introduced to allow the 216 client to authorize the two servers to interact directly. As this 217 copy can be lengthy, asynchronous support is also provided. 219 1.4.2. Application I/O Advise 221 Applications and clients want to advise the server as to expected I/O 222 behavior. Using IO_ADVISE (see Section 14.8) to communicate future 223 I/O behavior such as whether a file will be accessed sequentially or 224 randomly, and whether a file will or will not be accessed in the near 225 future, allows servers to optimize future I/O requests for a file by, 226 for example, prefetching or evicting data. This operation can be 227 used to support the posix_fadvise function as well as other 228 applications such as databases and video editors. 230 1.4.3. Sparse Files 232 Sparse files are ones which have unallocated data blocks as holes in 233 the file. Such holes are typically transferred as 0s during I/O. 234 READ_PLUS (see Section 14.10) allows a server to send back to the 235 client metadata describing the hole and WRITE_PLUS (see Section 14.7) 236 allows the client to punch holes into a file. In addition, SEEK (see 237 Section 14.11) is provided to scan for the next hole or data from a 238 given location. 240 1.4.4. Space Reservation 242 When a file is sparse, one concern applications have is ensuring that 243 there will always be enough data blocks available for the file during 244 future writes. A new attribute, space_reserved (see Section 12.2.4) 245 provides the client a guarantee that space will be available. 247 1.4.5. Application Data Hole (ADH) Support 249 Some applications treat a file as if it were a disk and as such want 250 to initialize (or format) the file image. We extend both READ_PLUS 251 and WRITE_PLUS to understand this metadata as a new form of a hole. 253 1.4.6. Labeled NFS 255 While both clients and servers can employ Mandatory Access Control 256 (MAC) security models to enforce data access, there has been no 257 protocol support to allow full interoperability. A new file object 258 attribute, sec_label (see Section 12.2.2) allows for the server to 259 store and enforce MAC labels. The format of the sec_label 260 accommodates any MAC security system. 262 1.5. Differences from NFSv4.1 264 In NFSv4.1, the only way to introduce new variants of an operation 265 was to introduce a new operation. I.e., READ becomes either READ2 or 266 READ_PLUS. With the use of discriminated unions as parameters to 267 such functions in NFSv4.2, it is possible to add a new arm in a 268 subsequent minor version. And it is also possible to move such an 269 operation from OPTIONAL/RECOMMENDED to REQUIRED. Forcing an 270 implementation to adopt each arm of a discriminated union at such a 271 time does not meet the spirit of the minor versioning rules. As 272 such, new arms of a discriminated union MUST follow the same 273 guidelines for minor versioning as operations in NFSv4.1 - i.e., they 274 may not be made REQUIRED. To support this, a new error code, 275 NFS4ERR_UNION_NOTSUPP, is introduced which allows the server to 276 communicate to the client that the operation is supported, but the 277 specific arm of the discriminated union is not. 279 2. Minor Versioning 281 To address the requirement of an NFS protocol that can evolve as the 282 need arises, the NFSv4 protocol contains the rules and framework to 283 allow for future minor changes or versioning. 285 The base assumption with respect to minor versioning is that any 286 future accepted minor version will be documented in one or more 287 Standards Track RFCs. Minor version 0 of the NFSv4 protocol is 288 represented by [I-D.ietf-nfsv4-rfc3530bis], minor version 1 by 289 [RFC5661], and minor version 2 by this document. The COMPOUND and 290 CB_COMPOUND procedures support the encoding of the minor version 291 being requested by the client. 293 The following items represent the basic rules for the development of 294 minor versions. Note that a future minor version may modify or add 295 to the following rules as part of the minor version definition. 297 1. Procedures are not added or deleted. 299 To maintain the general RPC model, NFSv4 minor versions will not 300 add to or delete procedures from the NFS program. 302 2. Minor versions may add operations to the COMPOUND and 303 CB_COMPOUND procedures. 305 The addition of operations to the COMPOUND and CB_COMPOUND 306 procedures does not affect the RPC model. 308 * Minor versions may append attributes to the bitmap4 that 309 represents sets of attributes and to the fattr4 that 310 represents sets of attribute values. 312 This allows for the expansion of the attribute model to allow 313 for future growth or adaptation. 315 * Minor version X must append any new attributes after the last 316 documented attribute. 318 Since attribute results are specified as an opaque array of 319 per-attribute, XDR-encoded results, the complexity of adding 320 new attributes in the midst of the current definitions would 321 be too burdensome. 323 3. Minor versions must not modify the structure of an existing 324 operation's arguments or results. 326 Again, the complexity of handling multiple structure definitions 327 for a single operation is too burdensome. New operations should 328 be added instead of modifying existing structures for a minor 329 version. 331 This rule does not preclude the following adaptations in a minor 332 version: 334 * adding bits to flag fields, such as new attributes to 335 GETATTR's bitmap4 data type, and providing corresponding 336 variants of opaque arrays, such as a notify4 used together 337 with such bitmaps 339 * adding bits to existing attributes like ACLs that have flag 340 words 342 * extending enumerated types (including NFS4ERR_*) with new 343 values 345 * adding cases to a switched union 347 4. Note that when adding new cases to a switched union, a minor 348 version must not make new cases be REQUIRED. While the 349 encapsulating operation may be REQUIRED, the new cases (the 350 specific arm of the discriminated union) is not. The error code 351 NFS4ERR_UNION_NOTSUPP is used to notifify the client when the 352 server does not support such a case. 354 5. Minor versions must not modify the structure of existing 355 attributes. 357 6. Minor versions must not delete operations. 359 This prevents the potential reuse of a particular operation 360 "slot" in a future minor version. 362 7. Minor versions must not delete attributes. 364 8. Minor versions must not delete flag bits or enumeration values. 366 9. Minor versions may declare an operation MUST NOT be implemented. 368 Specifying that an operation MUST NOT be implemented is 369 equivalent to obsoleting an operation. For the client, it means 370 that the operation MUST NOT be sent to the server. For the 371 server, an NFS error can be returned as opposed to "dropping" 372 the request as an XDR decode error. This approach allows for 373 the obsolescence of an operation while maintaining its structure 374 so that a future minor version can reintroduce the operation. 376 1. Minor versions may declare that an attribute MUST NOT be 377 implemented. 379 2. Minor versions may declare that a flag bit or enumeration 380 value MUST NOT be implemented. 382 10. Minor versions may declare an operation to be OBSOLESCENT, which 383 indicates an intention to remove the operation (i.e., make it 384 MANDATORY TO NOT implement) in a subsequent minor version. Such 385 labeling is separate from the question of whether the operation 386 is REQUIRED or RECOMMENDED or OPTIONAL in the current minor 387 version. An operation may be both REQUIRED for the given minor 388 version and marked OBSOLESCENT, with the expectation that it 389 will be MANDATORY TO NOT implement in the next (or other 390 subsequent) minor version. 392 11. Note that the early notification of operation obsolescence is 393 put in place to mitigate the effects of design and 394 implementation mistakes, and to allow protocol development to 395 adapt to unexpected changes in the pace of implementation. Even 396 if an operation is marked OBSOLESCENT in a given minor version, 397 it may end up not being marked MANDATORY TO NOT implement in the 398 next minor version. In unusual circumstances, it might not be 399 marked OBSOLESCENT in a subsequent minor version, and never 400 become MANDATORY TO NOT implement. 402 12. Minor versions may downgrade features from REQUIRED to 403 RECOMMENDED, from RECOMMENDED to OPTIONAL, or from OPIONAL to 404 MANDATORY TO NOT implement. Also, if a feature was marked as 405 OBSOLESCENT in the prior minor version, it may be downgraded 406 from REQUIRED to OPTIONAL from RECOMMENDED to MANDATORY TO NOT 407 implement, or from REQUIRED to MANDATORY TO NOT implement. 409 13. Minor versions may upgrade features from OPTIONAL to 410 RECOMMENDED, or RECOMMENDED to REQUIRED. Also, if a feature was 411 marked as OBSOLESCENT in the prior minor version, it may be 412 upgraded to not be OBSOLESCENT. 414 14. A client and server that support minor version X SHOULD support 415 minor versions 0 through X-1 as well. 417 15. Except for infrastructural changes, a minor version must not 418 introduce REQUIRED new features. 420 This rule allows for the introduction of new functionality and 421 forces the use of implementation experience before designating a 422 feature as REQUIRED. On the other hand, some classes of 423 features are infrastructural and have broad effects. Allowing 424 infrastructural features to be RECOMMENDED or OPTIONAL 425 complicates implementation of the minor version. 427 16. A client MUST NOT attempt to use a stateid, filehandle, or 428 similar returned object from the COMPOUND procedure with minor 429 version X for another COMPOUND procedure with minor version Y, 430 where X != Y. 432 3. Server-side Copy 434 3.1. Introduction 436 The server-side copy feature provides a mechanism for the NFS client 437 to perform a file copy on the server without the data being 438 transmitted back and forth over the network. Without this feature, 439 an NFS client copies data from one location to another by reading the 440 data from the server over the network, and then writing the data back 441 over the network to the server. Using this server-side copy 442 operation, the client is able to instruct the server to copy the data 443 locally without the data being sent back and forth over the network 444 unnecessarily. 446 If the source object and destination object are on different file 447 servers, the file servers will communicate with one another to 448 perform the copy operation. The server-to-server protocol by which 449 this is accomplished is not defined in this document. 451 3.2. Protocol Overview 453 The server-side copy offload operations support both intra-server and 454 inter-server file copies. An intra-server copy is a copy in which 455 the source file and destination file reside on the same server. In 456 an inter-server copy, the source file and destination file are on 457 different servers. In both cases, the copy may be performed 458 synchronously or asynchronously. 460 Throughout the rest of this document, we refer to the NFS server 461 containing the source file as the "source server" and the NFS server 462 to which the file is transferred as the "destination server". In the 463 case of an intra-server copy, the source server and destination 464 server are the same server. Therefore in the context of an intra- 465 server copy, the terms source server and destination server refer to 466 the single server performing the copy. 468 The operations described below are designed to copy files. Other 469 file system objects can be copied by building on these operations or 470 using other techniques. For example if the user wishes to copy a 471 directory, the client can synthesize a directory copy by first 472 creating the destination directory and then copying the source 473 directory's files to the new destination directory. If the user 474 wishes to copy a namespace junction [FEDFS-NSDB] [FEDFS-ADMIN], the 475 client can use the ONC RPC Federated Filesystem protocol 476 [FEDFS-ADMIN] to perform the copy. Specifically the client can 477 determine the source junction's attributes using the FEDFS_LOOKUP_FSN 478 procedure and create a duplicate junction using the 479 FEDFS_CREATE_JUNCTION procedure. 481 For the inter-server copy, the operations are defined to be 482 compatible with the traditional copy authentication approach. The 483 client and user are authorized at the source for reading. Then they 484 are authorized at the destination for writing. 486 3.2.1. Overview of Copy Operations 488 COPY_NOTIFY: For inter-server copies, the client sends this 489 operation to the source server to notify it of a future file copy 490 from a given destination server for the given user. 491 (Section 14.3) 493 OFFLOAD_REVOKE: Also for inter-server copies, the client sends this 494 operation to the source server to revoke permission to copy a file 495 for the given user. (Section 14.4) 497 COPY: Used by the client to request a file copy. (Section 14.1) 499 OFFLOAD_ABORT: Used by the client to abort an asynchronous file 500 copy. (Section 14.2) 502 OFFLOAD_STATUS: Used by the client to poll the status of an 503 asynchronous file copy. (Section 14.5) 505 CB_OFFLOAD: Used by the destination server to report the results of 506 an asynchronous file copy to the client. (Section 15.1) 508 3.2.2. Locking the Files 510 Both the source and destination file may need to be locked to protect 511 the content during the copy operations. A client can achieve this by 512 a combination of OPEN and LOCK operations. I.e., either share or 513 byte range locks might be desired. 515 3.2.3. Intra-Server Copy 517 To copy a file on a single server, the client uses a COPY operation. 518 The server may respond to the copy operation with the final results 519 of the copy or it may perform the copy asynchronously and deliver the 520 results using a CB_OFFLOAD operation callback. If the copy is 521 performed asynchronously, the client may poll the status of the copy 522 using OFFLOAD_STATUS or cancel the copy using OFFLOAD_ABORT. 524 A synchronous intra-server copy is shown in Figure 1. In this 525 example, the NFS server chooses to perform the copy synchronously. 526 The copy operation is completed, either successfully or 527 unsuccessfully, before the server replies to the client's request. 528 The server's reply contains the final result of the operation. 530 Client Server 531 + + 532 | | 533 |--- OPEN ---------------------------->| Client opens 534 |<------------------------------------/| the source file 535 | | 536 |--- OPEN ---------------------------->| Client opens 537 |<------------------------------------/| the destination file 538 | | 539 |--- COPY ---------------------------->| Client requests 540 |<------------------------------------/| a file copy 541 | | 542 |--- CLOSE --------------------------->| Client closes 543 |<------------------------------------/| the destination file 544 | | 545 |--- CLOSE --------------------------->| Client closes 546 |<------------------------------------/| the source file 547 | | 548 | | 550 Figure 1: A synchronous intra-server copy. 552 An asynchronous intra-server copy is shown in Figure 2. In this 553 example, the NFS server performs the copy asynchronously. The 554 server's reply to the copy request indicates that the copy operation 555 was initiated and the final result will be delivered at a later time. 556 The server's reply also contains a copy stateid. The client may use 557 this copy stateid to poll for status information (as shown) or to 558 cancel the copy using a OFFLOAD_ABORT. When the server completes the 559 copy, the server performs a callback to the client and reports the 560 results. 562 Client Server 563 + + 564 | | 565 |--- OPEN ---------------------------->| Client opens 566 |<------------------------------------/| the source file 567 | | 568 |--- OPEN ---------------------------->| Client opens 569 |<------------------------------------/| the destination file 570 | | 571 |--- COPY ---------------------------->| Client requests 572 |<------------------------------------/| a file copy 573 | | 574 | | 575 |--- OFFLOAD_STATUS ------------------>| Client may poll 576 |<------------------------------------/| for status 577 | | 578 | . | Multiple OFFLOAD_STATUS 579 | . | operations may be sent. 580 | . | 581 | | 582 |<-- CB_OFFLOAD -----------------------| Server reports results 583 |\------------------------------------>| 584 | | 585 |--- CLOSE --------------------------->| Client closes 586 |<------------------------------------/| the destination file 587 | | 588 |--- CLOSE --------------------------->| Client closes 589 |<------------------------------------/| the source file 590 | | 591 | | 593 Figure 2: An asynchronous intra-server copy. 595 3.2.4. Inter-Server Copy 597 A copy may also be performed between two servers. The copy protocol 598 is designed to accommodate a variety of network topologies. As shown 599 in Figure 3, the client and servers may be connected by multiple 600 networks. In particular, the servers may be connected by a 601 specialized, high speed network (network 192.0.2.0/24 in the diagram) 602 that does not include the client. The protocol allows the client to 603 setup the copy between the servers (over network 203.0.113.0/24 in 604 the diagram) and for the servers to communicate on the high speed 605 network if they choose to do so. 607 192.0.2.0/24 608 +-------------------------------------+ 609 | | 610 | | 611 | 192.0.2.18 | 192.0.2.56 612 +-------+------+ +------+------+ 613 | Source | | Destination | 614 +-------+------+ +------+------+ 615 | 203.0.113.18 | 203.0.113.56 616 | | 617 | | 618 | 203.0.113.0/24 | 619 +------------------+------------------+ 620 | 621 | 622 | 203.0.113.243 623 +-----+-----+ 624 | Client | 625 +-----------+ 627 Figure 3: An example inter-server network topology. 629 For an inter-server copy, the client notifies the source server that 630 a file will be copied by the destination server using a COPY_NOTIFY 631 operation. The client then initiates the copy by sending the COPY 632 operation to the destination server. The destination server may 633 perform the copy synchronously or asynchronously. 635 A synchronous inter-server copy is shown in Figure 4. In this case, 636 the destination server chooses to perform the copy before responding 637 to the client's COPY request. 639 An asynchronous copy is shown in Figure 5. In this case, the 640 destination server chooses to respond to the client's COPY request 641 immediately and then perform the copy asynchronously. 643 Client Source Destination 644 + + + 645 | | | 646 |--- OPEN --->| | Returns os1 647 |<------------------/| | 648 | | | 649 |--- COPY_NOTIFY --->| | 650 |<------------------/| | 651 | | | 652 |--- OPEN ---------------------------->| Returns os2 653 |<------------------------------------/| 654 | | | 655 |--- COPY ---------------------------->| 656 | | | 657 | | | 658 | |<----- read -----| 659 | |\--------------->| 660 | | | 661 | | . | Multiple reads may 662 | | . | be necessary 663 | | . | 664 | | | 665 | | | 666 |<------------------------------------/| Destination replies 667 | | | to COPY 668 | | | 669 |--- CLOSE --------------------------->| Release open state 670 |<------------------------------------/| 671 | | | 672 |--- CLOSE --->| | Release open state 673 |<------------------/| | 675 Figure 4: A synchronous inter-server copy. 677 Client Source Destination 678 + + + 679 | | | 680 |--- OPEN --->| | Returns os1 681 |<------------------/| | 682 | | | 683 |--- LOCK --->| | Optional, could be done 684 |<------------------/| | with a share lock 685 | | | 686 |--- COPY_NOTIFY --->| | Need to pass in 687 |<------------------/| | os1 or lock state 688 | | | 689 | | | 690 | | | 691 |--- OPEN ---------------------------->| Returns os2 692 |<------------------------------------/| 693 | | | 694 |--- LOCK ---------------------------->| Optional ... 695 |<------------------------------------/| 696 | | | 697 |--- COPY ---------------------------->| Need to pass in 698 |<------------------------------------/| os2 or lock state 699 | | | 700 | | | 701 | |<----- read -----| 702 | |\--------------->| 703 | | | 704 | | . | Multiple reads may 705 | | . | be necessary 706 | | . | 707 | | | 708 | | | 709 |--- OFFLOAD_STATUS ------------------>| Client may poll 710 |<------------------------------------/| for status 711 | | | 712 | | . | Multiple OFFLOAD_STATUS 713 | | . | operations may be sent 714 | | . | 715 | | | 716 | | | 717 | | | 718 |<-- CB_OFFLOAD -----------------------| Destination reports 719 |\------------------------------------>| results 720 | | | 721 |--- LOCKU --------------------------->| Only if LOCK was done 722 |<------------------------------------/| 723 | | | 724 |--- CLOSE --------------------------->| Release open state 725 |<------------------------------------/| 726 | | | 727 |--- LOCKU --->| | Only if LOCK was done 728 |<------------------/| | 729 | | | 730 |--- CLOSE --->| | Release open state 731 |<------------------/| | 732 | | | 734 Figure 5: An asynchronous inter-server copy. 736 3.2.5. Server-to-Server Copy Protocol 738 The source server and destination server are not required to use a 739 specific protocol to transfer the file data. The choice of what 740 protocol to use is ultimately the destination server's decision. 742 3.2.5.1. Using NFSv4.x as a Server-to-Server Copy Protocol 744 The destination server MAY use standard NFSv4.x (where x >= 1) to 745 read the data from the source server. If NFSv4.x is used for the 746 server-to-server copy protocol, the destination server can use the 747 filehandle contained in the COPY request with standard NFSv4.x 748 operations to read data from the source server. Specifically, the 749 destination server may use the NFSv4.x OPEN operation's CLAIM_FH 750 facility to open the file being copied and obtain an open stateid. 751 Using the stateid, the destination server may then use NFSv4.x READ 752 operations to read the file. 754 3.2.5.2. Using an alternative Server-to-Server Copy Protocol 756 In a homogeneous environment, the source and destination servers 757 might be able to perform the file copy extremely efficiently using 758 specialized protocols. For example the source and destination 759 servers might be two nodes sharing a common file system format for 760 the source and destination file systems. Thus the source and 761 destination are in an ideal position to efficiently render the image 762 of the source file to the destination file by replicating the file 763 system formats at the block level. Another possibility is that the 764 source and destination might be two nodes sharing a common storage 765 area network, and thus there is no need to copy any data at all, and 766 instead ownership of the file and its contents might simply be re- 767 assigned to the destination. To allow for these possibilities, the 768 destination server is allowed to use a server-to-server copy protocol 769 of its choice. 771 In a heterogeneous environment, using a protocol other than NFSv4.x 772 (e.g., HTTP [RFC2616] or FTP [RFC0959]) presents some challenges. In 773 particular, the destination server is presented with the challenge of 774 accessing the source file given only an NFSv4.x filehandle. 776 One option for protocols that identify source files with path names 777 is to use an ASCII hexadecimal representation of the source 778 filehandle as the file name. 780 Another option for the source server is to use URLs to direct the 781 destination server to a specialized service. For example, the 782 response to COPY_NOTIFY could include the URL 783 ftp://s1.example.com:9999/_FH/0x12345, where 0x12345 is the ASCII 784 hexadecimal representation of the source filehandle. When the 785 destination server receives the source server's URL, it would use 786 "_FH/0x12345" as the file name to pass to the FTP server listening on 787 port 9999 of s1.example.com. On port 9999 there would be a special 788 instance of the FTP service that understands how to convert NFS 789 filehandles to an open file descriptor (in many operating systems, 790 this would require a new system call, one which is the inverse of the 791 makefh() function that the pre-NFSv4 MOUNT service needs). 793 Authenticating and identifying the destination server to the source 794 server is also a challenge. Recommendations for how to accomplish 795 this are given in Section 3.4.1.2.4 and Section 3.4.1.4. 797 3.3. Requirements for Operations 799 The implementation of server-side copy is OPTIONAL by the client and 800 the server. However, in order to successfully copy a file, some 801 operations MUST be supported by the client and/or server. 803 If a client desires an intra-server file copy, then it MUST support 804 the COPY and CB_OFFLOAD operations. If COPY returns a stateid, then 805 the client MAY use the OFFLOAD_ABORT and OFFLOAD_STATUS operations. 807 If a client desires an inter-server file copy, then it MUST support 808 the COPY, COPY_NOTICE, and CB_OFFLOAD operations, and MAY use the 809 OFFLOAD_REVOKE operation. If COPY returns a stateid, then the client 810 MAY use the OFFLOAD_ABORT and OFFLOAD_STATUS operations. 812 If a server supports intra-server copy, then the server MUST support 813 the COPY operation. If a server's COPY operation returns a stateid, 814 then the server MUST also support these operations: CB_OFFLOAD, 815 OFFLOAD_ABORT, and OFFLOAD_STATUS. 817 If a source server supports inter-server copy, then the source server 818 MUST support all these operations: COPY_NOTIFY and OFFLOAD_REVOKE. 819 If a destination server supports inter-server copy, then the 820 destination server MUST support the COPY operation. If a destination 821 server's COPY operation returns a stateid, then the destination 822 server MUST also support these operations: CB_OFFLOAD, OFFLOAD_ABORT, 823 COPY_NOTIFY, OFFLOAD_REVOKE, and OFFLOAD_STATUS. 825 Each operation is performed in the context of the user identified by 826 the ONC RPC credential of its containing COMPOUND or CB_COMPOUND 827 request. For example, a OFFLOAD_ABORT operation issued by a given 828 user indicates that a specified COPY operation initiated by the same 829 user be canceled. Therefore a OFFLOAD_ABORT MUST NOT interfere with 830 a copy of the same file initiated by another user. 832 An NFS server MAY allow an administrative user to monitor or cancel 833 copy operations using an implementation specific interface. 835 3.3.1. netloc4 - Network Locations 837 The server-side copy operations specify network locations using the 838 netloc4 data type shown below: 840 enum netloc_type4 { 841 NL4_NAME = 0, 842 NL4_URL = 1, 843 NL4_NETADDR = 2 844 }; 845 union netloc4 switch (netloc_type4 nl_type) { 846 case NL4_NAME: utf8str_cis nl_name; 847 case NL4_URL: utf8str_cis nl_url; 848 case NL4_NETADDR: netaddr4 nl_addr; 849 }; 851 If the netloc4 is of type NL4_NAME, the nl_name field MUST be 852 specified as a UTF-8 string. The nl_name is expected to be resolved 853 to a network address via DNS, LDAP, NIS, /etc/hosts, or some other 854 means. If the netloc4 is of type NL4_URL, a server URL [RFC3986] 855 appropriate for the server-to-server copy operation is specified as a 856 UTF-8 string. If the netloc4 is of type NL4_NETADDR, the nl_addr 857 field MUST contain a valid netaddr4 as defined in Section 3.3.9 of 858 [RFC5661]. 860 When netloc4 values are used for an inter-server copy as shown in 861 Figure 3, their values may be evaluated on the source server, 862 destination server, and client. The network environment in which 863 these systems operate should be configured so that the netloc4 values 864 are interpreted as intended on each system. 866 3.3.2. Copy Offload Stateids 868 A server may perform a copy offload operation asynchronously. An 869 asynchronous copy is tracked using a copy offload stateid. Copy 870 offload stateids are included in the COPY, OFFLOAD_ABORT, 871 OFFLOAD_STATUS, and CB_OFFLOAD operations. 873 Section 8.2.4 of [RFC5661] specifies that stateids are valid until 874 either (A) the client or server restart or (B) the client returns the 875 resource. 877 A copy offload stateid will be valid until either (A) the client or 878 server restarts or (B) the client returns the resource by issuing a 879 OFFLOAD_ABORT operation or the client replies to a CB_OFFLOAD 880 operation. 882 A copy offload stateid's seqid MUST NOT be 0. In the context of a 883 copy offload operation, it is ambiguous to indicate the most recent 884 copy offload operation using a stateid with seqid of 0. Therefore a 885 copy offload stateid with seqid of 0 MUST be considered invalid. 887 3.4. Security Considerations 889 The security considerations pertaining to NFSv4 890 [I-D.ietf-nfsv4-rfc3530bis] apply to this chapter. 892 The standard security mechanisms provide by NFSv4 893 [I-D.ietf-nfsv4-rfc3530bis] may be used to secure the protocol 894 described in this chapter. 896 NFSv4 clients and servers supporting the inter-server copy operations 897 described in this chapter are REQUIRED to implement [rpcsecgssv3], 898 including the RPCSEC_GSSv3 privileges copy_from_auth and 899 copy_to_auth. If the server-to-server copy protocol is ONC RPC 900 based, the servers are also REQUIRED to implement the RPCSEC_GSSv3 901 privilege copy_confirm_auth. These requirements to implement are not 902 requirements to use. NFSv4 clients and servers are RECOMMENDED to 903 use [rpcsecgssv3] to secure server-side copy operations. 905 3.4.1. Inter-Server Copy Security 907 3.4.1.1. Requirements for Secure Inter-Server Copy 909 Inter-server copy is driven by several requirements: 911 o The specification MUST NOT mandate an inter-server copy protocol. 912 There are many ways to copy data. Some will be more optimal than 913 others depending on the identities of the source server and 914 destination server. For example the source and destination 915 servers might be two nodes sharing a common file system format for 916 the source and destination file systems. Thus the source and 917 destination are in an ideal position to efficiently render the 918 image of the source file to the destination file by replicating 919 the file system formats at the block level. In other cases, the 920 source and destination might be two nodes sharing a common storage 921 area network, and thus there is no need to copy any data at all, 922 and instead ownership of the file and its contents simply gets re- 923 assigned to the destination. 925 o The specification MUST provide guidance for using NFSv4.x as a 926 copy protocol. For those source and destination servers willing 927 to use NFSv4.x there are specific security considerations that 928 this specification can and does address. 930 o The specification MUST NOT mandate pre-configuration between the 931 source and destination server. Requiring that the source and 932 destination first have a "copying relationship" increases the 933 administrative burden. However the specification MUST NOT 934 preclude implementations that require pre-configuration. 936 o The specification MUST NOT mandate a trust relationship between 937 the source and destination server. The NFSv4 security model 938 requires mutual authentication between a principal on an NFS 939 client and a principal on an NFS server. This model MUST continue 940 with the introduction of COPY. 942 3.4.1.2. Inter-Server Copy with RPCSEC_GSSv3 944 When the client sends a COPY_NOTIFY to the source server to expect 945 the destination to attempt to copy data from the source server, it is 946 expected that this copy is being done on behalf of the principal 947 (called the "user principal") that sent the RPC request that encloses 948 the COMPOUND procedure that contains the COPY_NOTIFY operation. The 949 user principal is identified by the RPC credentials. A mechanism 950 that allows the user principal to authorize the destination server to 951 perform the copy in a manner that lets the source server properly 952 authenticate the destination's copy, and without allowing the 953 destination to exceed its authorization is necessary. 955 An approach that sends delegated credentials of the client's user 956 principal to the destination server is not used for the following 957 reasons. If the client's user delegated its credentials, the 958 destination would authenticate as the user principal. If the 959 destination were using the NFSv4 protocol to perform the copy, then 960 the source server would authenticate the destination server as the 961 user principal, and the file copy would securely proceed. However, 962 this approach would allow the destination server to copy other files. 963 The user principal would have to trust the destination server to not 964 do so. This is counter to the requirements, and therefore is not 965 considered. Instead an approach using RPCSEC_GSSv3 [rpcsecgssv3] 966 privileges is proposed. 968 One of the stated applications of the proposed RPCSEC_GSSv3 protocol 969 is compound client host and user authentication [+ privilege 970 assertion]. For inter-server file copy, we require compound NFS 971 server host and user authentication [+ privilege assertion]. The 972 distinction between the two is one without meaning. 974 RPCSEC_GSSv3 introduces the notion of privileges. We define three 975 privileges: 977 copy_from_auth: A user principal is authorizing a source principal 978 ("nfs@") to allow a destination principal ("nfs@ 979 ") to copy a file from the source to the destination. 980 This privilege is established on the source server before the user 981 principal sends a COPY_NOTIFY operation to the source server. 983 struct copy_from_auth_priv { 984 secret4 cfap_shared_secret; 985 netloc4 cfap_destination; 986 /* the NFSv4 user name that the user principal maps to */ 987 utf8str_mixed cfap_username; 988 /* equal to seq_num of rpc_gss_cred_vers_3_t */ 989 unsigned int cfap_seq_num; 990 }; 992 cfp_shared_secret is a secret value the user principal generates. 994 copy_to_auth: A user principal is authorizing a destination 995 principal ("nfs@") to allow it to copy a file from 996 the source to the destination. This privilege is established on 997 the destination server before the user principal sends a COPY 998 operation to the destination server. 1000 struct copy_to_auth_priv { 1001 /* equal to cfap_shared_secret */ 1002 secret4 ctap_shared_secret; 1003 netloc4 ctap_source; 1004 /* the NFSv4 user name that the user principal maps to */ 1005 utf8str_mixed ctap_username; 1006 /* equal to seq_num of rpc_gss_cred_vers_3_t */ 1007 unsigned int ctap_seq_num; 1008 }; 1010 ctap_shared_secret is a secret value the user principal generated 1011 and was used to establish the copy_from_auth privilege with the 1012 source principal. 1014 copy_confirm_auth: A destination principal is confirming with the 1015 source principal that it is authorized to copy data from the 1016 source on behalf of the user principal. When the inter-server 1017 copy protocol is NFSv4, or for that matter, any protocol capable 1018 of being secured via RPCSEC_GSSv3 (i.e., any ONC RPC protocol), 1019 this privilege is established before the file is copied from the 1020 source to the destination. 1022 struct copy_confirm_auth_priv { 1023 /* equal to GSS_GetMIC() of cfap_shared_secret */ 1024 opaque ccap_shared_secret_mic<>; 1025 /* the NFSv4 user name that the user principal maps to */ 1026 utf8str_mixed ccap_username; 1027 /* equal to seq_num of rpc_gss_cred_vers_3_t */ 1028 unsigned int ccap_seq_num; 1029 }; 1031 3.4.1.2.1. Establishing a Security Context 1033 When the user principal wants to COPY a file between two servers, if 1034 it has not established copy_from_auth and copy_to_auth privileges on 1035 the servers, it establishes them: 1037 o The user principal generates a secret it will share with the two 1038 servers. This shared secret will be placed in the 1039 cfap_shared_secret and ctap_shared_secret fields of the 1040 appropriate privilege data types, copy_from_auth_priv and 1041 copy_to_auth_priv. 1043 o An instance of copy_from_auth_priv is filled in with the shared 1044 secret, the destination server, and the NFSv4 user id of the user 1045 principal. It will be sent with an RPCSEC_GSS3_CREATE procedure, 1046 and so cfap_seq_num is set to the seq_num of the credential of the 1047 RPCSEC_GSS3_CREATE procedure. Because cfap_shared_secret is a 1048 secret, after XDR encoding copy_from_auth_priv, GSS_Wrap() (with 1049 privacy) is invoked on copy_from_auth_priv. The 1050 RPCSEC_GSS3_CREATE procedure's arguments are: 1052 struct { 1053 rpc_gss3_gss_binding *compound_binding; 1054 rpc_gss3_chan_binding *chan_binding_mic; 1055 rpc_gss3_assertion assertions<>; 1056 rpc_gss3_extension extensions<>; 1057 } rpc_gss3_create_args; 1059 The string "copy_from_auth" is placed in assertions[0].privs. The 1060 output of GSS_Wrap() is placed in extensions[0].data. The field 1061 extensions[0].critical is set to TRUE. The source server calls 1062 GSS_Unwrap() on the privilege, and verifies that the seq_num 1063 matches the credential. It then verifies that the NFSv4 user id 1064 being asserted matches the source server's mapping of the user 1065 principal. If it does, the privilege is established on the source 1066 server as: <"copy_from_auth", user id, destination>. The 1067 successful reply to RPCSEC_GSS3_CREATE has: 1069 struct { 1070 opaque handle<>; 1071 rpc_gss3_chan_binding *chan_binding_mic; 1072 rpc_gss3_assertion granted_assertions<>; 1073 rpc_gss3_assertion server_assertions<>; 1074 rpc_gss3_extension extensions<>; 1075 } rpc_gss3_create_res; 1077 The field "handle" is the RPCSEC_GSSv3 handle that the client will 1078 use on COPY_NOTIFY requests involving the source and destination 1079 server. granted_assertions[0].privs will be equal to 1080 "copy_from_auth". The server will return a GSS_Wrap() of 1081 copy_to_auth_priv. 1083 o An instance of copy_to_auth_priv is filled in with the shared 1084 secret, the source server, and the NFSv4 user id. It will be sent 1085 with an RPCSEC_GSS3_CREATE procedure, and so ctap_seq_num is set 1086 to the seq_num of the credential of the RPCSEC_GSS3_CREATE 1087 procedure. Because ctap_shared_secret is a secret, after XDR 1088 encoding copy_to_auth_priv, GSS_Wrap() is invoked on 1089 copy_to_auth_priv. The RPCSEC_GSS3_CREATE procedure's arguments 1090 are: 1092 struct { 1093 rpc_gss3_gss_binding *compound_binding; 1094 rpc_gss3_chan_binding *chan_binding_mic; 1095 rpc_gss3_assertion assertions<>; 1096 rpc_gss3_extension extensions<>; 1097 } rpc_gss3_create_args; 1099 The string "copy_to_auth" is placed in assertions[0].privs. The 1100 output of GSS_Wrap() is placed in extensions[0].data. The field 1101 extensions[0].critical is set to TRUE. After unwrapping, 1102 verifying the seq_num, and the user principal to NFSv4 user ID 1103 mapping, the destination establishes a privilege of 1104 <"copy_to_auth", user id, source>. The successful reply to 1105 RPCSEC_GSS3_CREATE has: 1107 struct { 1108 opaque handle<>; 1109 rpc_gss3_chan_binding *chan_binding_mic; 1110 rpc_gss3_assertion granted_assertions<>; 1111 rpc_gss3_assertion server_assertions<>; 1112 rpc_gss3_extension extensions<>; 1114 } rpc_gss3_create_res; 1116 The field "handle" is the RPCSEC_GSSv3 handle that the client will 1117 use on COPY requests involving the source and destination server. 1118 The field granted_assertions[0].privs will be equal to 1119 "copy_to_auth". The server will return a GSS_Wrap() of 1120 copy_to_auth_priv. 1122 3.4.1.2.2. Starting a Secure Inter-Server Copy 1124 When the client sends a COPY_NOTIFY request to the source server, it 1125 uses the privileged "copy_from_auth" RPCSEC_GSSv3 handle. 1126 cna_destination_server in COPY_NOTIFY MUST be the same as the name of 1127 the destination server specified in copy_from_auth_priv. Otherwise, 1128 COPY_NOTIFY will fail with NFS4ERR_ACCESS. The source server 1129 verifies that the privilege <"copy_from_auth", user id, destination> 1130 exists, and annotates it with the source filehandle, if the user 1131 principal has read access to the source file, and if administrative 1132 policies give the user principal and the NFS client read access to 1133 the source file (i.e., if the ACCESS operation would grant read 1134 access). Otherwise, COPY_NOTIFY will fail with NFS4ERR_ACCESS. 1136 When the client sends a COPY request to the destination server, it 1137 uses the privileged "copy_to_auth" RPCSEC_GSSv3 handle. 1138 ca_source_server in COPY MUST be the same as the name of the source 1139 server specified in copy_to_auth_priv. Otherwise, COPY will fail 1140 with NFS4ERR_ACCESS. The destination server verifies that the 1141 privilege <"copy_to_auth", user id, source> exists, and annotates it 1142 with the source and destination filehandles. If the client has 1143 failed to establish the "copy_to_auth" policy it will reject the 1144 request with NFS4ERR_PARTNER_NO_AUTH. 1146 If the client sends a OFFLOAD_REVOKE to the source server to rescind 1147 the destination server's copy privilege, it uses the privileged 1148 "copy_from_auth" RPCSEC_GSSv3 handle and the cra_destination_server 1149 in OFFLOAD_REVOKE MUST be the same as the name of the destination 1150 server specified in copy_from_auth_priv. The source server will then 1151 delete the <"copy_from_auth", user id, destination> privilege and 1152 fail any subsequent copy requests sent under the auspices of this 1153 privilege from the destination server. 1155 3.4.1.2.3. Securing ONC RPC Server-to-Server Copy Protocols 1157 After a destination server has a "copy_to_auth" privilege established 1158 on it, and it receives a COPY request, if it knows it will use an ONC 1159 RPC protocol to copy data, it will establish a "copy_confirm_auth" 1160 privilege on the source server, using nfs@ as the 1161 initiator principal, and nfs@ as the target principal. 1163 The value of the field ccap_shared_secret_mic is a GSS_VerifyMIC() of 1164 the shared secret passed in the copy_to_auth privilege. The field 1165 ccap_username is the mapping of the user principal to an NFSv4 user 1166 name ("user"@"domain" form), and MUST be the same as ctap_username 1167 and cfap_username. The field ccap_seq_num is the seq_num of the 1168 RPCSEC_GSSv3 credential used for the RPCSEC_GSS3_CREATE procedure the 1169 destination will send to the source server to establish the 1170 privilege. 1172 The source server verifies the privilege, and establishes a 1173 <"copy_confirm_auth", user id, destination> privilege. If the source 1174 server fails to verify the privilege, the COPY operation will be 1175 rejected with NFS4ERR_PARTNER_NO_AUTH. All subsequent ONC RPC 1176 requests sent from the destination to copy data from the source to 1177 the destination will use the RPCSEC_GSSv3 handle returned by the 1178 source's RPCSEC_GSS3_CREATE response. 1180 Note that the use of the "copy_confirm_auth" privilege accomplishes 1181 the following: 1183 o if a protocol like NFS is being used, with export policies, export 1184 policies can be overridden in case the destination server as-an- 1185 NFS-client is not authorized 1187 o manual configuration to allow a copy relationship between the 1188 source and destination is not needed. 1190 If the attempt to establish a "copy_confirm_auth" privilege fails, 1191 then when the user principal sends a COPY request to destination, the 1192 destination server will reject it with NFS4ERR_PARTNER_NO_AUTH. 1194 3.4.1.2.4. Securing Non ONC RPC Server-to-Server Copy Protocols 1196 If the destination won't be using ONC RPC to copy the data, then the 1197 source and destination are using an unspecified copy protocol. The 1198 destination could use the shared secret and the NFSv4 user id to 1199 prove to the source server that the user principal has authorized the 1200 copy. 1202 For protocols that authenticate user names with passwords (e.g., HTTP 1203 [RFC2616] and FTP [RFC0959]), the NFSv4 user id could be used as the 1204 user name, and an ASCII hexadecimal representation of the 1205 RPCSEC_GSSv3 shared secret could be used as the user password or as 1206 input into non-password authentication methods like CHAP [RFC1994]. 1208 3.4.1.3. Inter-Server Copy via ONC RPC but without RPCSEC_GSSv3 1210 ONC RPC security flavors other than RPCSEC_GSSv3 MAY be used with the 1211 server-side copy offload operations described in this chapter. In 1212 particular, host-based ONC RPC security flavors such as AUTH_NONE and 1213 AUTH_SYS MAY be used. If a host-based security flavor is used, a 1214 minimal level of protection for the server-to-server copy protocol is 1215 possible. 1217 In the absence of strong security mechanisms such as RPCSEC_GSSv3, 1218 the challenge is how the source server and destination server 1219 identify themselves to each other, especially in the presence of 1220 multi-homed source and destination servers. In a multi-homed 1221 environment, the destination server might not contact the source 1222 server from the same network address specified by the client in the 1223 COPY_NOTIFY. This can be overcome using the procedure described 1224 below. 1226 When the client sends the source server the COPY_NOTIFY operation, 1227 the source server may reply to the client with a list of target 1228 addresses, names, and/or URLs and assign them to the unique 1229 quadruple: . If the destination uses one of these target netlocs to contact 1231 the source server, the source server will be able to uniquely 1232 identify the destination server, even if the destination server does 1233 not connect from the address specified by the client in COPY_NOTIFY. 1234 The level of assurance in this identification depends on the 1235 unpredictability, strength and secrecy of the random number. 1237 For example, suppose the network topology is as shown in Figure 3. 1238 If the source filehandle is 0x12345, the source server may respond to 1239 a COPY_NOTIFY for destination 203.0.113.56 with the URLs: 1241 nfs://203.0.113.18//_COPY/FvhH1OKbu8VrxvV1erdjvR7N/203.0.113.56/ 1242 _FH/0x12345 1244 nfs://192.0.2.18//_COPY/FvhH1OKbu8VrxvV1erdjvR7N/203.0.113.56/_FH/ 1245 0x12345 1247 The name component after _COPY is 24 characters of base 64, more than 1248 enough to encode a 128 bit random number. 1250 The client will then send these URLs to the destination server in the 1251 COPY operation. Suppose that the 192.0.2.0/24 network is a high 1252 speed network and the destination server decides to transfer the file 1253 over this network. If the destination contacts the source server 1254 from 192.0.2.56 over this network using NFSv4.1, it does the 1255 following: 1257 COMPOUND { PUTROOTFH, LOOKUP "_COPY" ; LOOKUP 1258 "FvhH1OKbu8VrxvV1erdjvR7N" ; LOOKUP "203.0.113.56"; LOOKUP "_FH" ; 1259 OPEN "0x12345" ; GETFH } 1261 Provided that the random number is unpredictable and has been kept 1262 secret by the parties involved, the source server will therefore know 1263 that these NFSv4.x operations are being issued by the destination 1264 server identified in the COPY_NOTIFY. This random number technique 1265 only provides initial authentication of the destination server, and 1266 cannot defend against man-in-the-middle attacks after authentication 1267 or an eavesdropper that observes the random number on the wire. 1268 Other secure communication techniques (e.g., IPsec) are necessary to 1269 block these attacks. 1271 3.4.1.4. Inter-Server Copy without ONC RPC and RPCSEC_GSSv3 1273 The same techniques as Section 3.4.1.3, using unique URLs for each 1274 destination server, can be used for other protocols (e.g., HTTP 1275 [RFC2616] and FTP [RFC0959]) as well. 1277 4. Support for Application IO Hints 1279 Applications can issue client I/O hints via posix_fadvise() 1280 [posix_fadvise] to the NFS client. While this can help the NFS 1281 client optimize I/O and caching for a file, it does not allow the NFS 1282 server and its exported file system to do likewise. We add an 1283 IO_ADVISE procedure (Section 14.8) to communicate the client file 1284 access patterns to the NFS server. The NFS server upon receiving a 1285 IO_ADVISE operation MAY choose to alter its I/O and caching behavior, 1286 but is under no obligation to do so. 1288 Application specific NFS clients such as those used by hypervisors 1289 and databases can also leverage application hints to communicate 1290 their specialized requirements. 1292 5. Sparse Files 1294 5.1. Introduction 1296 A sparse file is a common way of representing a large file without 1297 having to utilize all of the disk space for it. Consequently, a 1298 sparse file uses less physical space than its size indicates. This 1299 means the file contains 'holes', byte ranges within the file that 1300 contain no data. Most modern file systems support sparse files, 1301 including most UNIX file systems and NTFS, but notably not Apple's 1302 HFS+. Common examples of sparse files include Virtual Machine (VM) 1303 OS/disk images, database files, log files, and even checkpoint 1304 recovery files most commonly used by the HPC community. 1306 If an application reads a hole in a sparse file, the file system must 1307 return all zeros to the application. For local data access there is 1308 little penalty, but with NFS these zeroes must be transferred back to 1309 the client. If an application uses the NFS client to read data into 1310 memory, this wastes time and bandwidth as the application waits for 1311 the zeroes to be transferred. 1313 A sparse file is typically created by initializing the file to be all 1314 zeros - nothing is written to the data in the file, instead the hole 1315 is recorded in the metadata for the file. So a 8G disk image might 1316 be represented initially by a couple hundred bits in the inode and 1317 nothing on the disk. If the VM then writes 100M to a file in the 1318 middle of the image, there would now be two holes represented in the 1319 metadata and 100M in the data. 1321 Two new operations WRITE_PLUS (Section 14.7) and READ_PLUS 1322 (Section 14.10) are introduced. WRITE_PLUS allows for the creation 1323 of a sparse file and for hole punching. An application might want to 1324 zero out a range of the file. READ_PLUS supports all the features of 1325 READ but includes an extension to support sparse pattern files 1326 (Section 7.1.2). READ_PLUS is guaranteed to perform no worse than 1327 READ, and can dramatically improve performance with sparse files. 1328 READ_PLUS does not depend on pNFS protocol features, but can be used 1329 by pNFS to support sparse files. 1331 5.2. Terminology 1333 Regular file: An object of file type NF4REG or NF4NAMEDATTR. 1335 Sparse file: A Regular file that contains one or more Holes. 1337 Hole: A byte range within a Sparse file that contains regions of all 1338 zeroes. For block-based file systems, this could also be an 1339 unallocated region of the file. 1341 Hole Threshold: The minimum length of a Hole as determined by the 1342 server. If a server chooses to define a Hole Threshold, then it 1343 would not return hole information about holes with a length 1344 shorter than the Hole Threshold. 1346 5.3. New Operations 1348 READ_PLUS and WRITE_PLUS are new variants of the NFSv4.1 READ and 1349 WRITE operations [RFC5661]. Besides being able to support all of the 1350 data semantics of those operations, they can also be used by the 1351 client and server to efficiently transfer both holes and ADHs (see 1352 Section 7.1.1). As both READ and WRITE are inefficient for transfer 1353 of sparse sections of the file, they are marked as OBSOLESCENT in 1354 NFSv4.2. Instead, a client should utilize READ_PLUS and WRITE_PLUS. 1355 Note that as the client has no a priori knowledge of whether either 1356 an ADH or a hole is present or not, if it supports these operations 1357 and so does the server, then it should always use these operations. 1359 5.3.1. READ_PLUS 1361 For holes, READ_PLUS extends the response to avoid returning data for 1362 portions of the file which are initialized and contain no backing 1363 store. Additionally it will do so if the result would appear to be a 1364 hole. I.e., if the result was a data block composed entirely of 1365 zeros, then it is easier to return a hole. Returning data blocks of 1366 uninitialized data wastes computational and network resources, thus 1367 reducing performance. For ADHs, READ_PLUS is used to return the 1368 metadata describing the portions of the file which are initialized 1369 and contain no backing store. 1371 If the client sends a READ operation, it is explicitly stating that 1372 it is neither supporting sparse files nor ADHs. So if a READ occurs 1373 on a sparse ADH or file, then the server must expand such data to be 1374 raw bytes. If a READ occurs in the middle of a hole or ADH, the 1375 server can only send back bytes starting from that offset. In 1376 contrast, if a READ_PLUS occurs in the middle of a hole or ADH, the 1377 server can send back a range which starts before the offset and 1378 extends past the range. 1380 5.3.2. WRITE_PLUS 1382 WRITE_PLUS can be used to either hole punch or initialize ADHs. For 1383 either purpose, the client can avoid the transfer of a repetitive 1384 pattern across the network. If the filesystem on the server does not 1385 supports sparse files, the WRITE_PLUS operation may return the result 1386 asynchronously via the CB_OFFLOAD operation. As a hole punch may 1387 entail deallocating data blocks, even if the filesystem supports 1388 sparse files, it may still have to return the result via CB_OFFLOAD. 1390 6. Space Reservation 1392 6.1. Introduction 1394 Applications such as hypervisors want to be able to reserve space for 1395 a file, report the amount of actual disk space a file occupies, and 1396 freeup the backing space of a file when it is not required. In 1397 virtualized environments, virtual disk files are often stored on NFS 1398 mounted volumes. Since virtual disk files represent the hard disks 1399 of virtual machines, hypervisors often have to guarantee certain 1400 properties for the file. 1402 One such example is space reservation. When a hypervisor creates a 1403 virtual disk file, it often tries to preallocate the space for the 1404 file so that there are no future allocation related errors during the 1405 operation of the virtual machine. Such errors prevent a virtual 1406 machine from continuing execution and result in downtime. 1408 Currently, in order to achieve such a guarantee, applications zero 1409 the entire file. The initial zeroing allocates the backing blocks 1410 and all subsequent writes are overwrites of already allocated blocks. 1411 This approach is not only inefficient in terms of the amount of I/O 1412 done, it is also not guaranteed to work on file systems that are log 1413 structured or deduplicated. An efficient way of guaranteeing space 1414 reservation would be beneficial to such applications. 1416 We define a "reservation" as being the combination of the 1417 space_reserved attribute (see Section 12.2.4) and the size attribute 1418 (see Section 5.8.1.5 of [RFC5661]). If space_reserved attribute is 1419 set on a file, it is guaranteed that writes that do not grow the file 1420 past the size will not fail with NFS4ERR_NOSPC. Once the size is 1421 changed, then the reservation is changed to that new size. 1423 Another useful feature is the ability to report the number of blocks 1424 that would be freed when a file is deleted. Currently, NFS reports 1425 two size attributes: 1427 size The logical file size of the file. 1429 space_used The size in bytes that the file occupies on disk 1431 While these attributes are sufficient for space accounting in 1432 traditional file systems, they prove to be inadequate in modern file 1433 systems that support block sharing. In such file systems, multiple 1434 inodes can point to a single block with a block reference count to 1435 guard against premature freeing. Having a way to tell the number of 1436 blocks that would be freed if the file was deleted would be useful to 1437 applications that wish to migrate files when a volume is low on 1438 space. 1440 Since virtual disks represent a hard drive in a virtual machine, a 1441 virtual disk can be viewed as a file system within a file. Since not 1442 all blocks within a file system are in use, there is an opportunity 1443 to reclaim blocks that are no longer in use. A call to deallocate 1444 blocks could result in better space efficiency. Lesser space MAY be 1445 consumed for backups after block deallocation. 1447 The following operations and attributes can be used to resolve this 1448 issues: 1450 space_reserved This attribute specifies that writes to the reserved 1451 area of the file will not fail with NFS4ERR_NOSPACE. 1453 space_freed This attribute specifies the space freed when a file is 1454 deleted, taking block sharing into consideration. 1456 WRITE_PLUS This operation zeroes and/or deallocates the blocks 1457 backing a region of the file. 1459 If space_used of a file is interpreted to mean the size in bytes of 1460 all disk blocks pointed to by the inode of the file, then shared 1461 blocks get double counted, over-reporting the space utilization. 1462 This also has the adverse effect that the deletion of a file with 1463 shared blocks frees up less than space_used bytes. 1465 On the other hand, if space_used is interpreted to mean the size in 1466 bytes of those disk blocks unique to the inode of the file, then 1467 shared blocks are not counted in any file, resulting in under- 1468 reporting of the space utilization. 1470 For example, two files A and B have 10 blocks each. Let 6 of these 1471 blocks be shared between them. Thus, the combined space utilized by 1472 the two files is 14 * BLOCK_SIZE bytes. In the former case, the 1473 combined space utilization of the two files would be reported as 20 * 1474 BLOCK_SIZE. However, deleting either would only result in 4 * 1475 BLOCK_SIZE being freed. Conversely, the latter interpretation would 1476 report that the space utilization is only 8 * BLOCK_SIZE. 1478 Adding another size attribute, space_freed (see Section 12.2.5), is 1479 helpful in solving this problem. space_freed is the number of blocks 1480 that are allocated to the given file that would be freed on its 1481 deletion. In the example, both A and B would report space_freed as 4 1482 * BLOCK_SIZE and space_used as 10 * BLOCK_SIZE. If A is deleted, B 1483 will report space_freed as 10 * BLOCK_SIZE as the deletion of B would 1484 result in the deallocation of all 10 blocks. 1486 The addition of this problem does not solve the problem of space 1487 being over-reported. However, over-reporting is better than under- 1488 reporting. 1490 7. Application Data Hole Support 1492 At the OS level, files are contained on disk blocks. Applications 1493 are also free to impose structure on the data contained in a file and 1494 we can define an Application Data Block (ADB) to be such a structure. 1495 From the application's viewpoint, it only wants to handle ADBs and 1496 not raw bytes (see [Strohm11]). An ADB is typically comprised of two 1497 sections: a header and data. The header describes the 1498 characteristics of the block and can provide a means to detect 1499 corruption in the data payload. The data section is typically 1500 initialized to all zeros. 1502 The format of the header is application specific, but there are two 1503 main components typically encountered: 1505 1. A logical block number which allows the application to determine 1506 which data block is being referenced. This is useful when the 1507 client is not storing the blocks in contiguous memory. 1509 2. Fields to describe the state of the ADB and a means to detect 1510 block corruption. For both pieces of data, a useful property is 1511 that allowed values be unique in that if passed across the 1512 network, corruption due to translation between big and little 1513 endian architectures are detectable. For example, 0xF0DEDEF0 has 1514 the same bit pattern in both architectures. 1516 Applications already impose structures on files [Strohm11] and detect 1517 corruption in data blocks [Ashdown08]. What they are not able to do 1518 is efficiently transfer and store ADBs. To initialize a file with 1519 ADBs, the client must send the full ADB to the server and that must 1520 be stored on the server. 1522 In this section, we are going to define an Application Data Hole 1523 (ADH), which is a generic framework for transferring the ADB, present 1524 one approach to detecting corruption in a given ADH implementation, 1525 and describe the model for how the client and server can support 1526 efficient initialization of ADHs, reading of ADH holes, punching ADH 1527 holes in a file, and space reservation. We define the ADHN to be the 1528 Application Data Hole Number, which is the logical block number 1529 discussed earlier. 1531 7.1. Generic Framework 1533 We want the representation of the ADH to be flexible enough to 1534 support many different applications. The most basic approach is no 1535 imposition of a block at all, which means we are working with the raw 1536 bytes. Such an approach would be useful for storing holes, punching 1537 holes, etc. In more complex deployments, a server might be 1538 supporting multiple applications, each with their own definition of 1539 the ADH. One might store the ADHN at the start of the block and then 1540 have a guard pattern to detect corruption [McDougall07]. The next 1541 might store the ADHN at an offset of 100 bytes within the block and 1542 have no guard pattern at all, i.e., existing applications might 1543 already have well defined formats for their data blocks. 1545 The guard pattern can be used to represent the state of the block, to 1546 protect against corruption, or both. Again, it needs to be able to 1547 be placed anywhere within the ADH. 1549 We need to be able to represent the starting offset of the block and 1550 the size of the block. Note that nothing prevents the application 1551 from defining different sized blocks in a file. 1553 7.1.1. Data Hole Representation 1555 struct app_data_hole4 { 1556 offset4 adh_offset; 1557 length4 adh_block_size; 1558 length4 adh_block_count; 1559 length4 adh_reloff_blocknum; 1560 count4 adh_block_num; 1561 length4 adh_reloff_pattern; 1562 opaque adh_pattern<>; 1563 }; 1565 The app_data_hole4 structure captures the abstraction presented for 1566 the ADH. The additional fields present are to allow the transmission 1567 of adh_block_count ADHs at one time. We also use adh_block_num to 1568 convey the ADHN of the first block in the sequence. Each ADH will 1569 contain the same adh_pattern string. 1571 As both adh_block_num and adh_pattern are optional, if either 1572 adh_reloff_pattern or adh_reloff_blocknum is set to NFS4_UINT64_MAX, 1573 then the corresponding field is not set in any of the ADH. 1575 7.1.2. Data Content 1577 /* 1578 * Use an enum such that we can extend new types. 1579 */ 1580 enum data_content4 { 1581 NFS4_CONTENT_DATA = 0, 1582 NFS4_CONTENT_APP_DATA_HOLE = 1, 1583 NFS4_CONTENT_HOLE = 2 1584 }; 1586 New operations might need to differentiate between wanting to access 1587 data versus an ADH. Also, future minor versions might want to 1588 introduce new data formats. This enumeration allows that to occur. 1590 7.2. An Example of Detecting Corruption 1592 In this section, we define an ADH format in which corruption can be 1593 detected. Note that this is just one possible format and means to 1594 detect corruption. 1596 Consider a very basic implementation of an operating system's disk 1597 blocks. A block is either data or it is an indirect block which 1598 allows for files to be larger than one block. It is desired to be 1599 able to initialize a block. Lastly, to quickly unlink a file, a 1600 block can be marked invalid. The contents remain intact - which 1601 would enable this OS application to undelete a file. 1603 The application defines 4k sized data blocks, with an 8 byte block 1604 counter occurring at offset 0 in the block, and with the guard 1605 pattern occurring at offset 8 inside the block. Furthermore, the 1606 guard pattern can take one of four states: 1608 0xfeedface - This is the FREE state and indicates that the ADH 1609 format has been applied. 1611 0xcafedead - This is the DATA state and indicates that real data 1612 has been written to this block. 1614 0xe4e5c001 - This is the INDIRECT state and indicates that the 1615 block contains block counter numbers that are chained off of this 1616 block. 1618 0xba1ed4a3 - This is the INVALID state and indicates that the block 1619 contains data whose contents are garbage. 1621 Finally, it also defines an 8 byte checksum [Baira08] starting at 1622 byte 16 which applies to the remaining contents of the block. If the 1623 state is FREE, then that checksum is trivially zero. As such, the 1624 application has no need to transfer the checksum implicitly inside 1625 the ADH - it need not make the transfer layer aware of the fact that 1626 there is a checksum (see [Ashdown08] for an example of checksums used 1627 to detect corruption in application data blocks). 1629 Corruption in each ADH can thus be detected: 1631 o If the guard pattern is anything other than one of the allowed 1632 values, including all zeros. 1634 o If the guard pattern is FREE and any other byte in the remainder 1635 of the ADH is anything other than zero. 1637 o If the guard pattern is anything other than FREE, then if the 1638 stored checksum does not match the computed checksum. 1640 o If the guard pattern is INDIRECT and one of the stored indirect 1641 block numbers has a value greater than the number of ADHs in the 1642 file. 1644 o If the guard pattern is INDIRECT and one of the stored indirect 1645 block numbers is a duplicate of another stored indirect block 1646 number. 1648 As can be seen, the application can detect errors based on the 1649 combination of the guard pattern state and the checksum. But also, 1650 the application can detect corruption based on the state and the 1651 contents of the ADH. This last point is important in validating the 1652 minimum amount of data we incorporated into our generic framework. 1653 I.e., the guard pattern is sufficient in allowing applications to 1654 design their own corruption detection. 1656 Finally, it is important to note that none of these corruption checks 1657 occur in the transport layer. The server and client components are 1658 totally unaware of the file format and might report everything as 1659 being transferred correctly even in the case the application detects 1660 corruption. 1662 7.3. Example of READ_PLUS 1664 The hypothetical application presented in Section 7.2 can be used to 1665 illustrate how READ_PLUS would return an array of results. A file is 1666 created and initialized with 100 4k ADHs in the FREE state: 1668 WRITE_PLUS {0, 4k, 100, 0, 0, 8, 0xfeedface} 1670 Further, assume the application writes a single ADH at 16k, changing 1671 the guard pattern to 0xcafedead, we would then have in memory: 1673 0 -> (16k - 1) : 4k, 4, 0, 0, 8, 0xfeedface 1674 16k -> (20k - 1) : 00 00 00 05 ca fe de ad XX XX ... XX XX 1675 20k -> 400k : 4k, 95, 0, 6, 0xfeedface 1677 And when the client did a READ_PLUS of 64k at the start of the file, 1678 it would get back a result of an ADH, some data, and a final ADH: 1680 ADH {0, 4, 0, 0, 8, 0xfeedface} 1681 data 4k 1682 ADH {20k, 4k, 59, 0, 6, 0xfeedface} 1684 8. Labeled NFS 1686 8.1. Introduction 1688 Access control models such as Unix permissions or Access Control 1689 Lists are commonly referred to as Discretionary Access Control (DAC) 1690 models. These systems base their access decisions on user identity 1691 and resource ownership. In contrast Mandatory Access Control (MAC) 1692 models base their access control decisions on the label on the 1693 subject (usually a process) and the object it wishes to access 1694 [Haynes12]. These labels may contain user identity information but 1695 usually contain additional information. In DAC systems users are 1696 free to specify the access rules for resources that they own. MAC 1697 models base their security decisions on a system wide policy 1698 established by an administrator or organization which the users do 1699 not have the ability to override. In this section, we add a MAC 1700 model to NFSv4.2. 1702 The first change necessary is to devise a method for transporting and 1703 storing security label data on NFSv4 file objects. Security labels 1704 have several semantics that are met by NFSv4 recommended attributes 1705 such as the ability to set the label value upon object creation. 1706 Access control on these attributes are done through a combination of 1707 two mechanisms. As with other recommended attributes on file objects 1708 the usual DAC checks (ACLs and permission bits) will be performed to 1709 ensure that proper file ownership is enforced. In addition a MAC 1710 system MAY be employed on the client, server, or both to enforce 1711 additional policy on what subjects may modify security label 1712 information. 1714 The second change is to provide methods for the client to determine 1715 if the security label has changed. A client which needs to know if a 1716 label is going to change SHOULD request a delegation on that file. 1717 In order to change the security label, the server will have to recall 1718 all delegations. This will inform the client of the change. If a 1719 client wants to detect if the label has changed, it MAY use VERIFY 1720 and NVERIFY on FATTR4_CHANGE_SEC_LABEL to detect that the 1721 FATTR4_SEC_LABEL has been modified. 1723 The final change necessary is a modification to the RPC layer used in 1724 NFSv4 in the form of a new version of the RPCSEC_GSS [RFC2203] 1725 framework. In order for an NFSv4 server to apply MAC checks it must 1726 obtain additional information from the client. Several methods were 1727 explored for performing this and it was decided that the best 1728 approach was to incorporate the ability to make security attribute 1729 assertions through the RPC mechanism. RPCSECGSSv3 [rpcsecgssv3] 1730 outlines a method to assert additional security information such as 1731 security labels on gss context creation and have that data bound to 1732 all RPC requests that make use of that context. 1734 8.2. Definitions 1736 Label Format Specifier (LFS): is an identifier used by the client to 1737 establish the syntactic format of the security label and the 1738 semantic meaning of its components. These specifiers exist in a 1739 registry associated with documents describing the format and 1740 semantics of the label. 1742 Label Format Registry: is the IANA registry containing all 1743 registered LFS along with references to the documents that 1744 describe the syntactic format and semantics of the security label. 1746 Policy Identifier (PI): is an optional part of the definition of a 1747 Label Format Specifier which allows for clients and server to 1748 identify specific security policies. 1750 Object: is a passive resource within the system that we wish to be 1751 protected. Objects can be entities such as files, directories, 1752 pipes, sockets, and many other system resources relevant to the 1753 protection of the system state. 1755 Subject: is an active entity usually a process which is requesting 1756 access to an object. 1758 MAC-Aware: is a server which can transmit and store object labels. 1760 MAC-Functional: is a client or server which is Labeled NFS enabled. 1761 Such a system can interpret labels and apply policies based on the 1762 security system. 1764 Multi-Level Security (MLS): is a traditional model where objects are 1765 given a sensitivity level (Unclassified, Secret, Top Secret, etc) 1766 and a category set [MLS]. 1768 8.3. MAC Security Attribute 1770 MAC models base access decisions on security attributes bound to 1771 subjects and objects. This information can range from a user 1772 identity for an identity based MAC model, sensitivity levels for 1773 Multi-level security, or a type for Type Enforcement. These models 1774 base their decisions on different criteria but the semantics of the 1775 security attribute remain the same. The semantics required by the 1776 security attributes are listed below: 1778 o MUST provide flexibility with respect to the MAC model. 1780 o MUST provide the ability to atomically set security information 1781 upon object creation. 1783 o MUST provide the ability to enforce access control decisions both 1784 on the client and the server. 1786 o MUST NOT expose an object to either the client or server name 1787 space before its security information has been bound to it. 1789 NFSv4 implements the security attribute as a recommended attribute. 1790 These attributes have a fixed format and semantics, which conflicts 1791 with the flexible nature of the security attribute. To resolve this 1792 the security attribute consists of two components. The first 1793 component is a LFS as defined in [Quigley11] to allow for 1794 interoperability between MAC mechanisms. The second component is an 1795 opaque field which is the actual security attribute data. To allow 1796 for various MAC models, NFSv4 should be used solely as a transport 1797 mechanism for the security attribute. It is the responsibility of 1798 the endpoints to consume the security attribute and make access 1799 decisions based on their respective models. In addition, creation of 1800 objects through OPEN and CREATE allows for the security attribute to 1801 be specified upon creation. By providing an atomic create and set 1802 operation for the security attribute it is possible to enforce the 1803 second and fourth requirements. The recommended attribute 1804 FATTR4_SEC_LABEL (see Section 12.2.2) will be used to satisfy this 1805 requirement. 1807 8.3.1. Delegations 1809 In the event that a security attribute is changed on the server while 1810 a client holds a delegation on the file, both the server and the 1811 client MUST follow the NFSv4.1 protocol (see Chapter 10 of [RFC5661]) 1812 with respect to attribute changes. It SHOULD flush all changes back 1813 to the server and relinquish the delegation. 1815 8.3.2. Permission Checking 1817 It is not feasible to enumerate all possible MAC models and even 1818 levels of protection within a subset of these models. This means 1819 that the NFSv4 client and servers cannot be expected to directly make 1820 access control decisions based on the security attribute. Instead 1821 NFSv4 should defer permission checking on this attribute to the host 1822 system. These checks are performed in addition to existing DAC and 1823 ACL checks outlined in the NFSv4 protocol. Section 8.6 gives a 1824 specific example of how the security attribute is handled under a 1825 particular MAC model. 1827 8.3.3. Object Creation 1829 When creating files in NFSv4 the OPEN and CREATE operations are used. 1830 One of the parameters to these operations is an fattr4 structure 1831 containing the attributes the file is to be created with. This 1832 allows NFSv4 to atomically set the security attribute of files upon 1833 creation. When a client is MAC-Functional it must always provide the 1834 initial security attribute upon file creation. In the event that the 1835 server is MAC-Functional as well, it should determine by policy 1836 whether it will accept the attribute from the client or instead make 1837 the determination itself. If the client is not MAC-Functional, then 1838 the MAC-Functional server must decide on a default label. A more in 1839 depth explanation can be found in Section 8.6. 1841 8.3.4. Existing Objects 1843 Note that under the MAC model, all objects must have labels. 1844 Therefore, if an existing server is upgraded to include Labeled NFS 1845 support, then it is the responsibility of the security system to 1846 define the behavior for existing objects. 1848 8.3.5. Label Changes 1850 If there are open delegations on the file belonging to client other 1851 than the one making the label change, then the process described in 1852 Section 8.3.1 must be followed. In short, the delegation will be 1853 recalled, which effectively notifies the client of the change. 1855 As the server is always presented with the subject label from the 1856 client, it does not necessarily need to communicate the fact that the 1857 label has changed to the client. In the cases where the change 1858 outright denies the client access, the client will be able to quickly 1859 determine that there is a new label in effect. 1861 Consider a system in which the clients enforce MAC checks and and the 1862 server has a very simple security system which just stores the 1863 labels. In this system, the MAC label check always allows access, 1864 regardless of the subject label. 1866 The way in which MAC labels are enforced is by the client. The 1867 security policies on the client can be such that the client does not 1868 have access to the file unless it has a delegation. The recall of 1869 the delegation will force the client to flush any cached content of 1870 the file. The clients could also be configured to periodically 1871 VERIFY/NVERIFY the FATTR4_CHANGE_SEC_LABEL attribute to determine 1872 when the label has changed. When a change is detected, then the 1873 client could take the costlier action of retrieving the 1874 FATTR4_SEC_LABEL. 1876 8.4. pNFS Considerations 1878 This section examines the issues in deploying Labeled NFS in a pNFS 1879 community of servers. 1881 8.4.1. MAC Label Checks 1883 The new FATTR4_SEC_LABEL attribute is metadata information and as 1884 such the DS is not aware of the value contained on the MDS. 1885 Fortunately, the NFSv4.1 protocol [RFC5661] already has provisions 1886 for doing access level checks from the DS to the MDS. In order for 1887 the DS to validate the subject label presented by the client, it 1888 SHOULD utilize this mechanism. 1890 8.5. Discovery of Server Labeled NFS Support 1892 The server can easily determine that a client supports Labeled NFS 1893 when it queries for the FATTR4_SEC_LABEL label for an object. Note 1894 that it cannot assume that the presence of RPCSEC_GSSv3 indicates 1895 Labeled NFS support. The client might need to discover which LFS the 1896 server supports. 1898 A server which supports Labeled NFS MUST allow a client with any 1899 subject label to retrieve the FATTR4_SEC_LABEL attribute for the root 1900 filehandle, ROOTFH. The following compound must always succeed as 1901 far as a MAC label check is concerned: 1903 PUTROOTFH, GETATTR {FATTR4_SEC_LABEL} 1905 Note that the server might have imposed a security flavor on the root 1906 that precludes such access. I.e., if the server requires kerberized 1907 access and the client presents a compound with AUTH_SYS, then the 1908 server is allowed to return NFS4ERR_WRONGSEC in this case. But if 1909 the client presents a correct security flavor, then the server MUST 1910 return the FATTR4_SEC_LABEL attribute with the supported LFS filled 1911 in. 1913 8.6. MAC Security NFS Modes of Operation 1915 A system using Labeled NFS may operate in two modes. The first mode 1916 provides the most protection and is called "full mode". In this mode 1917 both the client and server implement a MAC model allowing each end to 1918 make an access control decision. The remaining mode is called the 1919 "guest mode" and in this mode one end of the connection is not 1920 implementing a MAC model and thus offers less protection than full 1921 mode. 1923 8.6.1. Full Mode 1925 Full mode environments consist of MAC-Functional NFSv4 servers and 1926 clients and may be composed of mixed MAC models and policies. The 1927 system requires that both the client and server have an opportunity 1928 to perform an access control check based on all relevant information 1929 within the network. The file object security attribute is provided 1930 using the mechanism described in Section 8.3. The security attribute 1931 of the subject making the request is transported at the RPC layer 1932 using the mechanism described in RPCSECGSSv3 [rpcsecgssv3]. 1934 8.6.1.1. Initial Labeling and Translation 1936 The ability to create a file is an action that a MAC model may wish 1937 to mediate. The client is given the responsibility to determine the 1938 initial security attribute to be placed on a file. This allows the 1939 client to make a decision as to the acceptable security attributes to 1940 create a file with before sending the request to the server. Once 1941 the server receives the creation request from the client it may 1942 choose to evaluate if the security attribute is acceptable. 1944 Security attributes on the client and server may vary based on MAC 1945 model and policy. To handle this the security attribute field has an 1946 LFS component. This component is a mechanism for the host to 1947 identify the format and meaning of the opaque portion of the security 1948 attribute. A full mode environment may contain hosts operating in 1949 several different LFSs. In this case a mechanism for translating the 1950 opaque portion of the security attribute is needed. The actual 1951 translation function will vary based on MAC model and policy and is 1952 out of the scope of this document. If a translation is unavailable 1953 for a given LFS then the request MUST be denied. Another recourse is 1954 to allow the host to provide a fallback mapping for unknown security 1955 attributes. 1957 8.6.1.2. Policy Enforcement 1959 In full mode access control decisions are made by both the clients 1960 and servers. When a client makes a request it takes the security 1961 attribute from the requesting process and makes an access control 1962 decision based on that attribute and the security attribute of the 1963 object it is trying to access. If the client denies that access an 1964 RPC call to the server is never made. If however the access is 1965 allowed the client will make a call to the NFS server. 1967 When the server receives the request from the client it extracts the 1968 security attribute conveyed in the RPC request. The server then uses 1969 this security attribute and the attribute of the object the client is 1970 trying to access to make an access control decision. If the server's 1971 policy allows this access it will fulfill the client's request, 1972 otherwise it will return NFS4ERR_ACCESS. 1974 Implementations MAY validate security attributes supplied over the 1975 network to ensure that they are within a set of attributes permitted 1976 from a specific peer, and if not, reject them. Note that a system 1977 may permit a different set of attributes to be accepted from each 1978 peer. 1980 8.6.1.3. Limited Server 1982 A Limited Server mode (see Section 3.5.2 of [Haynes12]) consists of a 1983 server which is label aware, but does not enforce policies. Such a 1984 server will store and retrieve all object labels presented by 1985 clients, utilize the methods described in Section 8.3.5 to allow the 1986 clients to detect changing labels,, but will not restrict access via 1987 the subject label. Instead, it will expect the clients to enforce 1988 all such access locally. 1990 8.6.2. Guest Mode 1992 Guest mode implies that either the client or the server does not 1993 handle labels. If the client is not Labeled NFS aware, then it will 1994 not offer subject labels to the server. The server is the only 1995 entity enforcing policy, and may selectively provide standard NFS 1996 services to clients based on their authentication credentials and/or 1997 associated network attributes (e.g., IP address, network interface). 1998 The level of trust and access extended to a client in this mode is 1999 configuration-specific. If the server is not Labeled NFS aware, then 2000 it will not return object labels to the client. Clients in this 2001 environment are may consist of groups implementing different MAC 2002 model policies. The system requires that all clients in the 2003 environment be responsible for access control checks. 2005 8.7. Security Considerations 2007 This entire chapter deals with security issues. 2009 Depending on the level of protection the MAC system offers there may 2010 be a requirement to tightly bind the security attribute to the data. 2012 When only one of the client or server enforces labels, it is 2013 important to realize that the other side is not enforcing MAC 2014 protections. Alternate methods might be in use to handle the lack of 2015 MAC support and care should be taken to identify and mitigate threats 2016 from possible tampering outside of these methods. 2018 An example of this is that a server that modifies READDIR or LOOKUP 2019 results based on the client's subject label might want to always 2020 construct the same subject label for a client which does not present 2021 one. This will prevent a non-Labeled NFS client from mixing entries 2022 in the directory cache. 2024 9. Sharing change attribute implementation details with NFSv4 clients 2026 9.1. Introduction 2028 Although both the NFSv4 [I-D.ietf-nfsv4-rfc3530bis] and NFSv4.1 2029 protocol [RFC5661], define the change attribute as being mandatory to 2030 implement, there is little in the way of guidance. The only mandated 2031 feature is that the value must change whenever the file data or 2032 metadata change. 2034 While this allows for a wide range of implementations, it also leaves 2035 the client with a conundrum: how does it determine which is the most 2036 recent value for the change attribute in a case where several RPC 2037 calls have been issued in parallel? In other words if two COMPOUNDs, 2038 both containing WRITE and GETATTR requests for the same file, have 2039 been issued in parallel, how does the client determine which of the 2040 two change attribute values returned in the replies to the GETATTR 2041 requests correspond to the most recent state of the file? In some 2042 cases, the only recourse may be to send another COMPOUND containing a 2043 third GETATTR that is fully serialized with the first two. 2045 NFSv4.2 avoids this kind of inefficiency by allowing the server to 2046 share details about how the change attribute is expected to evolve, 2047 so that the client may immediately determine which, out of the 2048 several change attribute values returned by the server, is the most 2049 recent. change_attr_type is defined as a new recommended attribute 2050 (see Section 12.2.1), and is per file system. 2052 10. Security Considerations 2054 NFSv4.2 has all of the security concerns present in NFSv4.1 (see 2055 Section 21 of [RFC5661]) and those present in the Server-side Copy 2056 (see Section 3.4) and in Labeled NFS (see Section 8.7). 2058 11. Error Values 2060 NFS error numbers are assigned to failed operations within a Compound 2061 (COMPOUND or CB_COMPOUND) request. A Compound request contains a 2062 number of NFS operations that have their results encoded in sequence 2063 in a Compound reply. The results of successful operations will 2064 consist of an NFS4_OK status followed by the encoded results of the 2065 operation. If an NFS operation fails, an error status will be 2066 entered in the reply and the Compound request will be terminated. 2068 11.1. Error Definitions 2070 Protocol Error Definitions 2072 +--------------------------+--------+------------------+ 2073 | Error | Number | Description | 2074 +--------------------------+--------+------------------+ 2075 | NFS4ERR_BADLABEL | 10093 | Section 11.1.3.1 | 2076 | NFS4ERR_METADATA_NOTSUPP | 10090 | Section 11.1.2.1 | 2077 | NFS4ERR_OFFLOAD_DENIED | 10091 | Section 11.1.2.2 | 2078 | NFS4ERR_PARTNER_NO_AUTH | 10089 | Section 11.1.2.3 | 2079 | NFS4ERR_PARTNER_NOTSUPP | 10088 | Section 11.1.2.4 | 2080 | NFS4ERR_UNION_NOTSUPP | 10094 | Section 11.1.1.1 | 2081 | NFS4ERR_WRONG_LFS | 10092 | Section 11.1.3.2 | 2082 +--------------------------+--------+------------------+ 2084 Table 1 2086 11.1.1. General Errors 2088 This section deals with errors that are applicable to a broad set of 2089 different purposes. 2091 11.1.1.1. NFS4ERR_UNION_NOTSUPP (Error Code 10094) 2093 One of the arguments to the operation is a discriminated union and 2094 while the server supports the given operation, it does not support 2095 the selected arm of the discriminated union. For an example, see 2096 READ_PLUS (Section 14.10). 2098 11.1.2. Server to Server Copy Errors 2100 These errors deal with the interaction between server to server 2101 copies. 2103 11.1.2.1. NFS4ERR_METADATA_NOTSUPP (Error Code 10090) 2105 The destination file cannot support the same metadata as the source 2106 file. 2108 11.1.2.2. NFS4ERR_OFFLOAD_DENIED (Error Code 10091) 2110 The copy offload operation is supported by both the source and the 2111 destination, but the destination is not allowing it for this file. 2113 If the client sees this error, it should fall back to the normal copy 2114 semantics. 2116 11.1.2.3. NFS4ERR_PARTNER_NO_AUTH (Error Code 10089) 2118 The source server does not authorize a server-to-server copy offload 2119 operation. This may be due to the client's failure to send the 2120 COPY_NOTIFY operation to the source server, the source server 2121 receiving a server-to-server copy offload request after the copy 2122 lease time expired, or for some other permission problem. 2124 11.1.2.4. NFS4ERR_PARTNER_NOTSUPP (Error Code 10088) 2126 The remote server does not support the server-to-server copy offload 2127 protocol. 2129 11.1.3. Labeled NFS Errors 2131 These errors are used in Labeled NFS. 2133 11.1.3.1. NFS4ERR_BADLABEL (Error Code 10093) 2135 The label specified is invalid in some manner. 2137 11.1.3.2. NFS4ERR_WRONG_LFS (Error Code 10092) 2139 The LFS specified in the subject label is not compatible with the LFS 2140 in the object label. 2142 11.2. New Operations and Their Valid Errors 2144 This section contains a table that gives the valid error returns for 2145 each new NFSv4.2 protocol operation. The error code NFS4_OK 2146 (indicating no error) is not listed but should be understood to be 2147 returnable by all new operations. The error values for all other 2148 operations are defined in Section 15.2 of [RFC5661]. 2150 Valid Error Returns for Each New Protocol Operation 2152 +----------------+--------------------------------------------------+ 2153 | Operation | Errors | 2154 +----------------+--------------------------------------------------+ 2155 | COPY | NFS4ERR_ACCESS, NFS4ERR_ADMIN_REVOKED, | 2156 | | NFS4ERR_BADXDR, NFS4ERR_BAD_STATEID, | 2157 | | NFS4ERR_DEADSESSION, NFS4ERR_DELAY, | 2158 | | NFS4ERR_DELEG_REVOKED, NFS4ERR_DQUOT, | 2159 | | NFS4ERR_EXPIRED, NFS4ERR_FBIG, | 2160 | | NFS4ERR_FHEXPIRED, NFS4ERR_GRACE, NFS4ERR_INVAL, | 2161 | | NFS4ERR_IO, NFS4ERR_ISDIR, NFS4ERR_LOCKED, | 2162 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 2163 | | NFS4ERR_NOSPC, NFS4ERR_OFFLOAD_DENIED, | 2164 | | NFS4ERR_OLD_STATEID, NFS4ERR_OPENMODE, | 2165 | | NFS4ERR_OP_NOT_IN_SESSION, | 2166 | | NFS4ERR_PARTNER_NO_AUTH, | 2167 | | NFS4ERR_PARTNER_NOTSUPP, NFS4ERR_PNFS_IO_HOLE, | 2168 | | NFS4ERR_PNFS_NO_LAYOUT, 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 | COPY_NOTIFY | NFS4ERR_ACCESS, NFS4ERR_ADMIN_REVOKED, | 2175 | | NFS4ERR_BADXDR, NFS4ERR_BAD_STATEID, | 2176 | | NFS4ERR_DEADSESSION, NFS4ERR_DELAY, | 2177 | | NFS4ERR_DELEG_REVOKED, NFS4ERR_EXPIRED, | 2178 | | NFS4ERR_FHEXPIRED, NFS4ERR_GRACE, NFS4ERR_INVAL, | 2179 | | NFS4ERR_ISDIR, NFS4ERR_IO, NFS4ERR_LOCKED, | 2180 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 2181 | | NFS4ERR_OLD_STATEID, NFS4ERR_OPENMODE, | 2182 | | NFS4ERR_OP_NOT_IN_SESSION, NFS4ERR_PNFS_IO_HOLE, | 2183 | | NFS4ERR_PNFS_NO_LAYOUT, 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_SYMLINK, NFS4ERR_TOO_MANY_OPS, | 2188 | | NFS4ERR_WRONG_TYPE | 2189 | OFFLOAD_ABORT | NFS4ERR_ADMIN_REVOKED, NFS4ERR_BADXDR, | 2190 | | NFS4ERR_BAD_STATEID, NFS4ERR_COMPLETE_ALREADY, | 2191 | | NFS4ERR_DEADSESSION, NFS4ERR_EXPIRED, | 2192 | | NFS4ERR_DELAY, NFS4ERR_GRACE, NFS4ERR_NOTSUPP, | 2193 | | NFS4ERR_OLD_STATEID, NFS4ERR_OP_NOT_IN_SESSION, | 2194 | | NFS4ERR_SERVERFAULT, NFS4ERR_TOO_MANY_OPS | 2195 | OFFLOAD_REVOKE | NFS4ERR_ADMIN_REVOKED, NFS4ERR_BADXDR, | 2196 | | NFS4ERR_COMPLETE_ALREADY, NFS4ERR_DELAY, | 2197 | | NFS4ERR_GRACE, NFS4ERR_INVALID, NFS4ERR_MOVED, | 2198 | | NFS4ERR_NOTSUPP, NFS4ERR_OP_NOT_IN_SESSION, | 2199 | | NFS4ERR_SERVERFAULT, NFS4ERR_TOO_MANY_OPS | 2200 | OFFLOAD_STATUS | NFS4ERR_ADMIN_REVOKED, NFS4ERR_BADXDR, | 2201 | | NFS4ERR_BAD_STATEID, NFS4ERR_COMPLETE_ALREADY, | 2202 | | NFS4ERR_DEADSESSION, NFS4ERR_EXPIRED, | 2203 | | NFS4ERR_DELAY, NFS4ERR_GRACE, NFS4ERR_NOTSUPP, | 2204 | | NFS4ERR_OLD_STATEID, NFS4ERR_OP_NOT_IN_SESSION, | 2205 | | NFS4ERR_SERVERFAULT, NFS4ERR_TOO_MANY_OPS | 2206 | READ_PLUS | NFS4ERR_ACCESS, NFS4ERR_ADMIN_REVOKED, | 2207 | | NFS4ERR_BADXDR, NFS4ERR_BAD_STATEID, | 2208 | | NFS4ERR_DEADSESSION, NFS4ERR_DELAY, | 2209 | | NFS4ERR_DELEG_REVOKED, NFS4ERR_EXPIRED, | 2210 | | NFS4ERR_FHEXPIRED, NFS4ERR_GRACE, NFS4ERR_INVAL, | 2211 | | NFS4ERR_ISDIR, NFS4ERR_IO, NFS4ERR_LOCKED, | 2212 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 2213 | | NFS4ERR_OLD_STATEID, NFS4ERR_OPENMODE, | 2214 | | NFS4ERR_OP_NOT_IN_SESSION, NFS4ERR_PNFS_IO_HOLE, | 2215 | | NFS4ERR_PNFS_NO_LAYOUT, NFS4ERR_REP_TOO_BIG, | 2216 | | NFS4ERR_REP_TOO_BIG_TO_CACHE, | 2217 | | NFS4ERR_REQ_TOO_BIG, NFS4ERR_RETRY_UNCACHED_REP, | 2218 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE, | 2219 | | NFS4ERR_SYMLINK, NFS4ERR_TOO_MANY_OPS, | 2220 | | NFS4ERR_UNION_NOTSUPP, NFS4ERR_WRONG_TYPE | 2221 | SEEK | NFS4ERR_ACCESS, NFS4ERR_ADMIN_REVOKED, | 2222 | | NFS4ERR_BADXDR, NFS4ERR_BAD_STATEID, | 2223 | | NFS4ERR_DEADSESSION, NFS4ERR_DELAY, | 2224 | | NFS4ERR_DELEG_REVOKED, NFS4ERR_EXPIRED, | 2225 | | NFS4ERR_FHEXPIRED, NFS4ERR_GRACE, NFS4ERR_INVAL, | 2226 | | NFS4ERR_ISDIR, NFS4ERR_IO, NFS4ERR_LOCKED, | 2227 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 2228 | | NFS4ERR_OLD_STATEID, NFS4ERR_OPENMODE, | 2229 | | NFS4ERR_OP_NOT_IN_SESSION, NFS4ERR_PNFS_IO_HOLE, | 2230 | | NFS4ERR_PNFS_NO_LAYOUT, NFS4ERR_REP_TOO_BIG, | 2231 | | NFS4ERR_REP_TOO_BIG_TO_CACHE, | 2232 | | NFS4ERR_REQ_TOO_BIG, NFS4ERR_RETRY_UNCACHED_REP, | 2233 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE, | 2234 | | NFS4ERR_SYMLINK, NFS4ERR_TOO_MANY_OPS, | 2235 | | NFS4ERR_UNION_NOTSUPP, NFS4ERR_WRONG_TYPE | 2236 | SEQUENCE | NFS4ERR_BADSESSION, NFS4ERR_BADSLOT, | 2237 | | NFS4ERR_BADXDR, NFS4ERR_BAD_HIGH_SLOT, | 2238 | | NFS4ERR_CONN_NOT_BOUND_TO_SESSION, | 2239 | | NFS4ERR_DEADSESSION, NFS4ERR_DELAY, | 2240 | | NFS4ERR_REP_TOO_BIG, | 2241 | | NFS4ERR_REP_TOO_BIG_TO_CACHE, | 2242 | | NFS4ERR_REQ_TOO_BIG, NFS4ERR_RETRY_UNCACHED_REP, | 2243 | | NFS4ERR_SEQUENCE_POS, NFS4ERR_SEQ_FALSE_RETRY, | 2244 | | NFS4ERR_SEQ_MISORDERED, NFS4ERR_TOO_MANY_OPS | 2245 | WRITE_PLUS | NFS4ERR_ACCESS, NFS4ERR_ADMIN_REVOKED, | 2246 | | NFS4ERR_BADXDR, NFS4ERR_BAD_STATEID, | 2247 | | NFS4ERR_DEADSESSION, NFS4ERR_DELAY, | 2248 | | NFS4ERR_DELEG_REVOKED, NFS4ERR_DQUOT, | 2249 | | NFS4ERR_EXPIRED, NFS4ERR_FBIG, | 2250 | | NFS4ERR_FHEXPIRED, NFS4ERR_GRACE, NFS4ERR_INVAL, | 2251 | | NFS4ERR_IO, NFS4ERR_ISDIR, NFS4ERR_LOCKED, | 2252 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 2253 | | NFS4ERR_NOSPC, NFS4ERR_OLD_STATEID, | 2254 | | NFS4ERR_OPENMODE, NFS4ERR_OP_NOT_IN_SESSION, | 2255 | | NFS4ERR_PNFS_IO_HOLE, NFS4ERR_PNFS_NO_LAYOUT, | 2256 | | NFS4ERR_REP_TOO_BIG, | 2257 | | NFS4ERR_REP_TOO_BIG_TO_CACHE, | 2258 | | NFS4ERR_REQ_TOO_BIG, NFS4ERR_RETRY_UNCACHED_REP, | 2259 | | NFS4ERR_ROFS, NFS4ERR_SERVERFAULT, | 2260 | | NFS4ERR_STALE, NFS4ERR_SYMLINK, | 2261 | | NFS4ERR_TOO_MANY_OPS, NFS4ERR_UNION_NOTSUPP, | 2262 | | NFS4ERR_WRONG_TYPE | 2263 +----------------+--------------------------------------------------+ 2265 Table 2 2267 11.3. New Callback Operations and Their Valid Errors 2269 This section contains a table that gives the valid error returns for 2270 each new NFSv4.2 callback operation. The error code NFS4_OK 2271 (indicating no error) is not listed but should be understood to be 2272 returnable by all new callback operations. The error values for all 2273 other callback operations are defined in Section 15.3 of [RFC5661]. 2275 Valid Error Returns for Each New Protocol Callback Operation 2277 +------------+------------------------------------------------------+ 2278 | Callback | Errors | 2279 | Operation | | 2280 +------------+------------------------------------------------------+ 2281 | CB_OFFLOAD | NFS4ERR_BADHANDLE, NFS4ERR_BADXDR, | 2282 | | NFS4ERR_BAD_STATEID, NFS4ERR_DELAY, | 2283 | | NFS4ERR_OP_NOT_IN_SESSION, NFS4ERR_REP_TOO_BIG, | 2284 | | NFS4ERR_REP_TOO_BIG_TO_CACHE, NFS4ERR_REQ_TOO_BIG, | 2285 | | NFS4ERR_RETRY_UNCACHED_REP, NFS4ERR_SERVERFAULT, | 2286 | | NFS4ERR_TOO_MANY_OPS | 2287 +------------+------------------------------------------------------+ 2289 Table 3 2291 12. New File Attributes 2293 12.1. New RECOMMENDED Attributes - List and Definition References 2295 The list of new RECOMMENDED attributes appears in Table 4. The 2296 meaning of the columns of the table are: 2298 Name: The name of the attribute. 2300 Id: The number assigned to the attribute. In the event of conflicts 2301 between the assigned number and [4.2xdr], the latter is likely 2302 authoritative, but should be resolved with Errata to this document 2303 and/or [4.2xdr]. See [IESG08] for the Errata process. 2305 Data Type: The XDR data type of the attribute. 2307 Acc: Access allowed to the attribute. 2309 R means read-only (GETATTR may retrieve, SETATTR may not set). 2311 W means write-only (SETATTR may set, GETATTR may not retrieve). 2313 R W means read/write (GETATTR may retrieve, SETATTR may set). 2315 Defined in: The section of this specification that describes the 2316 attribute. 2318 +------------------+----+-------------------+-----+----------------+ 2319 | Name | Id | Data Type | Acc | Defined in | 2320 +------------------+----+-------------------+-----+----------------+ 2321 | change_attr_type | 79 | change_attr_type4 | R | Section 12.2.1 | 2322 | sec_label | 80 | sec_label4 | R W | Section 12.2.2 | 2323 | change_sec_label | 81 | change_sec_label4 | R | Section 12.2.3 | 2324 | space_reserved | 77 | boolean | R W | Section 12.2.4 | 2325 | space_freed | 78 | length4 | R | Section 12.2.5 | 2326 +------------------+----+-------------------+-----+----------------+ 2328 Table 4 2330 12.2. Attribute Definitions 2332 12.2.1. Attribute 79: change_attr_type 2334 enum change_attr_type4 { 2335 NFS4_CHANGE_TYPE_IS_MONOTONIC_INCR = 0, 2336 NFS4_CHANGE_TYPE_IS_VERSION_COUNTER = 1, 2337 NFS4_CHANGE_TYPE_IS_VERSION_COUNTER_NOPNFS = 2, 2338 NFS4_CHANGE_TYPE_IS_TIME_METADATA = 3, 2339 NFS4_CHANGE_TYPE_IS_UNDEFINED = 4 2340 }; 2342 change_attr_type is a per file system attribute which enables the 2343 NFSv4.2 server to provide additional information about how it expects 2344 the change attribute value to evolve after the file data, or metadata 2345 has changed. While Section 5.4 of [RFC5661] discusses per file 2346 system attributes, it is expected that the value of change_attr_type 2347 not depend on the value of "homogeneous" and only changes in the 2348 event of a migration. 2350 NFS4_CHANGE_TYPE_IS_UNDEFINED: The change attribute does not take 2351 values that fit into any of these categories. 2353 NFS4_CHANGE_TYPE_IS_MONOTONIC_INCR: The change attribute value MUST 2354 monotonically increase for every atomic change to the file 2355 attributes, data, or directory contents. 2357 NFS4_CHANGE_TYPE_IS_VERSION_COUNTER: The change attribute value MUST 2358 be incremented by one unit for every atomic change to the file 2359 attributes, data, or directory contents. This property is 2360 preserved when writing to pNFS data servers. 2362 NFS4_CHANGE_TYPE_IS_VERSION_COUNTER_NOPNFS: The change attribute 2363 value MUST be incremented by one unit for every atomic change to 2364 the file attributes, data, or directory contents. In the case 2365 where the client is writing to pNFS data servers, the number of 2366 increments is not guaranteed to exactly match the number of 2367 writes. 2369 NFS4_CHANGE_TYPE_IS_TIME_METADATA: The change attribute is 2370 implemented as suggested in the NFSv4 spec 2371 [I-D.ietf-nfsv4-rfc3530bis] in terms of the time_metadata 2372 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 80: 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 [Quigley11]. 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 If a server supports sec_label, then it MUST also support 2433 change_sec_label. Any modification to sec_label MUST modify the 2434 value for change_sec_label. 2436 12.2.3. Attribute 81: change_sec_label 2438 struct change_sec_label4 { 2439 uint64_t csl_major; 2440 uint64_t csl_minor; 2441 }; 2443 The change_sec_label attribute is a read-only attribute per file. If 2444 the value of sec_label for a file is not the same at two disparate 2445 times then the values of change_sec_label at those times MUST be 2446 different as well. The value of change_sec_label MAY change at other 2447 times as well, but this should be rare, as that will require the 2448 client to abort any operation in progress, re-read the label, and 2449 retry the operation. As the sec_label is not bounded by size, this 2450 attribute allows for VERIFY and NVERIFY to quickly determine if the 2451 sec_label has been modified. 2453 12.2.4. Attribute 77: space_reserved 2455 The space_reserve attribute is a read/write attribute of type 2456 boolean. It is a per file attribute and applies during the lifetime 2457 of the file or until it is turned off. When the space_reserved 2458 attribute is set via SETATTR, the server must ensure that there is 2459 disk space to accommodate every byte in the file before it can return 2460 success. If the server cannot guarantee this, it must return 2461 NFS4ERR_NOSPC. 2463 If the client tries to grow a file which has the space_reserved 2464 attribute set, the server must guarantee that there is disk space to 2465 accommodate every byte in the file with the new size before it can 2466 return success. If the server cannot guarantee this, it must return 2467 NFS4ERR_NOSPC. 2469 It is not required that the server allocate the space to the file 2470 before returning success. The allocation can be deferred, however, 2471 it must be guaranteed that it will not fail for lack of space. 2473 The value of space_reserved can be obtained at any time through 2474 GETATTR. If the size is retrieved at the same time, the client can 2475 determine the size of the reservation. 2477 In order to avoid ambiguity, the space_reserve bit cannot be set 2478 along with the size bit in SETATTR. Increasing the size of a file 2479 with space_reserve set will fail if space reservation cannot be 2480 guaranteed for the new size. If the file size is decreased, space 2481 reservation is only guaranteed for the new size. If a hole is 2482 punched into the file, then the reservation is not changed. 2484 12.2.5. Attribute 78: space_freed 2486 space_freed gives the number of bytes freed if the file is deleted. 2487 This attribute is read only and is of type length4. It is a per file 2488 attribute. 2490 13. Operations: REQUIRED, RECOMMENDED, or OPTIONAL 2492 The following tables summarize the operations of the NFSv4.2 protocol 2493 and the corresponding designation of REQUIRED, RECOMMENDED, and 2494 OPTIONAL to implement or either OBSOLESCENT or MUST NOT implement. 2495 The designation of OBSOLESCENT for those operations which are defined 2496 in either NFSv4.0 or NFSv4.1 and are intended to be classified as 2497 MUST NOT be implemented in NFSv4.3. The designation of MUST NOT 2498 implement is reserved for those operations that were defined in 2499 either NFSv4.0 or NFSV4.1 and MUST NOT be implemented in NFSv4.2. 2501 For the most part, the REQUIRED, RECOMMENDED, or OPTIONAL designation 2502 for operations sent by the client is for the server implementation. 2503 The client is generally required to implement the operations needed 2504 for the operating environment for which it serves. For example, a 2505 read-only NFSv4.2 client would have no need to implement the WRITE 2506 operation and is not required to do so. 2508 The REQUIRED or OPTIONAL designation for callback operations sent by 2509 the server is for both the client and server. Generally, the client 2510 has the option of creating the backchannel and sending the operations 2511 on the fore channel that will be a catalyst for the server sending 2512 callback operations. A partial exception is CB_RECALL_SLOT; the only 2513 way the client can avoid supporting this operation is by not creating 2514 a backchannel. 2516 Since this is a summary of the operations and their designation, 2517 there are subtleties that are not presented here. Therefore, if 2518 there is a question of the requirements of implementation, the 2519 operation descriptions themselves must be consulted along with other 2520 relevant explanatory text within this either specification or that of 2521 NFSv4.1 [RFC5661]. 2523 The abbreviations used in the second and third columns of the table 2524 are defined as follows. 2526 REQ REQUIRED to implement 2528 REC RECOMMENDED to implement 2530 OPT OPTIONAL to implement 2532 MNI MUST NOT implement 2534 OBS Also OBSOLESCENT for future versions. 2536 For the NFSv4.2 features that are OPTIONAL, the operations that 2537 support those features are OPTIONAL, and the server would return 2538 NFS4ERR_NOTSUPP in response to the client's use of those operations. 2539 If an OPTIONAL feature is supported, it is possible that a set of 2540 operations related to the feature become REQUIRED to implement. The 2541 third column of the table designates the feature(s) and if the 2542 operation is REQUIRED or OPTIONAL in the presence of support for the 2543 feature. 2545 The OPTIONAL features identified and their abbreviations are as 2546 follows: 2548 pNFS Parallel NFS 2550 FDELG File Delegations 2552 DDELG Directory Delegations 2553 COPY Server Side Copy 2555 ADH Application Data Holes 2557 Operations 2559 +----------------------+---------------------+----------------------+ 2560 | Operation | EOL, REQ, REC, OPT, | Feature (REQ, REC, | 2561 | | or MNI | or OPT) | 2562 +----------------------+---------------------+----------------------+ 2563 | ACCESS | REQ | | 2564 | BACKCHANNEL_CTL | REQ | | 2565 | BIND_CONN_TO_SESSION | REQ | | 2566 | CLOSE | REQ | | 2567 | COMMIT | REQ | | 2568 | COPY | OPT | COPY (REQ) | 2569 | OFFLOAD_ABORT | OPT | COPY (REQ) | 2570 | COPY_NOTIFY | OPT | COPY (REQ) | 2571 | OFFLOAD_REVOKE | OPT | COPY (REQ) | 2572 | OFFLOAD_STATUS | OPT | COPY (REQ) | 2573 | CREATE | REQ | | 2574 | CREATE_SESSION | REQ | | 2575 | DELEGPURGE | OPT | FDELG (REQ) | 2576 | DELEGRETURN | OPT | FDELG, DDELG, pNFS | 2577 | | | (REQ) | 2578 | DESTROY_CLIENTID | REQ | | 2579 | DESTROY_SESSION | REQ | | 2580 | EXCHANGE_ID | REQ | | 2581 | FREE_STATEID | REQ | | 2582 | GETATTR | REQ | | 2583 | GETDEVICEINFO | OPT | pNFS (REQ) | 2584 | GETDEVICELIST | OPT | pNFS (OPT) | 2585 | GETFH | REQ | | 2586 | WRITE_PLUS | OPT | ADH (REQ) | 2587 | GET_DIR_DELEGATION | OPT | DDELG (REQ) | 2588 | LAYOUTCOMMIT | OPT | pNFS (REQ) | 2589 | LAYOUTGET | OPT | pNFS (REQ) | 2590 | LAYOUTRETURN | OPT | pNFS (REQ) | 2591 | LINK | OPT | | 2592 | LOCK | REQ | | 2593 | LOCKT | REQ | | 2594 | LOCKU | REQ | | 2595 | LOOKUP | REQ | | 2596 | LOOKUPP | REQ | | 2597 | NVERIFY | REQ | | 2598 | OPEN | REQ | | 2599 | OPENATTR | OPT | | 2600 | OPEN_CONFIRM | MNI | | 2601 | OPEN_DOWNGRADE | REQ | | 2602 | PUTFH | REQ | | 2603 | PUTPUBFH | REQ | | 2604 | PUTROOTFH | REQ | | 2605 | READ | REQ (OBS) | | 2606 | READDIR | REQ | | 2607 | READLINK | OPT | | 2608 | READ_PLUS | OPT | ADH (REQ) | 2609 | RECLAIM_COMPLETE | REQ | | 2610 | RELEASE_LOCKOWNER | MNI | | 2611 | REMOVE | REQ | | 2612 | RENAME | REQ | | 2613 | RENEW | MNI | | 2614 | RESTOREFH | REQ | | 2615 | SAVEFH | REQ | | 2616 | SECINFO | REQ | | 2617 | SECINFO_NO_NAME | REC | pNFS file layout | 2618 | | | (REQ) | 2619 | SEQUENCE | REQ | | 2620 | SETATTR | REQ | | 2621 | SETCLIENTID | MNI | | 2622 | SETCLIENTID_CONFIRM | MNI | | 2623 | SET_SSV | REQ | | 2624 | TEST_STATEID | REQ | | 2625 | VERIFY | REQ | | 2626 | WANT_DELEGATION | OPT | FDELG (OPT) | 2627 | WRITE | REQ (OBS) | | 2628 +----------------------+---------------------+----------------------+ 2629 Callback Operations 2631 +-------------------------+-------------------+---------------------+ 2632 | Operation | REQ, REC, OPT, or | Feature (REQ, REC, | 2633 | | MNI | or OPT) | 2634 +-------------------------+-------------------+---------------------+ 2635 | CB_OFFLOAD | OPT | COPY (REQ) | 2636 | CB_GETATTR | OPT | FDELG (REQ) | 2637 | CB_LAYOUTRECALL | OPT | pNFS (REQ) | 2638 | CB_NOTIFY | OPT | DDELG (REQ) | 2639 | CB_NOTIFY_DEVICEID | OPT | pNFS (OPT) | 2640 | CB_NOTIFY_LOCK | OPT | | 2641 | CB_PUSH_DELEG | OPT | FDELG (OPT) | 2642 | CB_RECALL | OPT | FDELG, DDELG, pNFS | 2643 | | | (REQ) | 2644 | CB_RECALL_ANY | OPT | FDELG, DDELG, pNFS | 2645 | | | (REQ) | 2646 | CB_RECALL_SLOT | REQ | | 2647 | CB_RECALLABLE_OBJ_AVAIL | OPT | DDELG, pNFS (REQ) | 2648 | CB_SEQUENCE | OPT | FDELG, DDELG, pNFS | 2649 | | | (REQ) | 2650 | CB_WANTS_CANCELLED | OPT | FDELG, DDELG, pNFS | 2651 | | | (REQ) | 2652 +-------------------------+-------------------+---------------------+ 2654 14. NFSv4.2 Operations 2656 14.1. Operation 59: COPY - Initiate a server-side copy 2658 14.1.1. ARGUMENT 2660 const COPY4_GUARDED = 0x00000001; 2661 const COPY4_METADATA = 0x00000002; 2663 struct COPY4args { 2664 /* SAVED_FH: source file */ 2665 /* CURRENT_FH: destination file or */ 2666 /* directory */ 2667 stateid4 ca_src_stateid; 2668 stateid4 ca_dst_stateid; 2669 offset4 ca_src_offset; 2670 offset4 ca_dst_offset; 2671 length4 ca_count; 2672 uint32_t ca_flags; 2673 component4 ca_destination; 2674 netloc4 ca_source_server<>; 2676 }; 2678 14.1.2. RESULT 2680 union COPY4res switch (nfsstat4 cr_status) { 2681 case NFS4_OK: 2682 write_response4 resok4; 2683 default: 2684 length4 cr_bytes_copied; 2685 }; 2687 14.1.3. DESCRIPTION 2689 The COPY operation is used for both intra-server and inter-server 2690 copies. In both cases, the COPY is always sent from the client to 2691 the destination server of the file copy. The COPY operation requests 2692 that a file be copied from the location specified by the SAVED_FH 2693 value to the location specified by the combination of CURRENT_FH and 2694 ca_destination. 2696 The SAVED_FH must be a regular file. If SAVED_FH is not a regular 2697 file, the operation MUST fail and return NFS4ERR_WRONG_TYPE. 2699 In order to set SAVED_FH to the source file handle, the compound 2700 procedure requesting the COPY will include a sub-sequence of 2701 operations such as 2703 PUTFH source-fh 2704 SAVEFH 2706 If the request is for a server-to-server copy, the source-fh is a 2707 filehandle from the source server and the compound procedure is being 2708 executed on the destination server. In this case, the source-fh is a 2709 foreign filehandle on the server receiving the COPY request. If 2710 either PUTFH or SAVEFH checked the validity of the filehandle, the 2711 operation would likely fail and return NFS4ERR_STALE. 2713 If a server supports the server-to-server COPY feature, a PUTFH 2714 followed by a SAVEFH MUST NOT return NFS4ERR_STALE for either 2715 operation. These restrictions do not pose substantial difficulties 2716 for servers. The CURRENT_FH and SAVED_FH may be validated in the 2717 context of the operation referencing them and an NFS4ERR_STALE error 2718 returned for an invalid file handle at that point. 2720 For an intra-server copy, both the ca_src_stateid and ca_dst_stateid 2721 MUST refer to either open or locking states provided earlier by the 2722 server. If either stateid is invalid, then the operation MUST fail. 2723 If the request is for a inter-server copy, then the ca_src_stateid 2724 can be ignored. If ca_dst_stateid is invalid, then the operation 2725 MUST fail. 2727 The CURRENT_FH and ca_destination together specify the destination of 2728 the copy operation. If ca_destination is of 0 (zero) length, then 2729 CURRENT_FH specifies the target file. In this case, CURRENT_FH MUST 2730 be a regular file and not a directory. If ca_destination is not of 0 2731 (zero) length, the ca_destination argument specifies the file name to 2732 which the data will be copied within the directory identified by 2733 CURRENT_FH. In this case, CURRENT_FH MUST be a directory and not a 2734 regular file. 2736 If the file named by ca_destination does not exist and the operation 2737 completes successfully, the file will be visible in the file system 2738 namespace. If the file does not exist and the operation fails, the 2739 file MAY be visible in the file system namespace depending on when 2740 the failure occurs and on the implementation of the NFS server 2741 receiving the COPY operation. If the ca_destination name cannot be 2742 created in the destination file system (due to file name 2743 restrictions, such as case or length), the operation MUST fail. 2745 The ca_src_offset is the offset within the source file from which the 2746 data will be read, the ca_dst_offset is the offset within the 2747 destination file to which the data will be written, and the ca_count 2748 is the number of bytes that will be copied. An offset of 0 (zero) 2749 specifies the start of the file. A count of 0 (zero) requests that 2750 all bytes from ca_src_offset through EOF be copied to the 2751 destination. If concurrent modifications to the source file overlap 2752 with the source file region being copied, the data copied may include 2753 all, some, or none of the modifications. The client can use standard 2754 NFS operations (e.g., OPEN with OPEN4_SHARE_DENY_WRITE or mandatory 2755 byte range locks) to protect against concurrent modifications if the 2756 client is concerned about this. If the source file's end of file is 2757 being modified in parallel with a copy that specifies a count of 0 2758 (zero) bytes, the amount of data copied is implementation dependent 2759 (clients may guard against this case by specifying a non-zero count 2760 value or preventing modification of the source file as mentioned 2761 above). 2763 If the source offset or the source offset plus count is greater than 2764 or equal to the size of the source file, the operation will fail with 2765 NFS4ERR_INVAL. The destination offset or destination offset plus 2766 count may be greater than the size of the destination file. This 2767 allows for the client to issue parallel copies to implement 2768 operations such as "cat file1 file2 file3 file4 > dest". 2770 If the destination file is created as a result of this command, the 2771 destination file's size will be equal to the number of bytes 2772 successfully copied. If the destination file already existed, the 2773 destination file's size may increase as a result of this operation 2774 (e.g. if ca_dst_offset plus ca_count is greater than the 2775 destination's initial size). 2777 If the ca_source_server list is specified, then this is an inter- 2778 server copy operation and the source file is on a remote server. The 2779 client is expected to have previously issued a successful COPY_NOTIFY 2780 request to the remote source server. The ca_source_server list MUST 2781 be the same as the COPY_NOTIFY response's cnr_source_server list. If 2782 the client includes the entries from the COPY_NOTIFY response's 2783 cnr_source_server list in the ca_source_server list, the source 2784 server can indicate a specific copy protocol for the destination 2785 server to use by returning a URL, which specifies both a protocol 2786 service and server name. Server-to-server copy protocol 2787 considerations are described in Section 3.2.5 and Section 3.4.1. 2789 The ca_flags argument allows the copy operation to be customized in 2790 the following ways using the guarded flag (COPY4_GUARDED) and the 2791 metadata flag (COPY4_METADATA). 2793 If the guarded flag is set and the destination exists on the server, 2794 this operation will fail with NFS4ERR_EXIST. 2796 If the guarded flag is not set and the destination exists on the 2797 server, the behavior is implementation dependent. 2799 If the metadata flag is set and the client is requesting a whole file 2800 copy (i.e., ca_count is 0 (zero)), a subset of the destination file's 2801 attributes MUST be the same as the source file's corresponding 2802 attributes and a subset of the destination file's attributes SHOULD 2803 be the same as the source file's corresponding attributes. The 2804 attributes in the MUST and SHOULD copy subsets will be defined for 2805 each NFS version. 2807 For NFSv4.2, Table 5 and Table 6 list the REQUIRED and RECOMMENDED 2808 attributes respectively. In the "Copy to destination file?" column, 2809 a "MUST" indicates that the attribute is part of the MUST copy set. 2810 A "SHOULD" indicates that the attribute is part of the SHOULD copy 2811 set. A "no" indicates that the attribute MUST NOT be copied. 2813 REQUIRED attributes 2815 +--------------------+----+---------------------------+ 2816 | Name | Id | Copy to destination file? | 2817 +--------------------+----+---------------------------+ 2818 | supported_attrs | 0 | no | 2819 | type | 1 | MUST | 2820 | fh_expire_type | 2 | no | 2821 | change | 3 | SHOULD | 2822 | size | 4 | MUST | 2823 | link_support | 5 | no | 2824 | symlink_support | 6 | no | 2825 | named_attr | 7 | no | 2826 | fsid | 8 | no | 2827 | unique_handles | 9 | no | 2828 | lease_time | 10 | no | 2829 | rdattr_error | 11 | no | 2830 | filehandle | 19 | no | 2831 | suppattr_exclcreat | 75 | no | 2832 +--------------------+----+---------------------------+ 2834 Table 5 2836 RECOMMENDED attributes 2838 +--------------------+----+---------------------------+ 2839 | Name | Id | Copy to destination file? | 2840 +--------------------+----+---------------------------+ 2841 | acl | 12 | MUST | 2842 | aclsupport | 13 | no | 2843 | archive | 14 | no | 2844 | cansettime | 15 | no | 2845 | case_insensitive | 16 | no | 2846 | case_preserving | 17 | no | 2847 | change_attr_type | 79 | no | 2848 | change_policy | 60 | no | 2849 | chown_restricted | 18 | MUST | 2850 | dacl | 58 | MUST | 2851 | dir_notif_delay | 56 | no | 2852 | dirent_notif_delay | 57 | no | 2853 | fileid | 20 | no | 2854 | files_avail | 21 | no | 2855 | files_free | 22 | no | 2856 | files_total | 23 | no | 2857 | fs_charset_cap | 76 | no | 2858 | fs_layout_type | 62 | no | 2859 | fs_locations | 24 | no | 2860 | fs_locations_info | 67 | no | 2861 | fs_status | 61 | no | 2862 | hidden | 25 | MUST | 2863 | homogeneous | 26 | no | 2864 | layout_alignment | 66 | no | 2865 | layout_blksize | 65 | no | 2866 | layout_hint | 63 | no | 2867 | layout_type | 64 | no | 2868 | maxfilesize | 27 | no | 2869 | maxlink | 28 | no | 2870 | maxname | 29 | no | 2871 | maxread | 30 | no | 2872 | maxwrite | 31 | no | 2873 | mdsthreshold | 68 | no | 2874 | mimetype | 32 | MUST | 2875 | mode | 33 | MUST | 2876 | mode_set_masked | 74 | no | 2877 | mounted_on_fileid | 55 | no | 2878 | no_trunc | 34 | no | 2879 | numlinks | 35 | no | 2880 | owner | 36 | MUST | 2881 | owner_group | 37 | MUST | 2882 | quota_avail_hard | 38 | no | 2883 | quota_avail_soft | 39 | no | 2884 | quota_used | 40 | no | 2885 | rawdev | 41 | no | 2886 | retentevt_get | 71 | MUST | 2887 | retentevt_set | 72 | no | 2888 | retention_get | 69 | MUST | 2889 | retention_hold | 73 | MUST | 2890 | retention_set | 70 | no | 2891 | sacl | 59 | MUST | 2892 | sec_label | 80 | MUST | 2893 | space_avail | 42 | no | 2894 | space_free | 43 | no | 2895 | space_freed | 78 | no | 2896 | space_reserved | 77 | MUST | 2897 | space_total | 44 | no | 2898 | space_used | 45 | no | 2899 | system | 46 | MUST | 2900 | time_access | 47 | MUST | 2901 | time_access_set | 48 | no | 2902 | time_backup | 49 | no | 2903 | time_create | 50 | MUST | 2904 | time_delta | 51 | no | 2905 | time_metadata | 52 | SHOULD | 2906 | time_modify | 53 | MUST | 2907 | time_modify_set | 54 | no | 2908 +--------------------+----+---------------------------+ 2909 Table 6 2911 [NOTE: The source file's attribute values will take precedence over 2912 any attribute values inherited by the destination file.] 2914 In the case of an inter-server copy or an intra-server copy between 2915 file systems, the attributes supported for the source file and 2916 destination file could be different. By definition,the REQUIRED 2917 attributes will be supported in all cases. If the metadata flag is 2918 set and the source file has a RECOMMENDED attribute that is not 2919 supported for the destination file, the copy MUST fail with 2920 NFS4ERR_ATTRNOTSUPP. 2922 Any attribute supported by the destination server that is not set on 2923 the source file SHOULD be left unset. 2925 Metadata attributes not exposed via the NFS protocol SHOULD be copied 2926 to the destination file where appropriate. 2928 The destination file's named attributes are not duplicated from the 2929 source file. After the copy process completes, the client MAY 2930 attempt to duplicate named attributes using standard NFSv4 2931 operations. However, the destination file's named attribute 2932 capabilities MAY be different from the source file's named attribute 2933 capabilities. 2935 If the metadata flag is not set and the client is requesting a whole 2936 file copy (i.e., ca_count is 0 (zero)), the destination file's 2937 metadata is implementation dependent. 2939 If the client is requesting a partial file copy (i.e., ca_count is 2940 not 0 (zero)), the client SHOULD NOT set the metadata flag and the 2941 server MUST ignore the metadata flag. 2943 If the operation does not result in an immediate failure, the server 2944 will return NFS4_OK, and the CURRENT_FH will remain the destination's 2945 filehandle. 2947 If an immediate failure does occur, cr_bytes_copied will be set to 2948 the number of bytes copied to the destination file before the error 2949 occurred. The cr_bytes_copied value indicates the number of bytes 2950 copied but not which specific bytes have been copied. 2952 A return of NFS4_OK indicates that either the operation is complete 2953 or the operation was initiated and a callback will be used to deliver 2954 the final status of the operation. 2956 If the cr_callback_id is returned, this indicates that the operation 2957 was initiated and a CB_OFFLOAD callback will deliver the final 2958 results of the operation. The cr_callback_id stateid is termed a 2959 copy stateid in this context. The server is given the option of 2960 returning the results in a callback because the data may require a 2961 relatively long period of time to copy. 2963 If no cr_callback_id is returned, the operation completed 2964 synchronously and no callback will be issued by the server. The 2965 completion status of the operation is indicated by cr_status. 2967 If the copy completes successfully, either synchronously or 2968 asynchronously, the data copied from the source file to the 2969 destination file MUST appear identical to the NFS client. However, 2970 the NFS server's on disk representation of the data in the source 2971 file and destination file MAY differ. For example, the NFS server 2972 might encrypt, compress, deduplicate, or otherwise represent the on 2973 disk data in the source and destination file differently. 2975 14.2. Operation 60: OFFLOAD_ABORT - Cancel a server-side copy 2977 14.2.1. ARGUMENT 2979 struct OFFLOAD_ABORT4args { 2980 /* CURRENT_FH: destination file */ 2981 stateid4 oaa_stateid; 2982 }; 2984 14.2.2. RESULT 2986 struct OFFLOAD_ABORT4res { 2987 nfsstat4 oar_status; 2988 }; 2990 14.2.3. DESCRIPTION 2992 OFFLOAD_ABORT is used for both intra- and inter-server asynchronous 2993 copies. The OFFLOAD_ABORT operation allows the client to cancel a 2994 server-side copy operation that it initiated. This operation is sent 2995 in a COMPOUND request from the client to the destination server. 2996 This operation may be used to cancel a copy when the application that 2997 requested the copy exits before the operation is completed or for 2998 some other reason. 3000 The request contains the filehandle and copy stateid cookies that act 3001 as the context for the previously initiated copy operation. 3003 The result's oar_status field indicates whether the cancel was 3004 successful or not. A value of NFS4_OK indicates that the copy 3005 operation was canceled and no callback will be issued by the server. 3006 A copy operation that is successfully canceled may result in none, 3007 some, or all of the data and/or metadata copied. 3009 If the server supports asynchronous copies, the server is REQUIRED to 3010 support the OFFLOAD_ABORT operation. 3012 14.3. Operation 61: COPY_NOTIFY - Notify a source server of a future 3013 copy 3015 14.3.1. ARGUMENT 3017 struct COPY_NOTIFY4args { 3018 /* CURRENT_FH: source file */ 3019 stateid4 cna_src_stateid; 3020 netloc4 cna_destination_server; 3021 }; 3023 14.3.2. RESULT 3025 struct COPY_NOTIFY4resok { 3026 nfstime4 cnr_lease_time; 3027 netloc4 cnr_source_server<>; 3028 }; 3030 union COPY_NOTIFY4res switch (nfsstat4 cnr_status) { 3031 case NFS4_OK: 3032 COPY_NOTIFY4resok resok4; 3033 default: 3034 void; 3035 }; 3037 14.3.3. DESCRIPTION 3039 This operation is used for an inter-server copy. A client sends this 3040 operation in a COMPOUND request to the source server to authorize a 3041 destination server identified by cna_destination_server to read the 3042 file specified by CURRENT_FH on behalf of the given user. 3044 The cna_src_stateid MUST refer to either open or locking states 3045 provided earlier by the server. If it is invalid, then the operation 3046 MUST fail. 3048 The cna_destination_server MUST be specified using the netloc4 3049 network location format. The server is not required to resolve the 3050 cna_destination_server address before completing this operation. 3052 If this operation succeeds, the source server will allow the 3053 cna_destination_server to copy the specified file on behalf of the 3054 given user as long as both of the following conditions are met: 3056 o The destination server begins reading the source file before the 3057 cnr_lease_time expires. If the cnr_lease_time expires while the 3058 destination server is still reading the source file, the 3059 destination server is allowed to finish reading the file. 3061 o The client has not issued a COPY_REVOKE for the same combination 3062 of user, filehandle, and destination server. 3064 The cnr_lease_time is chosen by the source server. A cnr_lease_time 3065 of 0 (zero) indicates an infinite lease. To avoid the need for 3066 synchronized clocks, copy lease times are granted by the server as a 3067 time delta. To renew the copy lease time the client should resend 3068 the same copy notification request to the source server. 3070 A successful response will also contain a list of netloc4 network 3071 location formats called cnr_source_server, on which the source is 3072 willing to accept connections from the destination. These might not 3073 be reachable from the client and might be located on networks to 3074 which the client has no connection. 3076 If the client wishes to perform an inter-server copy, the client MUST 3077 send a COPY_NOTIFY to the source server. Therefore, the source 3078 server MUST support COPY_NOTIFY. 3080 For a copy only involving one server (the source and destination are 3081 on the same server), this operation is unnecessary. 3083 14.4. Operation 62: OFFLOAD_REVOKE - Revoke a destination server's copy 3084 privileges 3086 14.4.1. ARGUMENT 3088 struct OFFLOAD_REVOKE4args { 3089 /* CURRENT_FH: source file */ 3090 netloc4 ora_destination_server; 3091 }; 3093 14.4.2. RESULT 3095 struct OFFLOAD_REVOKE4res { 3096 nfsstat4 orr_status; 3097 }; 3099 14.4.3. DESCRIPTION 3101 This operation is used for an inter-server copy. A client sends this 3102 operation in a COMPOUND request to the source server to revoke the 3103 authorization of a destination server identified by 3104 ora_destination_server from reading the file specified by CURRENT_FH 3105 on behalf of given user. If the ora_destination_server has already 3106 begun copying the file, a successful return from this operation 3107 indicates that further access will be prevented. 3109 The ora_destination_server MUST be specified using the netloc4 3110 network location format. The server is not required to resolve the 3111 ora_destination_server address before completing this operation. 3113 The client uses OFFLOAD_ABORT to inform the destination to stop the 3114 active transfer and OFFLOAD_REVOKE to inform the source to not allow 3115 any more copy requests from the destination. The OFFLOAD_REVOKE 3116 operation is also useful in situations in which the source server 3117 granted a very long or infinite lease on the destination server's 3118 ability to read the source file and all copy operations on the source 3119 file have been completed. 3121 For a copy only involving one server (the source and destination are 3122 on the same server), this operation is unnecessary. 3124 If the server supports COPY_NOTIFY, the server is REQUIRED to support 3125 the OFFLOAD_REVOKE operation. 3127 14.5. Operation 63: OFFLOAD_STATUS - Poll for status of a server-side 3128 copy 3130 14.5.1. ARGUMENT 3132 struct OFFLOAD_STATUS4args { 3133 /* CURRENT_FH: destination file */ 3134 stateid4 osa_stateid; 3135 }; 3137 14.5.2. RESULT 3139 struct OFFLOAD_STATUS4resok { 3140 length4 osr_bytes_copied; 3141 nfsstat4 osr_complete<1>; 3142 }; 3144 union OFFLOAD_STATUS4res switch (nfsstat4 osr_status) { 3145 case NFS4_OK: 3146 OFFLOAD_STATUS4resok osr_resok4; 3147 default: 3148 void; 3149 }; 3151 14.5.3. DESCRIPTION 3153 OFFLOAD_STATUS is used for both intra- and inter-server asynchronous 3154 copies. The OFFLOAD_STATUS operation allows the client to poll the 3155 destination server to determine the status of an asynchronous copy 3156 operation. 3158 If this operation is successful, the number of bytes copied are 3159 returned to the client in the osr_bytes_copied field. The 3160 osr_bytes_copied value indicates the number of bytes copied but not 3161 which specific bytes have been copied. 3163 If the optional osr_complete field is present, the copy has 3164 completed. In this case the status value indicates the result of the 3165 asynchronous copy operation. In all cases, the server will also 3166 deliver the final results of the asynchronous copy in a CB_OFFLOAD 3167 operation. 3169 The failure of this operation does not indicate the result of the 3170 asynchronous copy in any way. 3172 If the server supports asynchronous copies, the server is REQUIRED to 3173 support the OFFLOAD_STATUS operation. 3175 14.6. Modification to Operation 42: EXCHANGE_ID - Instantiate Client ID 3177 14.6.1. ARGUMENT 3179 /* new */ 3180 const EXCHGID4_FLAG_SUPP_FENCE_OPS = 0x00000004; 3182 14.6.2. RESULT 3184 Unchanged 3186 14.6.3. MOTIVATION 3188 Enterprise applications require guarantees that an operation has 3189 either aborted or completed. NFSv4.1 provides this guarantee as long 3190 as the session is alive: simply send a SEQUENCE operation on the same 3191 slot with a new sequence number, and the successful return of 3192 SEQUENCE indicates the previous operation has completed. However, if 3193 the session is lost, there is no way to know when any in progress 3194 operations have aborted or completed. In hindsight, the NFSv4.1 3195 specification should have mandated that DESTROY_SESSION either abort 3196 or complete all outstanding operations. 3198 14.6.4. DESCRIPTION 3200 A client SHOULD request the EXCHGID4_FLAG_SUPP_FENCE_OPS capability 3201 when it sends an EXCHANGE_ID operation. The server SHOULD set this 3202 capability in the EXCHANGE_ID reply whether the client requests it or 3203 not. It is the server's return that determines whether this 3204 capability is in effect. When it is in effect, the following will 3205 occur: 3207 o The server will not reply to any DESTROY_SESSION invoked with the 3208 client ID until all operations in progress are completed or 3209 aborted. 3211 o The server will not reply to subsequent EXCHANGE_ID invoked on the 3212 same client owner with a new verifier until all operations in 3213 progress on the client ID's session are completed or aborted. 3215 o The NFS server SHOULD support client ID trunking, and if it does 3216 and the EXCHGID4_FLAG_SUPP_FENCE_OPS capability is enabled, then a 3217 session ID created on one node of the storage cluster MUST be 3218 destroyable via DESTROY_SESSION. In addition, DESTROY_CLIENTID 3219 and an EXCHANGE_ID with a new verifier affects all sessions 3220 regardless what node the sessions were created on. 3222 14.7. Operation 64: WRITE_PLUS 3223 14.7.1. ARGUMENT 3225 struct data_info4 { 3226 offset4 di_offset; 3227 length4 di_length; 3228 bool di_allocated; 3229 }; 3231 struct data4 { 3232 offset4 d_offset; 3233 bool d_allocated; 3234 opaque d_data<>; 3235 }; 3237 union write_plus_arg4 switch (data_content4 wpa_content) { 3238 case NFS4_CONTENT_DATA: 3239 data4 wpa_data; 3240 case NFS4_CONTENT_APP_DATA_HOLE: 3241 app_data_hole4 wpa_adh; 3242 case NFS4_CONTENT_HOLE: 3243 data_info4 wpa_hole; 3244 default: 3245 void; 3246 }; 3248 struct WRITE_PLUS4args { 3249 /* CURRENT_FH: file */ 3250 stateid4 wp_stateid; 3251 stable_how4 wp_stable; 3252 write_plus_arg4 wp_data<>; 3253 }; 3255 14.7.2. RESULT 3257 struct write_response4 { 3258 stateid4 wr_callback_id<1>; 3259 count4 wr_count; 3260 stable_how4 wr_committed; 3261 verifier4 wr_writeverf; 3262 }; 3263 union WRITE_PLUS4res switch (nfsstat4 wp_status) { 3264 case NFS4_OK: 3265 write_response4 wp_resok4; 3266 default: 3267 void; 3268 }; 3270 14.7.3. DESCRIPTION 3272 The WRITE_PLUS operation is an extension of the NFSv4.1 WRITE 3273 operation (see Section 18.2 of [RFC5661] and writes data to the 3274 regular file identified by the current filehandle. The server MAY 3275 write fewer bytes than requested by the client. 3277 The WRITE_PLUS argument is comprised of an array of rpr_contents, 3278 each of which describe a data_content4 type of data (Section 7.1.2). 3279 For NFSv4.2, the allowed values are data, ADH, and hole. The array 3280 contents MUST be contiguous in the file. A successful WRITE_PLUS 3281 will construct a reply for wr_count, wr_committed, and wr_writeverf 3282 as per the NFSv4.1 WRITE operation results. If wr_callback_id is 3283 set, it indicates an asynchronous reply (see Section 14.7.3.4). 3285 WRITE_PLUS has to support all of the errors which are returned by 3286 WRITE plus NFS4ERR_UNION_NOTSUPP. If the client asks for a hole and 3287 the server does not support that arm of the discriminated union, but 3288 does support one or more additional arms, it can signal to the client 3289 that it supports the operation, but not the arm with 3290 NFS4ERR_UNION_NOTSUPP. 3292 If the client supports WRITE_PLUS and any arm of the discriminated 3293 union other than NFS4_CONTENT_DATA, it MUST support CB_OFFLOAD. 3295 14.7.3.1. Data 3297 The d_offset specifies the offset where the data should be written. 3298 An d_offset of zero specifies that the write should start at the 3299 beginning of the file. The d_count, as encoded as part of the opaque 3300 data parameter, represents the number of bytes of data that are to be 3301 written. If the d_count is zero, the WRITE_PLUS will succeed and 3302 return a d_count of zero subject to permissions checking. 3304 Note that d_allocated has no meaning for WRITE_PLUS. 3306 The data MUST be written synchronously and MUST follow the same 3307 semantics of COMMIT as does the WRITE operation. 3309 14.7.3.2. Hole punching 3311 Whenever a client wishes to zero the blocks backing a particular 3312 region in the file, it calls the WRITE_PLUS operation with the 3313 current filehandle set to the filehandle of the file in question, and 3314 the equivalent of start offset and length in bytes of the region set 3315 in wpa_hole.di_offset and wpa_hole.di_length respectively. If the 3316 wpa_hole.di_allocated is set to TRUE, then the blocks will be zeroed 3317 and if it is set to FALSE, then they will be deallocated. All 3318 further reads to this region MUST return zeros until overwritten. 3319 The filehandle specified must be that of a regular file. 3321 Situations may arise where di_offset and/or di_offset + di_length 3322 will not be aligned to a boundary that the server does allocations/ 3323 deallocations in. For most file systems, this is the block size of 3324 the file system. In such a case, the server can deallocate as many 3325 bytes as it can in the region. The blocks that cannot be deallocated 3326 MUST be zeroed. Except for the block deallocation and maximum hole 3327 punching capability, a WRITE_PLUS operation is to be treated similar 3328 to a write of zeroes. 3330 The server is not required to complete deallocating the blocks 3331 specified in the operation before returning. The server SHOULD 3332 return an asynchronous result if it can determine the operation will 3333 be long running (see Section 14.7.3.4). 3335 If used to hole punch, WRITE_PLUS will result in the space_used 3336 attribute being decreased by the number of bytes that were 3337 deallocated. The space_freed attribute may or may not decrease, 3338 depending on the support and whether the blocks backing the specified 3339 range were shared or not. The size attribute will remain unchanged. 3341 The WRITE_PLUS operation MUST NOT change the space reservation 3342 guarantee of the file. While the server can deallocate the blocks 3343 specified by di_offset and di_length, future writes to this region 3344 MUST NOT fail with NFSERR_NOSPC. 3346 14.7.3.3. ADHs 3348 If the server supports ADHs, then it MUST support the 3349 NFS4_CONTENT_APP_DATA_HOLE arm of the WRITE_PLUS operation. The 3350 server has no concept of the structure imposed by the application. 3351 It is only when the application writes to a section of the file does 3352 order get imposed. In order to detect corruption even before the 3353 application utilizes the file, the application will want to 3354 initialize a range of ADHs using WRITE_PLUS. 3356 For ADHs, when the client invokes the WRITE_PLUS operation, it has 3357 two desired results: 3359 1. The structure described by the app_data_block4 be imposed on the 3360 file. 3362 2. The contents described by the app_data_block4 be sparse. 3364 If the server supports the WRITE_PLUS operation, it still might not 3365 support sparse files. So if it receives the WRITE_PLUS operation, 3366 then it MUST populate the contents of the file with the initialized 3367 ADHs. The server SHOULD return an asynchronous result if it can 3368 determine the operation will be long running (see Section 14.7.3.4). 3370 If the data was already initialized, there are two interesting 3371 scenarios: 3373 1. The data blocks are allocated. 3375 2. Initializing in the middle of an existing ADH. 3377 If the data blocks were already allocated, then the WRITE_PLUS is a 3378 hole punch operation. If WRITE_PLUS supports sparse files, then the 3379 data blocks are to be deallocated. If not, then the data blocks are 3380 to be rewritten in the indicated ADH format. 3382 Since the server has no knowledge of ADHs, it should not report 3383 misaligned creation of ADHs. Even while it can detect them, it 3384 cannot disallow them, as the application might be in the process of 3385 changing the size of the ADHs. Thus the server must be prepared to 3386 handle an WRITE_PLUS into an existing ADH. 3388 This document does not mandate the manner in which the server stores 3389 ADHs sparsely for a file. However, if an WRITE_PLUS arrives that 3390 will force a new ADH to start inside an existing ADH then the server 3391 will have three ADHs instead of two. It will have one up to the new 3392 one for the WRITE_PLUS, one for the WRITE_PLUS, and one for after the 3393 WRITE_PLUS. Note that depending on server specific policies for 3394 block allocation, there may also be some physical blocks allocated to 3395 align the boundaries. 3397 14.7.3.4. Asynchronous Transactions 3399 Both hole punching and ADH initialization may lead to server 3400 determining to service the operation asynchronously. If it decides 3401 to do so, it sets the stateid in wr_callback_id to be that of the 3402 wp_stateid. If it does not set the wr_callback_id, then the result 3403 is synchronous. 3405 When the client determines that the reply will be given 3406 asynchronously, it should not assume anything about the contents of 3407 what it wrote until it is informed by the server that the operation 3408 is complete. It can use OFFLOAD_STATUS (Section 14.5) to monitor the 3409 operation and OFFLOAD_ABORT (Section 14.2) to cancel the operation. 3410 An example of a asynchronous WRITE_PLUS is shown in Figure 6. Note 3411 that as with the COPY operation, WRITE_PLUS must provide a stateid 3412 for tracking the asynchronous operation. 3414 Client Server 3415 + + 3416 | | 3417 |--- OPEN ---------------------------->| Client opens 3418 |<------------------------------------/| the file 3419 | | 3420 |--- WRITE_PLUS ---------------------->| Client punches 3421 |<------------------------------------/| a hole 3422 | | 3423 | | 3424 |--- OFFLOAD_STATUS ------------------>| Client may poll 3425 |<------------------------------------/| for status 3426 | | 3427 | . | Multiple OFFLOAD_STATUS 3428 | . | operations may be sent. 3429 | . | 3430 | | 3431 |<-- CB_OFFLOAD -----------------------| Server reports results 3432 |\------------------------------------>| 3433 | | 3434 |--- CLOSE --------------------------->| Client closes 3435 |<------------------------------------/| the file 3436 | | 3437 | | 3439 Figure 6: An asynchronous WRITE_PLUS. 3441 When CB_OFFLOAD informs the client of the successful WRITE_PLUS, the 3442 write_response4 embedded in the operation will provide the necessary 3443 information that a synchronous WRITE_PLUS would have provided. 3445 Regardelss of whether the operation is asynchronous or synchronous, 3446 it MUST still support the COMMIT operation semantics as outlined in 3447 Section 18.3 of [RFC5661]. I.e., COMMIT works on one or more WRITE 3448 operations and the WRITE_PLUS operation can appear as several WRITE 3449 operations to the server. The client can use locking operations to 3450 control the behavior on the server with respect to a long running 3451 asynchornous write operations. 3453 14.8. Operation 67: IO_ADVISE - Application I/O access pattern hints 3455 14.8.1. ARGUMENT 3457 enum IO_ADVISE_type4 { 3458 IO_ADVISE4_NORMAL = 0, 3459 IO_ADVISE4_SEQUENTIAL = 1, 3460 IO_ADVISE4_SEQUENTIAL_BACKWARDS = 2, 3461 IO_ADVISE4_RANDOM = 3, 3462 IO_ADVISE4_WILLNEED = 4, 3463 IO_ADVISE4_WILLNEED_OPPORTUNISTIC = 5, 3464 IO_ADVISE4_DONTNEED = 6, 3465 IO_ADVISE4_NOREUSE = 7, 3466 IO_ADVISE4_READ = 8, 3467 IO_ADVISE4_WRITE = 9, 3468 IO_ADVISE4_INIT_PROXIMITY = 10 3469 }; 3471 struct IO_ADVISE4args { 3472 /* CURRENT_FH: file */ 3473 stateid4 iar_stateid; 3474 offset4 iar_offset; 3475 length4 iar_count; 3476 bitmap4 iar_hints; 3477 }; 3479 14.8.2. RESULT 3481 struct IO_ADVISE4resok { 3482 bitmap4 ior_hints; 3483 }; 3485 union IO_ADVISE4res switch (nfsstat4 _status) { 3486 case NFS4_OK: 3487 IO_ADVISE4resok resok4; 3488 default: 3489 void; 3490 }; 3492 14.8.3. DESCRIPTION 3494 The IO_ADVISE operation sends an I/O access pattern hint to the 3495 server for the owner of the stateid for a given byte range specified 3496 by iar_offset and iar_count. The byte range specified by iar_offset 3497 and iar_count need not currently exist in the file, but the iar_hints 3498 will apply to the byte range when it does exist. If iar_count is 0, 3499 all data following iar_offset is specified. The server MAY ignore 3500 the advice. 3502 The following are the allowed hints for a stateid holder: 3504 IO_ADVISE4_NORMAL There is no advice to give, this is the default 3505 behavior. 3507 IO_ADVISE4_SEQUENTIAL Expects to access the specified data 3508 sequentially from lower offsets to higher offsets. 3510 IO_ADVISE4_SEQUENTIAL_BACKWARDS Expects to access the specified data 3511 sequentially from higher offsets to lower offsets. 3513 IO_ADVISE4_RANDOM Expects to access the specified data in a random 3514 order. 3516 IO_ADVISE4_WILLNEED Expects to access the specified data in the near 3517 future. 3519 IO_ADVISE4_WILLNEED_OPPORTUNISTIC Expects to possibly access the 3520 data in the near future. This is a speculative hint, and 3521 therefore the server should prefetch data or indirect blocks only 3522 if it can be done at a marginal cost. 3524 IO_ADVISE_DONTNEED Expects that it will not access the specified 3525 data in the near future. 3527 IO_ADVISE_NOREUSE Expects to access the specified data once and then 3528 not reuse it thereafter. 3530 IO_ADVISE4_READ Expects to read the specified data in the near 3531 future. 3533 IO_ADVISE4_WRITE Expects to write the specified data in the near 3534 future. 3536 IO_ADVISE4_INIT_PROXIMITY Informs the server that the data in the 3537 byte range remains important to the client. 3539 Since IO_ADVISE is a hint, a server SHOULD NOT return an error and 3540 invalidate a entire Compound request if one of the sent hints in 3541 iar_hints is not supported by the server. Also, the server MUST NOT 3542 return an error if the client sends contradictory hints to the 3543 server, e.g., IO_ADVISE4_SEQUENTIAL and IO_ADVISE4_RANDOM in a single 3544 IO_ADVISE operation. In these cases, the server MUST return success 3545 and a ior_hints value that indicates the hint it intends to 3546 implement. This may mean simply returning IO_ADVISE4_NORMAL. 3548 The ior_hints returned by the server is primarily for debugging 3549 purposes since the server is under no obligation to carry out the 3550 hints that it describes in the ior_hints result. In addition, while 3551 the server may have intended to implement the hints returned in 3552 ior_hints, as time progresses, the server may need to change its 3553 handling of a given file due to several reasons including, but not 3554 limited to, memory pressure, additional IO_ADVISE hints sent by other 3555 clients, and heuristically detected file access patterns. 3557 The server MAY return different advice than what the client 3558 requested. If it does, then this might be due to one of several 3559 conditions, including, but not limited to another client advising of 3560 a different I/O access pattern; a different I/O access pattern from 3561 another client that that the server has heuristically detected; or 3562 the server is not able to support the requested I/O access pattern, 3563 perhaps due to a temporary resource limitation. 3565 Each issuance of the IO_ADVISE operation overrides all previous 3566 issuances of IO_ADVISE for a given byte range. This effectively 3567 follows a strategy of last hint wins for a given stateid and byte 3568 range. 3570 Clients should assume that hints included in an IO_ADVISE operation 3571 will be forgotten once the file is closed. 3573 14.8.4. IMPLEMENTATION 3575 The NFS client may choose to issue an IO_ADVISE operation to the 3576 server in several different instances. 3578 The most obvious is in direct response to an application's execution 3579 of posix_fadvise(). In this case, IO_ADVISE4_WRITE and 3580 IO_ADVISE4_READ may be set based upon the type of file access 3581 specified when the file was opened. 3583 14.8.5. IO_ADVISE4_INIT_PROXIMITY 3585 The IO_ADVISE4_INIT_PROXIMITY hint is non-posix in origin and conveys 3586 that the client has recently accessed the byte range in its own 3587 cache. I.e., it has not accessed it on the server, but it has 3588 locally. When the server reaches resource exhaustion, knowing which 3589 data is more important allows the server to make better choices about 3590 which data to, for example purge from a cache, or move to secondary 3591 storage. It also informs the server which delegations are more 3592 important, since if delegations are working correctly, once delegated 3593 to a client and the client has read the content for that byte range, 3594 a server might never receive another read request for that byte 3595 range. 3597 This hint is also useful in the case of NFS clients which are network 3598 booting from a server. If the first client to be booted sends this 3599 hint, then it keeps the cache warm for the remaining clients. 3601 14.8.6. pNFS File Layout Data Type Considerations 3603 The IO_ADVISE considerations for pNFS are very similar to the COMMIT 3604 considerations for pNFS. That is, as with COMMIT, some NFS server 3605 implementations prefer IO_ADVISE be done on the DS, and some prefer 3606 it be done on the MDS. 3608 So for the file's layout type, it is proposed that NFSv4.2 include an 3609 additional hint NFL42_CARE_IO_ADVISE_THRU_MDS which is valid only on 3610 NFSv4.2 or higher. Any file's layout obtained with NFSv4.1 MUST NOT 3611 have NFL42_UFLG_IO_ADVISE_THRU_MDS set. Any file's layout obtained 3612 with NFSv4.2 MAY have NFL42_UFLG_IO_ADVISE_THRU_MDS set. If the 3613 client does not implement IO_ADVISE, then it MUST ignore 3614 NFL42_UFLG_IO_ADVISE_THRU_MDS. 3616 If NFL42_UFLG_IO_ADVISE_THRU_MDS is set, the client MUST send the 3617 IO_ADVISE operation to the MDS in order for it to be honored by the 3618 DS. Once the MDS receives the IO_ADVISE operation, it will 3619 communicate the advice to each DS. 3621 If NFL42_UFLG_IO_ADVISE_THRU_MDS is not set, then the client SHOULD 3622 send an IO_ADVISE operation to the appropriate DS for the specified 3623 byte range. While the client MAY always send IO_ADVISE to the MDS, 3624 if the server has not set NFL42_UFLG_IO_ADVISE_THRU_MDS, the client 3625 should expect that such an IO_ADVISE is futile. Note that a client 3626 SHOULD use the same set of arguments on each IO_ADVISE sent to a DS 3627 for the same open file reference. 3629 The server is not required to support different advice for different 3630 DS's with the same open file reference. 3632 14.8.6.1. Dense and Sparse Packing Considerations 3634 The IO_ADVISE operation MUST use the iar_offset and byte range as 3635 dictated by the presence or absence of NFL4_UFLG_DENSE. 3637 E.g., if NFL4_UFLG_DENSE is present, and a READ or WRITE to the DS 3638 for iar_offset 0 really means iar_offset 10000 in the logical file, 3639 then an IO_ADVISE for iar_offset 0 means iar_offset 10000. 3641 E.g., if NFL4_UFLG_DENSE is absent, then a READ or WRITE to the DS 3642 for iar_offset 0 really means iar_offset 0 in the logical file, then 3643 an IO_ADVISE for iar_offset 0 means iar_offset 0 in the logical file. 3645 E.g., if NFL4_UFLG_DENSE is present, the stripe unit is 1000 bytes 3646 and the stripe count is 10, and the dense DS file is serving 3647 iar_offset 0. A READ or WRITE to the DS for iar_offsets 0, 1000, 3648 2000, and 3000, really mean iar_offsets 10000, 20000, 30000, and 3649 40000 (implying a stripe count of 10 and a stripe unit of 1000), then 3650 an IO_ADVISE sent to the same DS with an iar_offset of 500, and a 3651 iar_count of 3000 means that the IO_ADVISE applies to these byte 3652 ranges of the dense DS file: 3654 - 500 to 999 3655 - 1000 to 1999 3656 - 2000 to 2999 3657 - 3000 to 3499 3659 I.e., the contiguous range 500 to 3499 as specified in IO_ADVISE. 3661 It also applies to these byte ranges of the logical file: 3663 - 10500 to 10999 (500 bytes) 3664 - 20000 to 20999 (1000 bytes) 3665 - 30000 to 30999 (1000 bytes) 3666 - 40000 to 40499 (500 bytes) 3667 (total 3000 bytes) 3669 E.g., if NFL4_UFLG_DENSE is absent, the stripe unit is 250 bytes, the 3670 stripe count is 4, and the sparse DS file is serving iar_offset 0. 3671 Then a READ or WRITE to the DS for iar_offsets 0, 1000, 2000, and 3672 3000, really mean iar_offsets 0, 1000, 2000, and 3000 in the logical 3673 file, keeping in mind that on the DS file,. byte ranges 250 to 999, 3674 1250 to 1999, 2250 to 2999, and 3250 to 3999 are not accessible. 3675 Then an IO_ADVISE sent to the same DS with an iar_offset of 500, and 3676 a iar_count of 3000 means that the IO_ADVISE applies to these byte 3677 ranges of the logical file and the sparse DS file: 3679 - 500 to 999 (500 bytes) - no effect 3680 - 1000 to 1249 (250 bytes) - effective 3681 - 1250 to 1999 (750 bytes) - no effect 3682 - 2000 to 2249 (250 bytes) - effective 3683 - 2250 to 2999 (750 bytes) - no effect 3684 - 3000 to 3249 (250 bytes) - effective 3685 - 3250 to 3499 (250 bytes) - no effect 3686 (subtotal 2250 bytes) - no effect 3687 (subtotal 750 bytes) - effective 3688 (grand total 3000 bytes) - no effect + effective 3690 If neither of the flags NFL42_UFLG_IO_ADVISE_THRU_MDS and 3691 NFL4_UFLG_DENSE are set in the layout, then any IO_ADVISE request 3692 sent to the data server with a byte range that overlaps stripe unit 3693 that the data server does not serve MUST NOT result in the status 3694 NFS4ERR_PNFS_IO_HOLE. Instead, the response SHOULD be successful and 3695 if the server applies IO_ADVISE hints on any stripe units that 3696 overlap with the specified range, those hints SHOULD be indicated in 3697 the response. 3699 14.9. Changes to Operation 51: LAYOUTRETURN 3701 14.9.1. Introduction 3703 In the pNFS description provided in [RFC5661], the client is not 3704 capable to relay an error code from the DS to the MDS. In the 3705 specification of the Objects-Based Layout protocol [RFC5664], use is 3706 made of the opaque lrf_body field of the LAYOUTRETURN argument to do 3707 such a relaying of error codes. In this section, we define a new 3708 data structure to enable the passing of error codes back to the MDS 3709 and provide some guidelines on what both the client and MDS should 3710 expect in such circumstances. 3712 There are two broad classes of errors, transient and persistent. The 3713 client SHOULD strive to only use this new mechanism to report 3714 persistent errors. It MUST be able to deal with transient issues by 3715 itself. Also, while the client might consider an issue to be 3716 persistent, it MUST be prepared for the MDS to consider such issues 3717 to be transient. A prime example of this is if the MDS fences off a 3718 client from either a stateid or a filehandle. The client will get an 3719 error from the DS and might relay either NFS4ERR_ACCESS or 3720 NFS4ERR_BAD_STATEID back to the MDS, with the belief that this is a 3721 hard error. If the MDS is informed by the client that there is an 3722 error, it can safely ignore that. For it, the mission is 3723 accomplished in that the client has returned a layout that the MDS 3724 had most likely recalled. 3726 The client might also need to inform the MDS that it cannot reach one 3727 or more of the DSes. While the MDS can detect the connectivity of 3728 both of these paths: 3730 o MDS to DS 3732 o MDS to client 3734 it cannot determine if the client and DS path is working. As with 3735 the case of the DS passing errors to the client, it must be prepared 3736 for the MDS to consider such outages as being transitory. 3738 The existing LAYOUTRETURN operation is extended by introducing a new 3739 data structure to report errors, layoutreturn_device_error4. Also, 3740 layoutreturn_device_error4 is introduced to enable an array of errors 3741 to be reported. 3743 14.9.2. ARGUMENT 3745 The ARGUMENT specification of the LAYOUTRETURN operation in section 3746 18.44.1 of [RFC5661] is augmented by the following XDR code 3747 [RFC4506]: 3749 struct layoutreturn_device_error4 { 3750 deviceid4 lrde_deviceid; 3751 nfsstat4 lrde_status; 3752 nfs_opnum4 lrde_opnum; 3753 }; 3755 struct layoutreturn_error_report4 { 3756 layoutreturn_device_error4 lrer_errors<>; 3757 }; 3759 14.9.3. RESULT 3761 The RESULT of the LAYOUTRETURN operation is unchanged; see section 3762 18.44.2 of [RFC5661]. 3764 14.9.4. DESCRIPTION 3766 The following text is added to the end of the LAYOUTRETURN operation 3767 DESCRIPTION in section 18.44.3 of [RFC5661]. 3769 When a client uses LAYOUTRETURN with a type of LAYOUTRETURN4_FILE, 3770 then if the lrf_body field is NULL, it indicates to the MDS that the 3771 client experienced no errors. If lrf_body is non-NULL, then the 3772 field references error information which is layout type specific. 3773 I.e., the Objects-Based Layout protocol can continue to utilize 3774 lrf_body as specified in [RFC5664]. For both Files-Based and Block- 3775 Based Layouts, the field references a layoutreturn_device_error4, 3776 which contains an array of layoutreturn_device_error4. 3778 Each individual layoutreturn_device_error4 describes a single error 3779 associated with a DS, which is identified via lrde_deviceid. The 3780 operation which returned the error is identified via lrde_opnum. 3781 Finally the NFS error value (nfsstat4) encountered is provided via 3782 lrde_status and may consist of the following error codes: 3784 NFS4ERR_NXIO: The client was unable to establish any communication 3785 with the DS. 3787 NFS4ERR_*: The client was able to establish communication with the 3788 DS and is returning one of the allowed error codes for the 3789 operation denoted by lrde_opnum. 3791 14.9.5. IMPLEMENTATION 3793 The following text is added to the end of the LAYOUTRETURN operation 3794 IMPLEMENTATION in section 18.4.4 of [RFC5661]. 3796 Clients are expected to tolerate transient storage device errors, and 3797 hence clients SHOULD NOT use the LAYOUTRETURN error handling for 3798 device access problems that may be transient. The methods by which a 3799 client decides whether a device access problem is transient vs. 3800 persistent are implementation-specific, but may include retrying I/Os 3801 to a data server under appropriate conditions. 3803 When an I/O fails to a storage device, the client SHOULD retry the 3804 failed I/O via the MDS. In this situation, before retrying the I/O, 3805 the client SHOULD return the layout, or the affected portion thereof, 3806 and SHOULD indicate which storage device or devices was problematic. 3807 The client needs to do this when the DS is being unresponsive in 3808 order to fence off any failed write attempts, and ensure that they do 3809 not end up overwriting any later data being written through the MDS. 3810 If the client does not do this, the MDS MAY issue a layout recall 3811 callback in order to perform the retried I/O. 3813 The client needs to be cognizant that since this error handling is 3814 optional in the MDS, the MDS may silently ignore this functionality. 3815 Also, as the MDS may consider some issues the client reports to be 3816 expected (see Section 14.9.1), the client might find it difficult to 3817 detect a MDS which has not implemented error handling via 3818 LAYOUTRETURN. 3820 If an MDS is aware that a storage device is proving problematic to a 3821 client, the MDS SHOULD NOT include that storage device in any pNFS 3822 layouts sent to that client. If the MDS is aware that a storage 3823 device is affecting many clients, then the MDS SHOULD NOT include 3824 that storage device in any pNFS layouts sent out. If a client asks 3825 for a new layout for the file from the MDS, it MUST be prepared for 3826 the MDS to return that storage device in the layout. The MDS might 3827 not have any choice in using the storage device, i.e., there might 3828 only be one possible layout for the system. Also, in the case of 3829 existing files, the MDS might have no choice in which storage devices 3830 to hand out to clients. 3832 The MDS is not required to indefinitely retain per-client storage 3833 device error information. An MDS is also not required to 3834 automatically reinstate use of a previously problematic storage 3835 device; administrative intervention may be required instead. 3837 14.10. Operation 65: READ_PLUS 3839 14.10.1. ARGUMENT 3841 struct READ_PLUS4args { 3842 /* CURRENT_FH: file */ 3843 stateid4 rpa_stateid; 3844 offset4 rpa_offset; 3845 count4 rpa_count; 3846 }; 3848 14.10.2. RESULT 3850 struct data_info4 { 3851 offset4 di_offset; 3852 length4 di_length; 3853 bool di_allocated; 3854 }; 3856 struct data4 { 3857 offset4 d_offset; 3858 bool d_allocated; 3859 opaque d_data<>; 3860 }; 3861 union read_plus_content switch (data_content4 rpc_content) { 3862 case NFS4_CONTENT_DATA: 3863 data4 rpc_data; 3864 case NFS4_CONTENT_APP_DATA_HOLE: 3865 app_data_hole4 rpc_adh; 3866 case NFS4_CONTENT_HOLE: 3867 data_info4 rpc_hole; 3868 default: 3869 void; 3870 }; 3872 /* 3873 * Allow a return of an array of contents. 3874 */ 3875 struct read_plus_res4 { 3876 bool rpr_eof; 3877 read_plus_content rpr_contents<>; 3878 }; 3880 union READ_PLUS4res switch (nfsstat4 rp_status) { 3881 case NFS4_OK: 3882 read_plus_res4 rp_resok4; 3883 default: 3884 void; 3885 }; 3887 14.10.3. DESCRIPTION 3889 The READ_PLUS operation is based upon the NFSv4.1 READ operation (see 3890 Section 18.22 of [RFC5661]) and similarly reads data from the regular 3891 file identified by the current filehandle. 3893 The client provides a rpa_offset of where the READ_PLUS is to start 3894 and a rpa_count of how many bytes are to be read. A rpa_offset of 3895 zero means to read data starting at the beginning of the file. If 3896 rpa_offset is greater than or equal to the size of the file, the 3897 status NFS4_OK is returned with di_length (the data length) set to 3898 zero and eof set to TRUE. 3900 The READ_PLUS result is comprised of an array of rpr_contents, each 3901 of which describe a data_content4 type of data (Section 7.1.2). For 3902 NFSv4.2, the allowed values are data, ADH, and hole. A server is 3903 required to support the data type, but neither ADH nor hole. Both an 3904 ADH and a hole must be returned in its entirety - clients must be 3905 prepared to get more information than they requested. Both the start 3906 and the end of the hole may exceed what was requested. The array 3907 contents MUST be contiguous in the file. 3909 READ_PLUS has to support all of the errors which are returned by READ 3910 plus NFS4ERR_UNION_NOTSUPP. If the client asks for a hole and the 3911 server does not support that arm of the discriminated union, but does 3912 support one or more additional arms, it can signal to the client that 3913 it supports the operation, but not the arm with 3914 NFS4ERR_UNION_NOTSUPP. 3916 If the data to be returned is comprised entirely of zeros, then the 3917 server may elect to return that data as a hole. The server 3918 differentiates this to the client by setting di_allocated to TRUE in 3919 this case. Note that in such a scenario, the server is not required 3920 to determine the full extent of the "hole" - it does not need to 3921 determine where the zeros start and end. If the server elects to 3922 return the hole as data, then it can set the d_allocted to FALSE in 3923 the rpc_data to indicate it is a hole. 3925 The server may elect to return adjacent elements of the same type. 3926 For example, the guard pattern or block size of an ADH might change, 3927 which would require adjacent elements of type ADH. Likewise if the 3928 server has a range of data comprised entirely of zeros and then a 3929 hole, it might want to return two adjacent holes to the client. 3931 If the client specifies a rpa_count value of zero, the READ_PLUS 3932 succeeds and returns zero bytes of data. In all situations, the 3933 server may choose to return fewer bytes than specified by the client. 3934 The client needs to check for this condition and handle the condition 3935 appropriately. 3937 If the client specifies an rpa_offset and rpa_count value that is 3938 entirely contained within a hole of the file, then the di_offset and 3939 di_length returned must be for the entire hole. This result is 3940 considered valid until the file is changed (detected via the change 3941 attribute). The server MUST provide the same semantics for the hole 3942 as if the client read the region and received zeroes; the implied 3943 holes contents lifetime MUST be exactly the same as any other read 3944 data. 3946 If the client specifies an rpa_offset and rpa_count value that begins 3947 in a non-hole of the file but extends into hole the server should 3948 return an array comprised of both data and a hole. The client MUST 3949 be prepared for the server to return a short read describing just the 3950 data. The client will then issue another READ_PLUS for the remaining 3951 bytes, which the server will respond with information about the hole 3952 in the file. 3954 Except when special stateids are used, the stateid value for a 3955 READ_PLUS request represents a value returned from a previous byte- 3956 range lock or share reservation request or the stateid associated 3957 with a delegation. The stateid identifies the associated owners if 3958 any and is used by the server to verify that the associated locks are 3959 still valid (e.g., have not been revoked). 3961 If the read ended at the end-of-file (formally, in a correctly formed 3962 READ_PLUS operation, if rpa_offset + rpa_count is equal to the size 3963 of the file), or the READ_PLUS operation extends beyond the size of 3964 the file (if rpa_offset + rpa_count is greater than the size of the 3965 file), eof is returned as TRUE; otherwise, it is FALSE. A successful 3966 READ_PLUS of an empty file will always return eof as TRUE. 3968 If the current filehandle is not an ordinary file, an error will be 3969 returned to the client. In the case that the current filehandle 3970 represents an object of type NF4DIR, NFS4ERR_ISDIR is returned. If 3971 the current filehandle designates a symbolic link, NFS4ERR_SYMLINK is 3972 returned. In all other cases, NFS4ERR_WRONG_TYPE is returned. 3974 For a READ_PLUS with a stateid value of all bits equal to zero, the 3975 server MAY allow the READ_PLUS to be serviced subject to mandatory 3976 byte-range locks or the current share deny modes for the file. For a 3977 READ_PLUS with a stateid value of all bits equal to one, the server 3978 MAY allow READ_PLUS operations to bypass locking checks at the 3979 server. 3981 On success, the current filehandle retains its value. 3983 14.10.4. IMPLEMENTATION 3985 In general, the IMPLEMENTATION notes for READ in Section 18.22.4 of 3986 [RFC5661] also apply to READ_PLUS. One delta is that when the owner 3987 has a locked byte range, the server MUST return an array of 3988 rpr_contents with values inside that range. 3990 14.10.4.1. Additional pNFS Implementation Information 3992 With pNFS, the semantics of using READ_PLUS remains the same. Any 3993 data server MAY return a hole or ADH result for a READ_PLUS request 3994 that it receives. When a data server chooses to return such a 3995 result, it has the option of returning information for the data 3996 stored on that data server (as defined by the data layout), but it 3997 MUST NOT return results for a byte range that includes data managed 3998 by another data server. 4000 A data server should do its best to return as much information about 4001 a ADH as is feasible without having to contact the metadata server. 4002 If communication with the metadata server is required, then every 4003 attempt should be taken to minimize the number of requests. 4005 If mandatory locking is enforced, then the data server must also 4006 ensure that to return only information that is within the owner's 4007 locked byte range. 4009 14.10.5. READ_PLUS with Sparse Files Example 4011 The following table describes a sparse file. For each byte range, 4012 the file contains either non-zero data or a hole. In addition, the 4013 server in this example uses a Hole Threshold of 32K. 4015 +-------------+----------+ 4016 | Byte-Range | Contents | 4017 +-------------+----------+ 4018 | 0-15999 | Hole | 4019 | 16K-31999 | Non-Zero | 4020 | 32K-255999 | Hole | 4021 | 256K-287999 | Non-Zero | 4022 | 288K-353999 | Hole | 4023 | 354K-417999 | Non-Zero | 4024 +-------------+----------+ 4026 Table 7 4028 Under the given circumstances, if a client was to read from the file 4029 with a max read size of 64K, the following will be the results for 4030 the given READ_PLUS calls. This assumes the client has already 4031 opened the file, acquired a valid stateid ('s' in the example), and 4032 just needs to issue READ_PLUS requests. 4034 1. READ_PLUS(s, 0, 64K) --> NFS_OK, eof = false, . Since the first hole is less than the server's 4036 Hole Threshhold, the first 32K of the file is returned as data 4037 and the remaining 32K is returned as a hole which actually 4038 extends to 256K. 4040 2. READ_PLUS(s, 32K, 64K) --> NFS_OK, eof = false, 4041 The requested range was all zeros, and the current hole begins at 4042 offset 32K and is 224K in length. Note that the client should 4043 not have followed up the previous READ_PLUS request with this one 4044 as the hole information from the previous call extended past what 4045 the client was requesting. 4047 3. READ_PLUS(s, 256K, 64K) --> NFS_OK, eof = false, . Returns an array of the 32K data and 4049 the hole which extends to 354K. 4051 4. READ_PLUS(s, 354K, 64K) --> NFS_OK, eof = true, . Returns the final 64K of data and informs the client 4053 there is no more data in the file. 4055 14.11. Operation 66: SEEK 4057 SEEK is an operation that allows a client to determine the location 4058 of the next data_content4 in a file. It allows an implementation of 4059 the emerging extension to lseek(2) to allow clients to determine 4060 SEEK_HOLE and SEEK_DATA. 4062 14.11.1. ARGUMENT 4064 struct SEEK4args { 4065 /* CURRENT_FH: file */ 4066 stateid4 sa_stateid; 4067 offset4 sa_offset; 4068 data_content4 sa_what; 4069 }; 4071 14.11.2. RESULT 4073 union seek_content switch (data_content4 content) { 4074 case NFS4_CONTENT_DATA: 4075 data_info4 sc_data; 4076 case NFS4_CONTENT_APP_DATA_HOLE: 4077 app_data_hole4 sc_adh; 4078 case NFS4_CONTENT_HOLE: 4079 data_info4 sc_hole; 4080 default: 4081 void; 4082 }; 4084 struct seek_res4 { 4085 bool sr_eof; 4086 seek_content sr_contents; 4087 }; 4089 union SEEK4res switch (nfsstat4 status) { 4090 case NFS4_OK: 4091 seek_res4 resok4; 4092 default: 4093 void; 4094 }; 4096 14.11.3. DESCRIPTION 4098 From the given sa_offset, find the next data_content4 of type sa_what 4099 in the file. For either a hole or ADH, this must return the 4100 data_content4 in its entirety. For data, it must not return the 4101 actual data. 4103 SEEK must follow the same rules for stateids as READ_PLUS 4104 (Section 14.10.3). 4106 If the server could not find a corresponding sa_what, then the status 4107 would still be NFS4_OK, but sr_eof would be TRUE. The sr_contents 4108 would contain a zero-ed out content of the appropriate type. 4110 15. NFSv4.2 Callback Operations 4112 15.1. Operation 15: CB_OFFLOAD - Report results of an asynchronous 4113 operation 4115 15.1.1. ARGUMENT 4117 struct write_response4 { 4118 stateid4 wr_callback_id<1>; 4119 count4 wr_count; 4120 stable_how4 wr_committed; 4121 verifier4 wr_writeverf; 4122 }; 4124 union offload_info4 switch (nfsstat4 coa_status) { 4125 case NFS4_OK: 4126 write_response4 coa_resok4; 4127 default: 4128 length4 coa_bytes_copied; 4129 }; 4131 struct CB_OFFLOAD4args { 4132 nfs_fh4 coa_fh; 4133 stateid4 coa_stateid; 4134 offload_info4 coa_offload_info; 4135 }; 4137 15.1.2. RESULT 4139 struct CB_OFFLOAD4res { 4140 nfsstat4 cor_status; 4141 }; 4143 15.1.3. DESCRIPTION 4145 CB_OFFLOAD is used to report to the client the results of an 4146 asynchronous operation, e.g., Server-side Copy or a hole punch. The 4147 coa_fh and coa_stateid identify the transaction and the coa_status 4148 indicates success or failure. The coa_resok4.wr_callback_id MUST NOT 4149 be set. If the transaction failed, then the coa_bytes_copied 4150 contains the number of bytes copied before the failure occurred. The 4151 coa_bytes_copied value indicates the number of bytes copied but not 4152 which specific bytes have been copied. 4154 If the client supports either 4156 1. the COPY operation 4158 2. the WRITE_PLUS operation and any arm of the discriminated union 4159 other than NFS4_CONTENT_DATA 4161 then the client is REQUIRED to support the CB_OFFLOAD operation. 4163 There is a potential race between the reply to the original 4164 transaction on the forechannel and the CB_OFFLOAD callback on the 4165 backchannel. Sections 2.10.6.3 and 20.9.3 in [RFC5661] describes how 4166 to handle this type of issue. 4168 15.1.3.1. Server-side Copy 4170 CB_OFFLOAD is used for both intra- and inter-server asynchronous 4171 copies. This operation is sent by the destination server to the 4172 client in a CB_COMPOUND request. Upon success, the 4173 coa_resok4.wr_count presents the total number of bytes copied. 4175 15.1.3.2. WRITE_PLUS 4177 CB_OFFLOAD is used to report the completion of either a hole punch or 4178 an ADH initialization. Upon success, the coa_resok4 will contain the 4179 same information that a synchronous WRITE_PLUS would have returned. 4181 16. IANA Considerations 4183 This section uses terms that are defined in [RFC5226]. 4185 17. References 4187 17.1. Normative References 4189 [4.2xdr] Haynes, T., "Network File System (NFS) Version 4 Minor 4190 Version 2 External Data Representation Standard (XDR) 4191 Description", March 2013. 4193 [RFC2203] Eisler, M., Chiu, A., and L. Ling, "RPCSEC_GSS Protocol 4194 Specification", RFC 2203, September 1997. 4196 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 4197 Resource Identifier (URI): Generic Syntax", STD 66, 4198 RFC 3986, January 2005. 4200 [RFC5661] Shepler, S., Eisler, M., and D. Noveck, "Network File 4201 System (NFS) Version 4 Minor Version 1 Protocol", 4202 RFC 5661, January 2010. 4204 [RFC5664] Halevy, B., Welch, B., and J. Zelenka, "Object-Based 4205 Parallel NFS (pNFS) Operations", RFC 5664, January 2010. 4207 [posix_fadvise] 4208 The Open Group, "Section 'posix_fadvise()' of System 4209 Interfaces of The Open Group Base Specifications Issue 6, 4210 IEEE Std 1003.1, 2004 Edition", 2004. 4212 [rpcsecgssv3] 4213 Haynes, T. and N. Williams, "Remote Procedure Call (RPC) 4214 Security Version 3", draft-williams-rpcsecgssv3 (work in 4215 progress), 2011. 4217 17.2. Informative References 4219 [Ashdown08] 4220 Ashdown, L., "Chapter 15, Validating Database Files and 4221 Backups, of Oracle Database Backup and Recovery User's 4222 Guide 11g Release 1 (11.1)", August 2008. 4224 [Baira08] Bairavasundaram, L., Goodson, G., Schroeder, B., Arpaci- 4225 Dusseau, A., and R. Arpaci-Dusseau, "An Analysis of Data 4226 Corruption in the Storage Stack", Proceedings of the 6th 4227 USENIX Symposium on File and Storage Technologies (FAST 4228 '08) , 2008. 4230 [FEDFS-ADMIN] 4231 Lentini, J., Everhart, C., Ellard, D., Tewari, R., and M. 4232 Naik, "Administration Protocol for Federated Filesystems", 4233 draft-ietf-nfsv4-federated-fs-admin (Work In Progress), 4234 2010. 4236 [FEDFS-NSDB] 4237 Lentini, J., Everhart, C., Ellard, D., Tewari, R., and M. 4238 Naik, "NSDB Protocol for Federated Filesystems", 4239 draft-ietf-nfsv4-federated-fs-protocol (Work In Progress), 4240 2010. 4242 [Haynes12] 4243 Haynes, T., "Requirements for Labeled NFS", 4244 draft-ietf-nfsv4-labreqs-03 (work in progress). 4246 [I-D.ietf-nfsv4-rfc3530bis] 4247 Haynes, T. and D. Noveck, "Network File System (NFS) 4248 version 4 Protocol", draft-ietf-nfsv4-rfc3530bis-25 (Work 4249 In Progress), February 2013. 4251 [IESG08] ISEG, "IESG Processing of RFC Errata for the IETF Stream", 4252 2008. 4254 [MLS] "Section 46.6. Multi-Level Security (MLS) of Deployment 4255 Guide: Deployment, configuration and administration of Red 4256 Hat Enterprise Linux 5, Edition 6", 2011. 4258 [McDougall07] 4259 McDougall, R. and J. Mauro, "Section 11.4.3, Detecting 4260 Memory Corruption of Solaris Internals", 2007. 4262 [Quigley11] 4263 Quigley, D. and J. Lu, "Registry Specification for MAC 4264 Security Label Formats", 4265 draft-quigley-label-format-registry (work in progress), 4266 2011. 4268 [RFC0959] Postel, J. and J. Reynolds, "File Transfer Protocol", 4269 STD 9, RFC 959, October 1985. 4271 [RFC1994] Simpson, W., "PPP Challenge Handshake Authentication 4272 Protocol (CHAP)", RFC 1994, August 1996. 4274 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 4275 Requirement Levels", March 1997. 4277 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 4278 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 4279 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 4281 [RFC4506] Eisler, M., "XDR: External Data Representation Standard", 4282 RFC 4506, May 2006. 4284 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 4285 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 4286 May 2008. 4288 [Strohm11] 4289 Strohm, R., "Chapter 2, Data Blocks, Extents, and 4290 Segments, of Oracle Database Concepts 11g Release 1 4291 (11.1)", January 2011. 4293 Appendix A. Acknowledgments 4295 For the pNFS Access Permissions Check, the original draft was by 4296 Sorin Faibish, David Black, Mike Eisler, and Jason Glasgow. The work 4297 was influenced by discussions with Benny Halevy and Bruce Fields. A 4298 review was done by Tom Haynes. 4300 For the Sharing change attribute implementation details with NFSv4 4301 clients, the original draft was by Trond Myklebust. 4303 For the NFS Server-side Copy, the original draft was by James 4304 Lentini, Mike Eisler, Deepak Kenchammana, Anshul Madan, and Rahul 4305 Iyer. Tom Talpey co-authored an unpublished version of that 4306 document. It was also was reviewed by a number of individuals: 4307 Pranoop Erasani, Tom Haynes, Arthur Lent, Trond Myklebust, Dave 4308 Noveck, Theresa Lingutla-Raj, Manjunath Shankararao, Satyam Vaghani, 4309 and Nico Williams. 4311 For the NFS space reservation operations, the original draft was by 4312 Mike Eisler, James Lentini, Manjunath Shankararao, and Rahul Iyer. 4314 For the sparse file support, the original draft was by Dean 4315 Hildebrand and Marc Eshel. Valuable input and advice was received 4316 from Sorin Faibish, Bruce Fields, Benny Halevy, Trond Myklebust, and 4317 Richard Scheffenegger. 4319 For the Application IO Hints, the original draft was by Dean 4320 Hildebrand, Mike Eisler, Trond Myklebust, and Sam Falkner. Some 4321 early reviewers included Benny Halevy and Pranoop Erasani. 4323 For Labeled NFS, the original draft was by David Quigley, James 4324 Morris, Jarret Lu, and Tom Haynes. Peter Staubach, Trond Myklebust, 4325 Stephen Smalley, Sorrin Faibish, Nico Williams, and David Black also 4326 contributed in the final push to get this accepted. 4328 During the review process, Talia Reyes-Ortiz helped the sessions run 4329 smoothly. While many people contributed here and there, the core 4330 reviewers were Andy Adamson, Pranoop Erasani, Bruce Fields, Chuck 4331 Lever, Trond Myklebust, David Noveck, Peter Staubach, and Mike 4332 Kupfer. 4334 Appendix B. RFC Editor Notes 4336 [RFC Editor: please remove this section prior to publishing this 4337 document as an RFC] 4339 [RFC Editor: prior to publishing this document as an RFC, please 4340 replace all occurrences of RFCTBD10 with RFCxxxx where xxxx is the 4341 RFC number of this document] 4343 Author's Address 4345 Thomas Haynes (editor) 4346 NetApp 4347 9110 E 66th St 4348 Tulsa, OK 74133 4349 USA 4351 Phone: +1 918 307 1415 4352 Email: thomas@netapp.com 4353 URI: http://www.tulsalabs.com