2024-04-30 20:14:02

by Chuck Lever

[permalink] [raw]
Subject: [RFC PATCH 0/2] NFSD: expand the implementation of OFFLOAD_STATUS

From: Chuck Lever <[email protected]>

I'm looking at RFC 7862 to try to understand what the various
OFFLOAD_STATUS responses mean.

> 15.9.3. DESCRIPTION
>
> OFFLOAD_STATUS can be used by the client to query the progress of an
> asynchronous operation, which is identified by both CURRENT_FH and
> the osa_stateid. If this operation is successful, the number of
> bytes processed is returned to the client in the osr_count field.

NFSD returns only the byte count today.

> If the optional osr_complete field is present, the asynchronous
> operation has completed. In this case, the status value indicates
> the result of the asynchronous operation.

NFSD currently never returns the status code -- NFSD's response XDR
encoder always stuffs "zero" in the array count for the osr_complete
array. IMO, zero is OK, but only for the “COPY is still running”
case.

Once the async COPY has completed, a subsequent OFFLOAD_STATUS
should show that the COPY succeeded (or failed), until the server
receives the client’s CB_OFFLOAD reply, or until the client’s lease
expires.

For the "COPY has completed successfully" case, the above text
suggests that OFFLOAD_STATUS returns NFS4_OK, and needs to return a
proper status code in the osr_complete array: Probably NFS4_OK.

A "COPY has completed but failed" status can be reported by
OFFLOAD_STATUS returning NFS4_OK and setting the osr_complete field
to the failing COPY status code.

The two patches here change NFSD in that direction.

Chuck Lever (2):
NFSD: Record status of async copy operation in struct nfsd4_copy
NFSD: Add COPY status code to OFFLOAD_STATUS response

fs/nfsd/nfs4proc.c | 31 ++++++++++++++++++-------------
fs/nfsd/nfs4xdr.c | 7 ++++++-
fs/nfsd/xdr4.h | 5 ++++-
3 files changed, 28 insertions(+), 15 deletions(-)


base-commit: 06cd86b25b980a58e5584e9cd38c080467b24c25
--
2.44.0