Skip to content

Commit 7536908

Browse files
author
Trond Myklebust
committed
SUNRPC: Ensure the bvecs are reset when we re-encode the RPC request
The bvec tracks the list of pages, so if the number of pages changes due to a re-encode, we need to reset the bvec as well. Fixes: 277e4ab ("SUNRPC: Simplify TCP receive code by switching...") Signed-off-by: Trond Myklebust <[email protected]> Cc: [email protected] # v4.20+
1 parent 8e04fdf commit 7536908

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

net/sunrpc/clnt.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,6 +1865,7 @@ rpc_xdr_encode(struct rpc_task *task)
18651865
req->rq_snd_buf.head[0].iov_len = 0;
18661866
xdr_init_encode(&xdr, &req->rq_snd_buf,
18671867
req->rq_snd_buf.head[0].iov_base, req);
1868+
xdr_free_bvec(&req->rq_snd_buf);
18681869
if (rpc_encode_header(task, &xdr))
18691870
return;
18701871

@@ -1904,8 +1905,6 @@ call_encode(struct rpc_task *task)
19041905
rpc_call_rpcerror(task, task->tk_status);
19051906
}
19061907
return;
1907-
} else {
1908-
xprt_request_prepare(task->tk_rqstp);
19091908
}
19101909

19111910
/* Add task to reply queue before transmission to avoid races */

net/sunrpc/xprt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,8 @@ xprt_request_enqueue_receive(struct rpc_task *task)
10411041

10421042
if (!xprt_request_need_enqueue_receive(task, req))
10431043
return;
1044+
1045+
xprt_request_prepare(task->tk_rqstp);
10441046
spin_lock(&xprt->queue_lock);
10451047

10461048
/* Update the softirq receive buffer */

net/sunrpc/xprtsock.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,7 @@ static int xs_nospace(struct rpc_rqst *req)
909909
static void
910910
xs_stream_prepare_request(struct rpc_rqst *req)
911911
{
912+
xdr_free_bvec(&req->rq_rcv_buf);
912913
req->rq_task->tk_status = xdr_alloc_bvec(&req->rq_rcv_buf, GFP_KERNEL);
913914
}
914915

0 commit comments

Comments
 (0)