summaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2019-07-17 21:22:38 -0400
committerTrond Myklebust <trond.myklebust@hammerspace.com>2019-07-18 14:43:52 -0400
commit75369089820473eac45e9ddd970081901a373c08 (patch)
tree348fdb310218b444e10e0d88ebfef28c2e9242a0 /net/sunrpc
parent8e04fdfadda75a849c649f7e50fe7d97772e1fcb (diff)
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: 277e4ab7d530 ("SUNRPC: Simplify TCP receive code by switching...") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Cc: stable@vger.kernel.org # v4.20+
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/clnt.c3
-rw-r--r--net/sunrpc/xprt.c2
-rw-r--r--net/sunrpc/xprtsock.c1
3 files changed, 4 insertions, 2 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 79c849391cb9..d8679b6027e9 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1865,6 +1865,7 @@ rpc_xdr_encode(struct rpc_task *task)
1865 req->rq_snd_buf.head[0].iov_len = 0; 1865 req->rq_snd_buf.head[0].iov_len = 0;
1866 xdr_init_encode(&xdr, &req->rq_snd_buf, 1866 xdr_init_encode(&xdr, &req->rq_snd_buf,
1867 req->rq_snd_buf.head[0].iov_base, req); 1867 req->rq_snd_buf.head[0].iov_base, req);
1868 xdr_free_bvec(&req->rq_snd_buf);
1868 if (rpc_encode_header(task, &xdr)) 1869 if (rpc_encode_header(task, &xdr))
1869 return; 1870 return;
1870 1871
@@ -1904,8 +1905,6 @@ call_encode(struct rpc_task *task)
1904 rpc_call_rpcerror(task, task->tk_status); 1905 rpc_call_rpcerror(task, task->tk_status);
1905 } 1906 }
1906 return; 1907 return;
1907 } else {
1908 xprt_request_prepare(task->tk_rqstp);
1909 } 1908 }
1910 1909
1911 /* Add task to reply queue before transmission to avoid races */ 1910 /* Add task to reply queue before transmission to avoid races */
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 70a704c44c6d..783748dc5e6f 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -1041,6 +1041,8 @@ xprt_request_enqueue_receive(struct rpc_task *task)
1041 1041
1042 if (!xprt_request_need_enqueue_receive(task, req)) 1042 if (!xprt_request_need_enqueue_receive(task, req))
1043 return; 1043 return;
1044
1045 xprt_request_prepare(task->tk_rqstp);
1044 spin_lock(&xprt->queue_lock); 1046 spin_lock(&xprt->queue_lock);
1045 1047
1046 /* Update the softirq receive buffer */ 1048 /* Update the softirq receive buffer */
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 6b1fca51028a..e2176c167a57 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -909,6 +909,7 @@ static int xs_nospace(struct rpc_rqst *req)
909static void 909static void
910xs_stream_prepare_request(struct rpc_rqst *req) 910xs_stream_prepare_request(struct rpc_rqst *req)
911{ 911{
912 xdr_free_bvec(&req->rq_rcv_buf);
912 req->rq_task->tk_status = xdr_alloc_bvec(&req->rq_rcv_buf, GFP_KERNEL); 913 req->rq_task->tk_status = xdr_alloc_bvec(&req->rq_rcv_buf, GFP_KERNEL);
913} 914}
914 915