Merge tag 'nfsd-4.19-1' of git://linux-nfs.org/~bfields/linux
[sfrench/cifs-2.6.git] / net / sunrpc / xprtrdma / svc_rdma_recvfrom.c
index 841fca143804fd4ef86cfe05454935e8efda4cfc..b24d5b8f2feeda5a2d5d66d755694475a6003cf7 100644 (file)
@@ -229,11 +229,10 @@ void svc_rdma_recv_ctxt_put(struct svcxprt_rdma *rdma,
 static int __svc_rdma_post_recv(struct svcxprt_rdma *rdma,
                                struct svc_rdma_recv_ctxt *ctxt)
 {
-       struct ib_recv_wr *bad_recv_wr;
        int ret;
 
        svc_xprt_get(&rdma->sc_xprt);
-       ret = ib_post_recv(rdma->sc_qp, &ctxt->rc_recv_wr, &bad_recv_wr);
+       ret = ib_post_recv(rdma->sc_qp, &ctxt->rc_recv_wr, NULL);
        trace_svcrdma_post_recv(&ctxt->rc_recv_wr, ret);
        if (ret)
                goto err_post;
@@ -366,9 +365,6 @@ static void svc_rdma_build_arg_xdr(struct svc_rqst *rqstp,
        arg->page_base = 0;
        arg->buflen = ctxt->rc_byte_len;
        arg->len = ctxt->rc_byte_len;
-
-       rqstp->rq_respages = &rqstp->rq_pages[0];
-       rqstp->rq_next_page = rqstp->rq_respages + 1;
 }
 
 /* This accommodates the largest possible Write chunk,
@@ -730,6 +726,12 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
 
        svc_rdma_build_arg_xdr(rqstp, ctxt);
 
+       /* Prevent svc_xprt_release from releasing pages in rq_pages
+        * if we return 0 or an error.
+        */
+       rqstp->rq_respages = rqstp->rq_pages;
+       rqstp->rq_next_page = rqstp->rq_respages;
+
        p = (__be32 *)rqstp->rq_arg.head[0].iov_base;
        ret = svc_rdma_xdr_decode_req(&rqstp->rq_arg);
        if (ret < 0)