Copying a file via NFS the client reads the data from the source file and then writes the same data to the destination file which is located in the same server or it could be located in a different server. Either way the file data is transferred twice, once for reading and the second for writing. Server side copy allows unnecessary network traffic to be eliminated. The intra-server copy allows the client to request the server to perform the copy internally thus avoiding any data being sent through the network at all. In the case for the inter-server copy where the destination server is different from the source server, the client authorizes both servers to interact directly with one another.
The system call copy_file_range is used to send both intra and inter server side copy requests to the correct server.
Basic server side copy tests verify the actual file range from the source file(s) are copied correctly to the destination file(s). Most tests deal with a single source and destination file while verifying the data is copied correctly. Also it verifies the data is copied starting from the correct source offset and it is copied to the correct offset on the destination file. Other tests deal with multiple files: copying multiple source files to a single destination file, a single source file to multiple destination files, or N number of source files to M number of destination files.
Some tests include testing at the protocol level by taking a packet trace and inspecting the actual packets sent to the server or servers. For the intra-server side copy, these tests verify the COPY/CLONE operation is sent to the server with correct arguments. For the inter-server side copy, these tests verify the COPY_NOTIFY operation is sent to the source server with correct arguments to authorize the source server to allow the destination server to copy the data directly; then the client sends the COPY operation to the destination server so it could initiate the actual copy.
The server side copy could either be synchronous or asynchronous depending on both client and server(s). The client could issue either a synchronous or asynchronous copy and the server could either copy the file data in either mode depending on implementation or other factors. In either case, the tests verify the correct functionality for both cases. The CB_OFFLOAD operation is used by the destination server to report the actual results of the copy when it is done. The client could also actively query the destination server for status on a current asynchronous copy using the OFFLOAD_STATUS operation. Also the client has a mechanism to cancel a given asynchronous copy using the OFFLOAD_CANCEL operation.
Negative testing is included whenever possible since some testing cannot be done at the protocol level because the copy_file_range system call does some error checking of its own and the NFS client won't even send a COPY_NOTIFY or COPY operation to the server letting the server deal with the error. Negative tests include trying to copy an invalid source range, having an invalid value for either the offset or the length, trying to copy a region on a source file opened as write only, a destination file opened as read only or the file is a non-regular file type.
Run all intra server side copy tests: intra01, intra02, intra03, intra04, intra05, intra06, intra07, intra08, intra09, intra10, intra11, intra12, intra13, intra14, intra15
Run all positive intra server side copy tests: intra01, intra02, intra03, intra04, intra05, intra06, intra07, intra08, intra14, intra15
Run all negative intra server side copy tests: intra09, intra10, intra11, intra12, intra13
Verify intra server side COPY succeeds
Verify intra server side COPY succeeds when using source offset
Verify intra server side COPY succeeds when using destination offset
Verify intra server side COPY succeeds when using NULL as source offset
Verify intra server side COPY succeeds when using NULL as destination offset
Verify intra server side COPY succeeds when using count = 0
Verify intra server side COPY succeeds when the source file is opened as read/write
Verify intra server side COPY succeeds when the destination file is opened as read/write
Verify intra server side COPY fails when the source file is opened as write only
Verify intra server side COPY fails when the destination file is opened as read only
Verify intra server side COPY succeeds when source offset is beyond the end of the file
Verify intra server side COPY succeeds when source offset plus count is beyond the end of the file
Verify intra server side COPY may fail when both source and destination files point to the same file
Verify intra server side COPY succeeds when using multiple source and destination offsets
Verify intra server side COPY succeeds when using multiple source and destination files
Run all inter server side copy tests: inter01, inter02, inter03, inter04, inter05, inter06, inter07, inter08, inter09, inter10, inter11, inter12, inter13, inter14, inter15
Run all positive inter server side copy tests: inter01, inter02, inter03, inter04, inter05, inter06, inter07, inter08, inter13, inter14, inter15
Run all negative inter server side copy tests: inter09, inter10, inter11, inter12
Verify inter server side COPY succeeds
Verify inter server side COPY succeeds when using source offset
Verify inter server side COPY succeeds when using destination offset
Verify inter server side COPY succeeds when using NULL as source offset
Verify inter server side COPY succeeds when using NULL as destination offset
Verify inter server side COPY succeeds when using count = 0
Verify inter server side COPY succeeds when the source file is opened as read/write
Verify inter server side COPY succeeds when the destination file is opened as read/write
Verify inter server side COPY fails when the source file is opened as write only
Verify inter server side COPY fails when the destination file is opened as read only
Verify inter server side COPY succeeds when source offset is beyond the end of the file
Verify inter server side COPY succeeds when source offset plus count is beyond the end of the file
Verify inter server side COPY succeeds when both source and destination file names are the same
Verify inter server side COPY succeeds when using multiple source and destination offsets
Verify inter server side COPY succeeds when using multiple source and destination files
Run all positive server side copy tests: intra01, intra02, intra03, intra04, intra05, intra06, intra07, intra08, intra14, intra15, inter01, inter02, inter03, inter04, inter05, inter06, inter07, inter08, inter13, inter14, inter15
Run all negative server side copy tests: intra09, intra10, intra11, intra12, intra13, inter09, inter10, inter11, inter12
Run all tests: intra01, intra02, intra03, intra04, intra05, intra06, intra07, intra08, intra09, intra10, intra11, intra12, intra13, intra14, intra15, inter01, inter02, inter03, inter04, inter05, inter06, inter07, inter08, inter09, inter10, inter11, inter12, inter13, inter14, inter15
The user id must be able to 'ssh' to remote host without the need for a password.
Valid only for NFS version 4.2 and above.