NFSv4 J. Lentini Internet-Draft M. Eisler Intended status: Standards Track R. Iyer Expires: October 2, 2009 D. Kenchammana A. Madan NetApp March 31, 2009 NFS Server-side Copy draft-lentini-nfsv4-server-side-copy-00.txt Status of this Memo This Internet-Draft is submitted to IETF in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet- Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt. The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. This Internet-Draft will expire on October 2, 2009. Copyright Notice Copyright (c) 2009 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents in effect on the date of publication of this document (http://trustee.ietf.org/license-info). Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Lentini, et al. Expires October 2, 2009 [Page 1] Internet-Draft NFS Server-side Copy March 2009 Abstract This document describes a set of NFS operations to offload copying a file to a file server or between two file servers. Table of Contents 1. Requirements notation . . . . . . . . . . . . . . . . . . . . 3 2. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 3. Operations . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3.1. netloc4 - Network Locations . . . . . . . . . . . . . . . 4 3.2. Operation T: COPY_NOTIFY - Notify a server of a future copy . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.3. Operation U: COPY_REVOKE - Revoke a server's copy priveleges . . . . . . . . . . . . . . . . . . . . . . . . 6 3.4. Operation V: COPY - Copy a file on the server . . . . . . 7 3.5. Operation X: COPY_ABORT - Cancel a server-side copy . . . 11 3.6. Operation Y: COPY_STATUS - Report results of a server-side copy . . . . . . . . . . . . . . . . . . . . . 12 3.7. Operation Z: CB_COPY - Report results of a server-side copy . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.8. Copy Offload Stateids . . . . . . . . . . . . . . . . . . 14 4. Security Considerations . . . . . . . . . . . . . . . . . . . 14 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 14 6. Normative References . . . . . . . . . . . . . . . . . . . . . 15 Appendix A. Acknowledgments . . . . . . . . . . . . . . . . . . . 15 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 15 Lentini, et al. Expires October 2, 2009 [Page 2] Internet-Draft NFS Server-side Copy March 2009 1. Requirements notation The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119]. 2. Introduction This document describes a server-side copy operation for the NFS protocol. The server-side copy operation provides a mechanism for the NFS client to perform a copy operation on the server without the data being transmitted back and forth over the network. Without this operation, an NFS client copies data from one location to another by reading the data from the server over the network, and then writing the data back over the network to the server. Using this server-side copy operation, the client is able to instruct the server to copy the data locally without the data being sent back and forth over the network unnecessarily. In general, this feature is useful whenever data is copied from one location to another on the server. It is particularly useful when copying the contents of a file from a snapshot. Snapshot-versions of a file are copied for a number of reasons, including restoring and cloning data. If the source object and destination object are on different file servers, the file servers will communicate with one another to perform the copy operation. The server-to-server protocol by which this is accomplished is not defined in this document. 3. Operations In the sections that follow, several operations are defined that together provide the server-side copy feature. These operations are intended to be OPTIONAL operations as defined in section 17 of [NFSv4.1]. The COPY_NOTIFY, COPY, COPY_ABORT, and COPY_STATUS operations are designed to be sent within an NFSv4 COMPOUND procedure. The CB_COPY operation is designed to be sent within an NFSv4 CB_COMPOUND procedure. Lentini, et al. Expires October 2, 2009 [Page 3] Internet-Draft NFS Server-side Copy March 2009 3.1. netloc4 - Network Locations The server-side copy operations specify network locations using the netloc4 data type shown below: enum netloc_type4 { NL4_NAME = 0, NL4_NETADDR = 1 }; union netloc4 switch (netloc_type4 nl_type) { case NL4_NAME: utf8str_cis nl_name; case NL4_NETADDR: netaddr4 nl_addr; }; If the netloc4 is of type NL4_NAME, the nl_name field MUST be specified as a UTF-8 string. The nl_name is expected to be resolved via DNS, LDAP, NIS, /etc/hosts, or some other means to a network address. If the netloc4 is of type NL4_NETADDR, the nl_addr field MUST contain a valid netaddr4. 3.2. Operation T: COPY_NOTIFY - Notify a server of a future copy ARGUMENTS struct COPY_NOTIFY4args { /* CURRENT_FH: source file */ netloc4 cna_destination_server; }; RESULTS union COPY_NOTIFY4res switch (nfsstat4 cnr_status) { case NFS4_OK: nfstime4 cnr_lease_time; default: void; }; DESCRIPTION This operation authorizes a remote server to copy data from the recipient. It instructs the recipient to expect a copy operation from the server identified by cna_destination_server on the file specified by CURRENT_FH. The cna_destination_server MUST be specified using the netloc4 network location format. The server is not required to resolve the Lentini, et al. Expires October 2, 2009 [Page 4] Internet-Draft NFS Server-side Copy March 2009 cna_destination_server address before completing this operation. If this operation succeeds, the recipient will allow the cna_destination_server to copy the specified file exactly once before the copy lease time cnr_lease_time expires. The cnr_lease_time is chosen by the server. To renew the copy lease time the client should resend the same copy notification request to the source server. To avoid the need for synchronized clocks, copy lease times are granted by the server as a time delta. However, there is a requirement that the client and server clocks do not drift excessively over the duration of the lease. There is also the issue of propagation delay across the network which could easily be several hundred milliseconds as well as the possibility that requests will be lost and need to be retransmitted. To take propagation delay into account, the client should subtract it from copy lease times (e.g. if the client estimates the one-way propagation delay as 200 milliseconds, then it can assume that the lease is already 200 milliseconds old when it gets it). In addition, it will take another 200 milliseconds to get a response back to the server. So the client must send a lease renewal or send the copy offload request to the cna_destination_server at least 400 milliseconds before the copy lease would expire. If the propagation delay varies over the life of the lease (e.g. the client is on a mobile host), the client will need to continuously subtract the increase in propagation delay from the copy lease times. The server's copy lease period configuration should take into account the network distance of the clients that will be accessing the server's resources. It is expected that the lease period will take into account the network propagation delays and other network delay factors for the client population. Since the protocol does not allow for an automatic method to determine an appropriate copy lease period, the server's administrator may have to tune the copy lease period. For a copy only involving one server (the source and destination are on the same server), this operation is unnecessary. The COPY_NOTIFY operation may fail for the following reasons: NFS4ERR_NOSUPP: The copy offload operation is not supported by the NFS server receiving this request. Lentini, et al. Expires October 2, 2009 [Page 5] Internet-Draft NFS Server-side Copy March 2009 3.3. Operation U: COPY_REVOKE - Revoke a server's copy priveleges ARGUMENTS struct COPY_REVOKE4args { /* CURRENT_FH: source file */ netloc4 cra_destination_server; }; RESULTS struct COPY_REVOKE4res { nfsstat4 crr_status; }; DESCRIPTION This operation revokes a remote server's ability to copy data from the recipient. It instructs the recipient to prevent a copy operation from the server identified by cra_destination_server on the file specified by CURRENT_FH. If the cra_destination_server has already begun copying the file, a successful return from this operation indicates that further access will be prevented. The cra_destination_server MUST be specified using the netloc4 network location format. The server is not required to resolve the cra_destination_server address before completing this operation. The COPY_REVOKE operation is useful in situations involving an asynchronous server-to-server copy. For example, suppose an NFS client initiates a copy of file X from NFS server A to NFS server B. If NFS server B decides to perform an asynchronous copy and a network partition prevents communication between the NFS client and NFS server B (without disrupting communication between the NFS client and NFS server A or between NFS server A and NFS server B), the NFS client may like to write new information to file X. In this situation, the client may treat the copy as a failure and start writing to file X regardless of the ultimate status (if the network partition is removed and the copy operation does succeeded, the contents of the copied file would be uncertain). However, if the client wishes to write sensitive information to file X that NFS server B is not intended to see, the client MUST use a COPY_REVOKE operation to ensure NFS server B is prevented access to the updates to file X. For a copy only involving one server (the source and destination are on the same server), this operation is unnecessary. Lentini, et al. Expires October 2, 2009 [Page 6] Internet-Draft NFS Server-side Copy March 2009 If the server supports COPY_NOTIFY, the server is REQUIRED to support the COPY_REVOKE operation. The COPY_REVOKE operation may fail for the following reasons: NFS4ERR_NOSUPP: The copy offload operation is not supported by the NFS server receiving this request. 3.4. Operation V: COPY - Copy a file on the server ARGUMENTS #define COPY4_GUARDED = 0x00000001; #define COPY4_METADATA = 0x00000002; #define COPY4_SPACE_RESERVED = 0x00000004; struct COPY4args { /* SAVED_FH: source file */ /* CURRENT_FH: destination directory */ offset4 ca_src_offset; offset4 ca_dst_offset; length4 ca_count; uint32_t ca_flags; component4 ca_destination; netloc4 ca_source_server<1>; }; RESULTS union COPY4res switch (nfsstat4 cr_status) { /* CURRENT_FH: destination file */ case NFS4_OK: stateid4 cr_callback_id<1>; default: length4 cr_bytes_copied; }; DESCRIPTION The COPY operation request that a file be copied from the location specified by the SAVED_FH value to the location specified by the combination of CURRENT_FH and ca_destination. The SAVED_FH must be a file. If SAVED_FH is not a file, the operation MUST fail and return NFS4ERR_ISDIR. In order to set SAVED_FH to the source file handle, the compound procedure requesting the COPY will include a sub-sequence of Lentini, et al. Expires October 2, 2009 [Page 7] Internet-Draft NFS Server-side Copy March 2009 operations such as PUTFH source-fh SAVEFH If the request is for a server-to-server copy, the source-fh is a filehandle from the source server and the compound procedure is being executed on the destination server. In this case, the source-fh is a foreign filehandle on the server receiving the COPY request. If either PUTFH or SAVEFH checked the validity of the filehandle, the operation would likely fail and return NFS4ERR_STALE. In order to avoid this problem, the minor version incorporating the COPY operations will need to make a few small changes in the handling of existing operations. If a server supports the server-to-server COPY feature, a PUTFH followed by a SAVEFH MUST NOT return NFS4ERR_STALE for either operation. These restrictions do not pose substantial difficulties for servers. The CURRENT_FH and SAVED_FH may be validated in the context of the operation referencing them and an NFS4ERR_STALE error returned for an invalid file handle at that point. The CURRENT_FH and ca_destination together specify the destination of the copy operation. If ca_destination is of 0 (zero) length, then CURRENT_FH specifies the target file. In this case, CURRENT_FH MUST be a file and not a directory. If ca_destination is not of 0 (zero) length, the ca_destination argument specifies the file name to which the data will be copied within the directory identified by CURRENT_FH. In this case, CURRENT_FH MUST be a directory and not a file. If the file named by ca_destination does not exist and the operation completes successfully, the file will be visible in the file system namespace. If the file does not exist and the operation fails, the file MAY be visible in the file system namespace depending on when the failure occurs and on the implementation of the NFS server receiving the COPY operation. If the ca_destination name cannot be created in the destination file system (due to file name restrictions, such as case or length), the operation MUST fail. The ca_src_offset is the offset within the source file from which the data will be read, the ca_dst_offset is the offset within the destination file to which the data will be written, and the ca_count is the number of bytes that will be copied. An offset of 0 (zero) specifies the start of the file. A count of 0 (zero) requests that all bytes from ca_src_offset through EOF be copied to the destination. If modifications to the source file overlap with the source file region being copied, the data copied may include all, Lentini, et al. Expires October 2, 2009 [Page 8] Internet-Draft NFS Server-side Copy March 2009 some, or none of the modifications. If the source file's end of file is being modified in parallel with a copy that specifies a count of 0 (zero) bytes, the amount of data copied is implementation dependent (clients may guard against this case by specifying a non-zero count value). If the source offset or the source offset plus count is greater than or equal to the size of the source file, the operation will fail with NFS4ERR_INVAL. The destination offset or destination offset plus count may be greater than the size of the destination file. This allows for the client to issue parallel copies to implement operations such as "cat file1 file2 file3 file4 > dest". If the destination file is created as a result of this command, the destination file's size will be equal to the number of bytes successfully copied. If the destination file already existed, the destination file's size may increase as a result of this operation (e.g. if ca_dst_offset plus ca_count is greater than the destination's initial size). If the ca_source_server field is specified, the source of the copy operation is on a remote server. The client is expected to have previously issued a successful COPY_NOTIFY request to the remote server. The server-to-server protocol used to copy the data is not defined in this document. The ca_flags argument allows the copy operation to be customized in the following ways using the guarded flag (COPY4_GUARDED), the metadata flag (COPY4_METADATA), and the space reserved flag (COPY4_SPACE_RESERVED). If the guarded flag is set and the destination exists on the server, this operation will fail with NFS4ERR_EXIST. If the guarded flag is not set and the destination exists on the server, the behavior is implementation dependent. If the metadata flag is set, the destination's metadata MUST match the source's metadata. In particular, all of the REQUIRED, RECOMMENDED, and named attributes of the destination file MUST be the same as the source file. To preserve namespace junctions, if access to the source file generates an NFS4ERR_MOVED error, access to the destination file MUST also generate an NFS4ERR_MOVED error. If these requirements cannot be met, the server MUST return NFS4ERR_ATTRNOTSUPP. If the metadata flag is not set, the destination's metadata is implementation dependent. Lentini, et al. Expires October 2, 2009 [Page 9] Internet-Draft NFS Server-side Copy March 2009 If the space reserved flag is set, the operation will only succeed if the file server can guarantee that all writes to the copied file will not fail due to insufficient space. If space_reserved is not set, the space reservation state of the new file is implementation dependent. If the operation does not result in an immediate failure, the server will return NFS4_OK, and the CURRENT_FH will be set to the destination's filehandle. If an immediate failure does occur, cr_bytes_copied will be set to the number of bytes copied to the destination file before the error occurred. A return of NFS4_OK indicates that either the operation is complete or the operation was initiated and a callback will be used to deliver the final status of the operation. If the cr_callback_id is returned, this indicates that the operation was initiated and a CB_COPY callback will deliver the final results of the operation. The cr_callback_id stateid is termed a copy stateid in this context. The server is given the option of returning the results in a callback because the data may require a relatively long period of time to copy. If no cr_callback_id is returned, the operation completed synchronously and no callback will be issued by the server. The completion status of the operation is indicated by cr_status. The COPY operation may fail for the following reasons: NFS4ERR_NOSUPP: The copy offload operation is not supported by the NFS server receiving this request. NFS4ERR_PARTNER_NOTSUPP: The remote server does not support the server-to-server copy offload protocol. NFS4ERR_PARTNER_NO_AUTH: The remote server does not authorize the server-to-server copy offload operation. This may be due to the client's failure to send the COPY_NOTIFY operation to the remote server, the remote server receiving the server-to-server copy offload request after the copy lease time expired, or for some other permission problem. NFS4ERR_FBIG: The copy operation would have caused the file to grow beyond the server's limit. Lentini, et al. Expires October 2, 2009 [Page 10] Internet-Draft NFS Server-side Copy March 2009 NFS4ERR_NOTDIR: The CURRENT_FH is a file and ca_destination has non- zero length. NFS4ERR_ISDIR: The SAVED_FH is a directory, or the CURRENT_FH is a directory and ca_destination has zero length. NFS4ERR_INVAL: The source offset or offset plus count are greater than or equal to the size of the source file. NFS4ERR_DELAY: The server does not have the resources to perform the copy operation at the current time. The client should retry the operation sometime in the future. NFS4ERR_METADATA_NOTSUPP: The destination file cannot support the same metadata as the source file. 3.5. Operation X: COPY_ABORT - Cancel a server-side copy ARGUMENTS struct COPY_ABORT4args { /* CURRENT_FH: destination file */ stateid4 caa_stateid; }; RESULTS struct COPY_ABORT4res { nfsstat4 car_status; }; DESCRIPTION The COPY_ABORT operation allows the client to cancel a server-side copy operation that it initiated. This operation may be used to cancel a copy when the application that requested the copy exits before the operation is completed or for some other reason. The request contains the filehandle and copy stateid cookies that act as the context for the previously initiated copy operation. The result's car_status field indicates whether the cancel was successful or not. A value of NFS4_OK indicates that the copy operation was canceled and no callback will be issued by the server. A copy operation that is successfully canceled may result in none, some, or all of the data copied. If the server supports asynchronous copies, the server is REQUIRED to Lentini, et al. Expires October 2, 2009 [Page 11] Internet-Draft NFS Server-side Copy March 2009 support the COPY_ABORT operation. The COPY_ABORT operation may fail for the following reasons: NFS4ERR_NOSUPP: The abort operation is not supported by the NFS server receiving this request. NFS4ERR_RETRY: The abort failed, but a retry at some time in the future MAY succeed. NFS4ERR_COMPLETE_ALREADY: The abort failed, and a callback will deliver the results of the copy operation. NFS4ERR_SERVERFAULT: An error occurred on the server that does not map to a specific error code. 3.6. Operation Y: COPY_STATUS - Report results of a server-side copy ARGUMENTS struct COPY_STATUS4args { /* CURRENT_FH: destination file */ stateid4 csa_stateid; }; RESULTS union COPY_STATUS4res switch (nfsstat4 cr_status) { case NFS4_OK: length4 csr_bytes_copied; default: void; }; DESCRIPTION The COPY_STATUS operation allows the client to poll the server to determine the status of an asynchronous copy operation. If this operation is successful, the number of bytes copied are returned to the client. The failure of this operation does not indicate the result of the asynchronous copy in any way. If the server supports asynchronous copies, the server is REQUIRED to support the COPY_STATUS operation. The COPY_STATUS operation may fail for the following reasons: Lentini, et al. Expires October 2, 2009 [Page 12] Internet-Draft NFS Server-side Copy March 2009 NFS4ERR_NOSUPP: The copy status operation is not supported by the NFS server receiving this request. NFS4ERR_BAD_STATEID: The stateid is not valid (see Copy Offload Stateid section below). NFS4ERR_EXPIRED: The stateid has expired (see Copy Offload Stateid section below). 3.7. Operation Z: CB_COPY - Report results of a server-side copy ARGUMENTS union copy_info4 switch (nfsstat4 cca_status) { case NFS4_OK: void; default: length4 cca_bytes_copied; }; struct CB_COPY4args { nfs_fh4 cca_fh; stateid4 cca_stateid; copy_info4 cca_copy_info; }; RESULTS struct CB_COPY4res { nfsstat4 ccr_status; }; DESCRIPTION The CB_COPY callback informs the client of the result of a server- side copy operation. The operation is identified by the filehandle and stateid arguments. The result is indicated by the status field. If the copy failed, cca_bytes_copied contains the number of bytes copied before the failure occurred. In the absence of an established backchannel, the server cannot signal the completion of the COPY via a CB_COPY callback. The loss of a callback channel would be indicated by the server setting the SEQ4_STATUS_CB_PATH_DOWN flag in the sr_status_flags field of the SEQUENCE operation. The client must re-establish the callback channel to receive the status of the COPY operation. Prolonged loss of the callback channel could result in the server dropping the COPY operation state and invalidating the copy stateid. Lentini, et al. Expires October 2, 2009 [Page 13] Internet-Draft NFS Server-side Copy March 2009 If the client supports the COPY operation, the client is REQUIRED to support the CB_COPY operation. The CB_COPY operation may fail for the following reasons: NFS4ERR_NOSUPP: The copy offload operation is not supported by the NFS client receiving this request. 3.8. Copy Offload Stateids A server may perform a copy offload operation asynchronously. An asynchronous copy is tracked using a copy offload stateid. Copy offload stateids are include in the COPY, COPY_ABORT, COPY_STATUS, and CB_COPY operations. Section 8.2.4 of [NFSv4.1] specifies that stateids are valid until either (A) the client or server restart or (B) the client returns the resource. Case (A) applies to a copy offload stateid, but case (B) does not (there is no way for the client to "return the resources"). A copy offload stateid will be valid until either (A) the client or server restart or (C) the client replies to a CB_COPY operation. A copy offload stateid's seqid MUST NOT be 0 (zero). In the context of a copy offload operation, it is ambiguous to indicate the most recent copy offload operation using a stateid with seqid of 0 (zero). Therefore a copy offload stateid with seqid of 0 (zero) MUST be considered invalid. 4. Security Considerations The security considerations pertaining to NFSv4 [RFC3530] apply to this document. The standard security mechanisms provide by NFSv4 [RFC3530] may be used to secure the protocol described in this document. For copy operations between distinct source and destination NFS servers, the authors expect RPCSEC_GSSv3 to provide a mechanism for the client to delegate authority to the destination NFS server to pull the data from the source NFS server. 5. IANA Considerations This document has no actions for IANA. Lentini, et al. Expires October 2, 2009 [Page 14] Internet-Draft NFS Server-side Copy March 2009 6. Normative References [NFSv4.1] S. Shepler, et al., "NFS Version 4 Minor Version 1 (Work In Progress)", draft-ietf-nfsv4-minorversion1 , 2008. [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. [RFC3530] Shepler, S., Callaghan, B., Robinson, D., Thurlow, R., Beame, C., Eisler, M., and D. Noveck, "Network File System (NFS) version 4 Protocol", RFC 3530, April 2003. Appendix A. Acknowledgments Tom Talpey co-authored an unpublished version of this document. We thank Tom for his contributions, especially with regards to the asynchronous completion callback mechanism. This document was reviewed by a number of individuals. We would like to thank Arthur Lent, Trond Myklebust, and Dave Noveck for their input and advice. Authors' Addresses James Lentini NetApp 1601 Trapelo Rd, Suite 16 Waltham, MA 02451 USA Phone: +1 781-768-5359 Email: jlentini@netapp.com Mike Eisler NetApp 5765 Chase Point Circle Colorado Springs, CO 80919 USA Phone: +1 719-599-9026 Email: mike@eisler.com URI: http://www.eisler.com Lentini, et al. Expires October 2, 2009 [Page 15] Internet-Draft NFS Server-side Copy March 2009 Rahul Iyer NetApp 475 East Java Drive Sunnyvale, CA 94089 USA Phone: +1 408-822-3980 Email: iyer@netapp.com Deepak Kenchammana NetApp 475 East Java Drive Sunnyvale, CA 94089 USA Phone: +1 408-822-4765 Email: kencham@netapp.com Anshul Madan NetApp 3rd Floor, Fair Winds Block EGL Software Park Bangalore, Karnataka 560 071 India Phone: +91 80-41843349 Email: anshul@netapp.com Lentini, et al. Expires October 2, 2009 [Page 16]