]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
NFSD: Handle an NFS4ERR_DELAY response to CB_OFFLOAD
authorChuck Lever <chuck.lever@oracle.com>
Thu, 31 Oct 2024 13:40:05 +0000 (09:40 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Tue, 19 Nov 2024 01:23:10 +0000 (20:23 -0500)
RFC 7862 permits callback services to respond to CB_OFFLOAD with
NFS4ERR_DELAY. Currently NFSD drops the CB_OFFLOAD in that case.

To improve the reliability of COPY offload, NFSD should rather send
another CB_OFFLOAD completion notification.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4proc.c
fs/nfsd/xdr4.h

index 5c10131410957d1ec2beabda8d5d4ca0f8a71eed..54db3979605fb717e404bd1833e5e01bc3706613 100644 (file)
@@ -1617,6 +1617,13 @@ static int nfsd4_cb_offload_done(struct nfsd4_callback *cb,
                container_of(cb, struct nfsd4_cb_offload, co_cb);
 
        trace_nfsd_cb_offload_done(&cbo->co_res.cb_stateid, task);
+       switch (task->tk_status) {
+       case -NFS4ERR_DELAY:
+               if (cbo->co_retries--) {
+                       rpc_delay(task, 1 * HZ);
+                       return 0;
+               }
+       }
        return 1;
 }
 
@@ -1745,6 +1752,7 @@ static void nfsd4_send_cb_offload(struct nfsd4_copy *copy)
        memcpy(&cbo->co_res, &copy->cp_res, sizeof(copy->cp_res));
        memcpy(&cbo->co_fh, &copy->fh, sizeof(copy->fh));
        cbo->co_nfserr = copy->nfserr;
+       cbo->co_retries = 5;
 
        nfsd4_init_cb(&cbo->co_cb, copy->cp_clp, &nfsd4_cb_offload_ops,
                      NFSPROC4_CLNT_CB_OFFLOAD);
index 08e5d280f887f985e03f630a77ccdad5ae7b4208..550f7e064f2ba94bee06a40a2e1e2b84126fc8fa 100644 (file)
@@ -676,6 +676,7 @@ struct nfsd4_cb_offload {
        struct nfsd4_callback   co_cb;
        struct nfsd42_write_res co_res;
        __be32                  co_nfserr;
+       unsigned int            co_retries;
        struct knfsd_fh         co_fh;
 };