Skip to content

Commit 5c41f32

Browse files
committed
NFSD: Handle an NFS4ERR_DELAY response to CB_OFFLOAD
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>
1 parent 409d6f5 commit 5c41f32

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

fs/nfsd/nfs4proc.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,6 +1617,13 @@ static int nfsd4_cb_offload_done(struct nfsd4_callback *cb,
16171617
container_of(cb, struct nfsd4_cb_offload, co_cb);
16181618

16191619
trace_nfsd_cb_offload_done(&cbo->co_res.cb_stateid, task);
1620+
switch (task->tk_status) {
1621+
case -NFS4ERR_DELAY:
1622+
if (cbo->co_retries--) {
1623+
rpc_delay(task, 1 * HZ);
1624+
return 0;
1625+
}
1626+
}
16201627
return 1;
16211628
}
16221629

@@ -1745,6 +1752,7 @@ static void nfsd4_send_cb_offload(struct nfsd4_copy *copy)
17451752
memcpy(&cbo->co_res, &copy->cp_res, sizeof(copy->cp_res));
17461753
memcpy(&cbo->co_fh, &copy->fh, sizeof(copy->fh));
17471754
cbo->co_nfserr = copy->nfserr;
1755+
cbo->co_retries = 5;
17481756

17491757
nfsd4_init_cb(&cbo->co_cb, copy->cp_clp, &nfsd4_cb_offload_ops,
17501758
NFSPROC4_CLNT_CB_OFFLOAD);

fs/nfsd/xdr4.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,7 @@ struct nfsd4_cb_offload {
676676
struct nfsd4_callback co_cb;
677677
struct nfsd42_write_res co_res;
678678
__be32 co_nfserr;
679+
unsigned int co_retries;
679680
struct knfsd_fh co_fh;
680681
};
681682

0 commit comments

Comments
 (0)