From: "J. Bruce Fields" <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH v2 01/10] svcrdma: Fix byte-swapping in svc_rdma_sendto.c
Date: Mon, 1 Jun 2015 14:40:47 -0400 [thread overview]
Message-ID: <20150601184047.GE26489@fieldses.org> (raw)
In-Reply-To: <20150526174837.7061.88468.stgit@klimt.1015granger.net>
On Tue, May 26, 2015 at 01:48:37PM -0400, Chuck Lever wrote:
> In send_write_chunks(), we have:
>
> for (xdr_off = rqstp->rq_res.head[0].iov_len, chunk_no = 0;
> xfer_len && chunk_no < arg_ary->wc_nchunks;
> chunk_no++) {
> . . .
> }
>
> Note that arg_ary->wc_nchunk is in network byte-order. For the
> comparison to work correctly, both have to be in native byte-order.
>
> In send_reply_chunks, we have:
>
> write_len = min(xfer_len, htonl(ch->rs_length));
>
> xfer_len is in native byte-order, and ch->rs_length is in
> network byte-order. be32_to_cpu() is the correct byte swap
> for ch->rs_length.
>
> As an additional clean up, replace ntohl() with be32_to_cpu() in
> a few other places.
Why? (Not arguing, really, just wondering.)
--b.
>
> This appears to address a problem with large rsize hangs while
> using PHYSICAL memory registration. I suspect that is the only
> registration mode that uses more than one chunk element.
>
> BugLink: https://bugzilla.linux-nfs.org/show_bug.cgi?id=248
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>
> net/sunrpc/xprtrdma/svc_rdma_sendto.c | 14 ++++++++------
> 1 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
> index 7de33d1..109e967 100644
> --- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
> +++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
> @@ -240,6 +240,7 @@ static int send_write_chunks(struct svcxprt_rdma *xprt,
> u32 xdr_off;
> int chunk_off;
> int chunk_no;
> + int nchunks;
> struct rpcrdma_write_array *arg_ary;
> struct rpcrdma_write_array *res_ary;
> int ret;
> @@ -251,14 +252,15 @@ static int send_write_chunks(struct svcxprt_rdma *xprt,
> &rdma_resp->rm_body.rm_chunks[1];
>
> /* Write chunks start at the pagelist */
> + nchunks = be32_to_cpu(arg_ary->wc_nchunks);
> for (xdr_off = rqstp->rq_res.head[0].iov_len, chunk_no = 0;
> - xfer_len && chunk_no < arg_ary->wc_nchunks;
> + xfer_len && chunk_no < nchunks;
> chunk_no++) {
> struct rpcrdma_segment *arg_ch;
> u64 rs_offset;
>
> arg_ch = &arg_ary->wc_array[chunk_no].wc_target;
> - write_len = min(xfer_len, ntohl(arg_ch->rs_length));
> + write_len = min(xfer_len, be32_to_cpu(arg_ch->rs_length));
>
> /* Prepare the response chunk given the length actually
> * written */
> @@ -270,7 +272,7 @@ static int send_write_chunks(struct svcxprt_rdma *xprt,
> chunk_off = 0;
> while (write_len) {
> ret = send_write(xprt, rqstp,
> - ntohl(arg_ch->rs_handle),
> + be32_to_cpu(arg_ch->rs_handle),
> rs_offset + chunk_off,
> xdr_off,
> write_len,
> @@ -318,13 +320,13 @@ static int send_reply_chunks(struct svcxprt_rdma *xprt,
> &rdma_resp->rm_body.rm_chunks[2];
>
> /* xdr offset starts at RPC message */
> - nchunks = ntohl(arg_ary->wc_nchunks);
> + nchunks = be32_to_cpu(arg_ary->wc_nchunks);
> for (xdr_off = 0, chunk_no = 0;
> xfer_len && chunk_no < nchunks;
> chunk_no++) {
> u64 rs_offset;
> ch = &arg_ary->wc_array[chunk_no].wc_target;
> - write_len = min(xfer_len, htonl(ch->rs_length));
> + write_len = min(xfer_len, be32_to_cpu(ch->rs_length));
>
> /* Prepare the reply chunk given the length actually
> * written */
> @@ -335,7 +337,7 @@ static int send_reply_chunks(struct svcxprt_rdma *xprt,
> chunk_off = 0;
> while (write_len) {
> ret = send_write(xprt, rqstp,
> - ntohl(ch->rs_handle),
> + be32_to_cpu(ch->rs_handle),
> rs_offset + chunk_off,
> xdr_off,
> write_len,
next prev parent reply other threads:[~2015-06-01 18:40 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-26 17:48 [PATCH v2 00/10] NFS/RDMA server patches for 4.2 Chuck Lever
2015-05-26 17:48 ` [PATCH v2 01/10] svcrdma: Fix byte-swapping in svc_rdma_sendto.c Chuck Lever
2015-06-01 18:40 ` J. Bruce Fields [this message]
2015-06-01 18:47 ` Chuck Lever
2015-05-26 17:48 ` [PATCH v2 02/10] svcrdma: Add missing access_ok() call in svc_rdma.c Chuck Lever
2015-06-01 19:31 ` J. Bruce Fields
2015-06-01 20:01 ` Chuck Lever
2015-06-02 15:28 ` J. Bruce Fields
2015-05-26 17:48 ` [PATCH v2 03/10] SUNRPC: Move EXPORT_SYMBOL for svc_process Chuck Lever
2015-05-26 17:49 ` [PATCH v2 04/10] svcrdma: Remove svc_rdma_xdr_decode_deferred_req() Chuck Lever
2015-05-26 17:49 ` [PATCH v2 05/10] svcrdma: Keep rpcrdma_msg fields in network byte-order Chuck Lever
2015-05-26 17:49 ` [PATCH v2 06/10] svcrdma: Replace GFP_KERNEL in a loop with GFP_NOFAIL Chuck Lever
2015-05-26 17:49 ` [PATCH v2 07/10] svcrdma: Add a separate "max data segs macro for svcrdma Chuck Lever
2015-05-26 17:49 ` [PATCH v2 08/10] svcrdma: Add backward direction service for RPC/RDMA transport Chuck Lever
2015-06-01 20:26 ` J. Bruce Fields
2015-06-01 20:45 ` Chuck Lever
2015-06-02 15:30 ` J. Bruce Fields
2015-06-03 19:49 ` Chuck Lever
2015-06-03 19:47 ` J. Bruce Fields
2015-05-26 17:49 ` [PATCH v2 09/10] SUNRPC: Clean up bc_send() Chuck Lever
2015-06-01 20:19 ` Chuck Lever
2015-06-01 20:24 ` J. Bruce Fields
2015-05-26 17:50 ` [PATCH v2 10/10] rpcrdma: Merge svcrdma and xprtrdma modules into one Chuck Lever
2015-06-01 20:24 ` J. Bruce Fields
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=20150601184047.GE26489@fieldses.org \
--to=bfields@fieldses.org \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@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.