Skip to content

Commit 7a84394

Browse files
JPEWdevAnna Schumaker
authored andcommitted
NFS4: Apply delay_retrans to async operations
The setting of delay_retrans is applied to synchronous RPC operations because the retransmit count is stored in same struct nfs4_exception that is passed each time an error is checked. However, for asynchronous operations (READ, WRITE, LOCKU, CLOSE, DELEGRETURN), a new struct nfs4_exception is made on the stack each time the task callback is invoked. This means that the retransmit count is always zero and thus delay_retrans never takes effect. Apply delay_retrans to these operations by tracking and updating their retransmit count. Change-Id: Ieb33e046c2b277cb979caa3faca7f52faf0568c9 Signed-off-by: Joshua Watt <jpewhacker@gmail.com> Reviewed-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
1 parent 8db4a1d commit 7a84394

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

fs/nfs/nfs4proc.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3636,6 +3636,7 @@ struct nfs4_closedata {
36363636
} lr;
36373637
struct nfs_fattr fattr;
36383638
unsigned long timestamp;
3639+
unsigned short retrans;
36393640
};
36403641

36413642
static void nfs4_free_closedata(void *data)
@@ -3664,6 +3665,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data)
36643665
.state = state,
36653666
.inode = calldata->inode,
36663667
.stateid = &calldata->arg.stateid,
3668+
.retrans = calldata->retrans,
36673669
};
36683670

36693671
if (!nfs4_sequence_done(task, &calldata->res.seq_res))
@@ -3711,6 +3713,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data)
37113713
default:
37123714
task->tk_status = nfs4_async_handle_exception(task,
37133715
server, task->tk_status, &exception);
3716+
calldata->retrans = exception.retrans;
37143717
if (exception.retry)
37153718
goto out_restart;
37163719
}
@@ -5593,9 +5596,11 @@ static int nfs4_read_done_cb(struct rpc_task *task, struct nfs_pgio_header *hdr)
55935596
.inode = hdr->inode,
55945597
.state = hdr->args.context->state,
55955598
.stateid = &hdr->args.stateid,
5599+
.retrans = hdr->retrans,
55965600
};
55975601
task->tk_status = nfs4_async_handle_exception(task,
55985602
server, task->tk_status, &exception);
5603+
hdr->retrans = exception.retrans;
55995604
if (exception.retry) {
56005605
rpc_restart_call_prepare(task);
56015606
return -EAGAIN;
@@ -5709,10 +5714,12 @@ static int nfs4_write_done_cb(struct rpc_task *task,
57095714
.inode = hdr->inode,
57105715
.state = hdr->args.context->state,
57115716
.stateid = &hdr->args.stateid,
5717+
.retrans = hdr->retrans,
57125718
};
57135719
task->tk_status = nfs4_async_handle_exception(task,
57145720
NFS_SERVER(inode), task->tk_status,
57155721
&exception);
5722+
hdr->retrans = exception.retrans;
57165723
if (exception.retry) {
57175724
rpc_restart_call_prepare(task);
57185725
return -EAGAIN;
@@ -6726,6 +6733,7 @@ struct nfs4_delegreturndata {
67266733
struct nfs_fh fh;
67276734
nfs4_stateid stateid;
67286735
unsigned long timestamp;
6736+
unsigned short retrans;
67296737
struct {
67306738
struct nfs4_layoutreturn_args arg;
67316739
struct nfs4_layoutreturn_res res;
@@ -6746,6 +6754,7 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata)
67466754
.inode = data->inode,
67476755
.stateid = &data->stateid,
67486756
.task_is_privileged = data->args.seq_args.sa_privileged,
6757+
.retrans = data->retrans,
67496758
};
67506759

67516760
if (!nfs4_sequence_done(task, &data->res.seq_res))
@@ -6817,6 +6826,7 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata)
68176826
task->tk_status = nfs4_async_handle_exception(task,
68186827
data->res.server, task->tk_status,
68196828
&exception);
6829+
data->retrans = exception.retrans;
68206830
if (exception.retry)
68216831
goto out_restart;
68226832
}
@@ -7093,6 +7103,7 @@ struct nfs4_unlockdata {
70937103
struct file_lock fl;
70947104
struct nfs_server *server;
70957105
unsigned long timestamp;
7106+
unsigned short retrans;
70967107
};
70977108

70987109
static struct nfs4_unlockdata *nfs4_alloc_unlockdata(struct file_lock *fl,
@@ -7147,6 +7158,7 @@ static void nfs4_locku_done(struct rpc_task *task, void *data)
71477158
struct nfs4_exception exception = {
71487159
.inode = calldata->lsp->ls_state->inode,
71497160
.stateid = &calldata->arg.stateid,
7161+
.retrans = calldata->retrans,
71507162
};
71517163

71527164
if (!nfs4_sequence_done(task, &calldata->res.seq_res))
@@ -7180,6 +7192,7 @@ static void nfs4_locku_done(struct rpc_task *task, void *data)
71807192
task->tk_status = nfs4_async_handle_exception(task,
71817193
calldata->server, task->tk_status,
71827194
&exception);
7195+
calldata->retrans = exception.retrans;
71837196
if (exception.retry)
71847197
rpc_restart_call_prepare(task);
71857198
}

include/linux/nfs_xdr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,6 +1659,7 @@ struct nfs_pgio_header {
16591659
void *netfs;
16601660
#endif
16611661

1662+
unsigned short retrans;
16621663
int pnfs_error;
16631664
int error; /* merge with pnfs_error */
16641665
unsigned int good_bytes; /* boundary of good data */

0 commit comments

Comments
 (0)