From: "J. Bruce Fields" <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-rdma@vger.kernel.org, linux-nfs@vger.kernel.org
Subject: Re: [PATCH v1 09/19] svcrdma: Preserve Receive buffer until svc_rdma_sendto
Date: Wed, 9 May 2018 17:03:09 -0400 [thread overview]
Message-ID: <20180509210309.GC31959@fieldses.org> (raw)
In-Reply-To: <20180507192737.4608.29315.stgit@klimt.1015granger.net>
On Mon, May 07, 2018 at 03:27:37PM -0400, Chuck Lever wrote:
> Rather than releasing the incoming svc_rdma_recv_ctxt at the end of
> svc_rdma_recvfrom, hold onto it until svc_rdma_sendto.
>
> This permits the contents of the Receive buffer to be preserved
> through svc_process and then referenced directly in sendto as it
> constructs Write and Reply chunks to return to the client.
>
> The real changes will come in subsequent patches.
>
> Note: I cannot use ->xpo_release_rqst for this purpose because that
> is called _before_ ->xpo_sendto. svc_rdma_sendto uses information in
> the received Call transport header to construct the Reply transport
> header, which is preserved in the RPC's Receive buffer.
>
> The historical comment in svc_send() isn't helpful: it is already
> obvious that ->xpo_release_rqst is being called before ->xpo_sendto,
> but there is no explanation for this ordering going back to the
> beginning of the git era.
Yeah. I'm fine with deleting that comment at least. (Or maybe moving
the call if it makes sense, I haven't thought about it.)
--b.
>
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
> net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 2 +-
> net/sunrpc/xprtrdma/svc_rdma_sendto.c | 14 +++++++++++---
> 2 files changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
> index ecfe7c9..d9fef52 100644
> --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
> +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
> @@ -789,7 +789,7 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
> goto out_readchunk;
>
> complete:
> - svc_rdma_recv_ctxt_put(rdma_xprt, ctxt);
> + rqstp->rq_xprt_ctxt = ctxt;
> rqstp->rq_prot = IPPROTO_MAX;
> svc_xprt_copy_addrs(rqstp, xprt);
> return rqstp->rq_arg.len;
> diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
> index a397d9a..cbbde70 100644
> --- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
> +++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
> @@ -623,6 +623,7 @@ int svc_rdma_sendto(struct svc_rqst *rqstp)
> struct svc_xprt *xprt = rqstp->rq_xprt;
> struct svcxprt_rdma *rdma =
> container_of(xprt, struct svcxprt_rdma, sc_xprt);
> + struct svc_rdma_recv_ctxt *rctxt = rqstp->rq_xprt_ctxt;
> __be32 *p, *rdma_argp, *rdma_resp, *wr_lst, *rp_ch;
> struct xdr_buf *xdr = &rqstp->rq_res;
> struct page *res_page;
> @@ -675,7 +676,12 @@ int svc_rdma_sendto(struct svc_rqst *rqstp)
> wr_lst, rp_ch);
> if (ret < 0)
> goto err0;
> - return 0;
> + ret = 0;
> +
> +out:
> + rqstp->rq_xprt_ctxt = NULL;
> + svc_rdma_recv_ctxt_put(rdma, rctxt);
> + return ret;
>
> err2:
> if (ret != -E2BIG && ret != -EINVAL)
> @@ -684,12 +690,14 @@ int svc_rdma_sendto(struct svc_rqst *rqstp)
> ret = svc_rdma_send_error_msg(rdma, rdma_resp, rqstp);
> if (ret < 0)
> goto err0;
> - return 0;
> + ret = 0;
> + goto out;
>
> err1:
> put_page(res_page);
> err0:
> trace_svcrdma_send_failed(rqstp, ret);
> set_bit(XPT_CLOSE, &xprt->xpt_flags);
> - return -ENOTCONN;
> + ret = -ENOTCONN;
> + goto out;
> }
next prev parent reply other threads:[~2018-05-09 21:03 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-07 19:26 [PATCH v1 00/19] NFS/RDMA server for-next Chuck Lever
2018-05-07 19:26 ` [PATCH v1 01/19] svcrdma: Add proper SPDX tags for NetApp-contributed source Chuck Lever
2018-05-09 20:23 ` J. Bruce Fields
2018-05-09 20:42 ` Chuck Lever
2018-05-15 14:52 ` Doug Ledford
2018-05-07 19:27 ` [PATCH v1 02/19] svcrdma: Use passed-in net namespace when creating RDMA listener Chuck Lever
2018-05-07 19:27 ` [PATCH v1 03/19] xprtrdma: Prepare RPC/RDMA includes for server-side trace points Chuck Lever
2018-05-07 19:27 ` [PATCH v1 04/19] svcrdma: Trace key RPC/RDMA protocol events Chuck Lever
2018-05-07 19:27 ` [PATCH v1 05/19] svcrdma: Trace key RDMA API events Chuck Lever
2018-05-07 19:27 ` [PATCH v1 06/19] svcrdma: Introduce svc_rdma_recv_ctxt Chuck Lever
2018-05-09 20:48 ` J. Bruce Fields
2018-05-09 21:02 ` Chuck Lever
2018-05-07 19:27 ` [PATCH v1 07/19] svcrdma: Remove sc_rq_depth Chuck Lever
2018-05-07 19:27 ` [PATCH v1 08/19] svcrdma: Simplify svc_rdma_recv_ctxt_put Chuck Lever
2018-05-07 19:27 ` [PATCH v1 09/19] svcrdma: Preserve Receive buffer until svc_rdma_sendto Chuck Lever
2018-05-09 21:03 ` J. Bruce Fields [this message]
2018-05-07 19:27 ` [PATCH v1 10/19] svcrdma: Persistently allocate and DMA-map Receive buffers Chuck Lever
2018-05-09 21:18 ` J. Bruce Fields
2018-05-09 21:31 ` Chuck Lever
2018-05-09 21:37 ` Bruce Fields
2018-05-07 19:27 ` [PATCH v1 11/19] svcrdma: Allocate recv_ctxt's on CPU handling Receives Chuck Lever
2018-05-07 19:27 ` [PATCH v1 12/19] svcrdma: Refactor svc_rdma_dma_map_buf Chuck Lever
2018-05-07 19:27 ` [PATCH v1 13/19] svcrdma: Clean up Send SGE accounting Chuck Lever
2018-05-07 19:28 ` [PATCH v1 14/19] svcrdma: Introduce svc_rdma_send_ctxt Chuck Lever
2018-05-07 19:28 ` [PATCH v1 15/19] svcrdma: Don't overrun the SGE array in svc_rdma_send_ctxt Chuck Lever
2018-05-07 19:28 ` [PATCH v1 16/19] svcrdma: Remove post_send_wr Chuck Lever
2018-05-07 19:28 ` [PATCH v1 17/19] svcrdma: Simplify svc_rdma_send() Chuck Lever
2018-05-07 19:28 ` [PATCH v1 18/19] svcrdma: Persistently allocate and DMA-map Send buffers Chuck Lever
2018-05-07 19:28 ` [PATCH v1 19/19] svcrdma: Remove unused svc_rdma_op_ctxt Chuck Lever
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180509210309.GC31959@fieldses.org \
--to=bfields@fieldses.org \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.