NFSD: Add COPY status code to OFFLOAD_STATUS response
authorChuck Lever <chuck.lever@oracle.com>
Tue, 30 Apr 2024 20:05:11 +0000 (16:05 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 6 May 2024 13:07:23 +0000 (09:07 -0400)
commitcc63c21682a51e24338baf30424b2987e05a556a
tree932851574e90e73bc23620f3af496bab5a0c3ac9
parenta8483b9ad92c9d07122efe8697f0f42f6c41d1b1
NFSD: Add COPY status code to OFFLOAD_STATUS response

Clients that send an OFFLOAD_STATUS might want to distinguish
between an async COPY operation that is still running, has
completed successfully, or that has failed.

The intention of this patch is to make NFSD behave like this:

 * Copy still running:
OFFLOAD_STATUS returns NFS4_OK, the number of bytes copied
so far, and an empty osr_status array
 * Copy completed successfully:
OFFLOAD_STATUS returns NFS4_OK, the number of bytes copied,
and an osr_status of NFS4_OK
 * Copy failed:
OFFLOAD_STATUS returns NFS4_OK, the number of bytes copied,
and an osr_status other than NFS4_OK
 * Copy operation lost, canceled, or otherwise unrecognized:
OFFLOAD_STATUS returns NFS4ERR_BAD_STATEID

NB: Though RFC 7862 Section 11.2 lists a small set of NFS status
codes that are valid for OFFLOAD_STATUS, there do not seem to be any
explicit spec limits on the status codes that may be returned in the
osr_status field.

At this time we have no unit tests for COPY and its brethren, as
pynfs does not yet implement support for NFSv4.2.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4proc.c
fs/nfsd/nfs4xdr.c
fs/nfsd/xdr4.h