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