From: Chuck Lever <chuck.lever-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Subject: [PATCH v1 1/5] xprtrdma: Fix Read chunk padding Date: Fri, 13 Jan 2017 12:42:57 -0500 [thread overview] Message-ID: <20170113174257.32692.37552.stgit@manet.1015granger.net> (raw) In-Reply-To: <20170113173023.32692.30661.stgit-FYjufvaPoItvLzlybtyyYzGyq/o6K9yX@public.gmane.org> When pad optimization is disabled, rpcrdma_convert_iovs still does not add explicit XDR padding to a Read chunk. Commit 677eb17e94ed ("xprtrdma: Fix XDR tail buffer marshalling") incorrectly short-circuited the test for whether padding is needed, which appears later in rpcrdma_convert_iovs. However, if this is indeed a Read chunk (and not a Position-Zero Read chunk), the tail iovec _always_ contains the chunk's padding, and never anything else. So, it's easy to just skip the tail when padding optimization is enabled, and add the tail in a subsequent Read chunk segment, if disabled. Fixes: 677eb17e94ed ("xprtrdma: Fix XDR tail buffer marshalling") Signed-off-by: Chuck Lever <chuck.lever-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> --- net/sunrpc/xprtrdma/rpc_rdma.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index c52e0f2..a524d3c 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c @@ -226,8 +226,10 @@ static bool rpcrdma_results_inline(struct rpcrdma_xprt *r_xprt, if (len && n == RPCRDMA_MAX_SEGS) goto out_overflow; - /* When encoding the read list, the tail is always sent inline */ - if (type == rpcrdma_readch) + /* When encoding a Read chunk, the tail iovec contains an + * XDR pad and may be omitted. + */ + if (type == rpcrdma_readch && xprt_rdma_pad_optimize) return n; /* When encoding the Write list, some servers need to see an extra @@ -238,10 +240,6 @@ static bool rpcrdma_results_inline(struct rpcrdma_xprt *r_xprt, return n; if (xdrbuf->tail[0].iov_len) { - /* the rpcrdma protocol allows us to omit any trailing - * xdr pad bytes, saving the server an RDMA operation. */ - if (xdrbuf->tail[0].iov_len < 4 && xprt_rdma_pad_optimize) - return n; n = rpcrdma_convert_kvec(&xdrbuf->tail[0], seg, n); if (n == RPCRDMA_MAX_SEGS) goto out_overflow; -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Chuck Lever <chuck.lever@oracle.com> To: linux-rdma@vger.kernel.org, linux-nfs@vger.kernel.org Subject: [PATCH v1 1/5] xprtrdma: Fix Read chunk padding Date: Fri, 13 Jan 2017 12:42:57 -0500 [thread overview] Message-ID: <20170113174257.32692.37552.stgit@manet.1015granger.net> (raw) In-Reply-To: <20170113173023.32692.30661.stgit@manet.1015granger.net> When pad optimization is disabled, rpcrdma_convert_iovs still does not add explicit XDR padding to a Read chunk. Commit 677eb17e94ed ("xprtrdma: Fix XDR tail buffer marshalling") incorrectly short-circuited the test for whether padding is needed, which appears later in rpcrdma_convert_iovs. However, if this is indeed a Read chunk (and not a Position-Zero Read chunk), the tail iovec _always_ contains the chunk's padding, and never anything else. So, it's easy to just skip the tail when padding optimization is enabled, and add the tail in a subsequent Read chunk segment, if disabled. Fixes: 677eb17e94ed ("xprtrdma: Fix XDR tail buffer marshalling") Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- net/sunrpc/xprtrdma/rpc_rdma.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index c52e0f2..a524d3c 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c @@ -226,8 +226,10 @@ static bool rpcrdma_results_inline(struct rpcrdma_xprt *r_xprt, if (len && n == RPCRDMA_MAX_SEGS) goto out_overflow; - /* When encoding the read list, the tail is always sent inline */ - if (type == rpcrdma_readch) + /* When encoding a Read chunk, the tail iovec contains an + * XDR pad and may be omitted. + */ + if (type == rpcrdma_readch && xprt_rdma_pad_optimize) return n; /* When encoding the Write list, some servers need to see an extra @@ -238,10 +240,6 @@ static bool rpcrdma_results_inline(struct rpcrdma_xprt *r_xprt, return n; if (xdrbuf->tail[0].iov_len) { - /* the rpcrdma protocol allows us to omit any trailing - * xdr pad bytes, saving the server an RDMA operation. */ - if (xdrbuf->tail[0].iov_len < 4 && xprt_rdma_pad_optimize) - return n; n = rpcrdma_convert_kvec(&xdrbuf->tail[0], seg, n); if (n == RPCRDMA_MAX_SEGS) goto out_overflow;
next prev parent reply other threads:[~2017-01-13 17:42 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-01-13 17:42 [PATCH v1 0/5] Fix "support large inline thresholds" Chuck Lever 2017-01-13 17:42 ` Chuck Lever [not found] ` <20170113173023.32692.30661.stgit-FYjufvaPoItvLzlybtyyYzGyq/o6K9yX@public.gmane.org> 2017-01-13 17:42 ` Chuck Lever [this message] 2017-01-13 17:42 ` [PATCH v1 1/5] xprtrdma: Fix Read chunk padding Chuck Lever 2017-01-13 17:43 ` [PATCH v1 2/5] xprtrdma: Per-connection pad optimization Chuck Lever 2017-01-13 17:43 ` Chuck Lever 2017-01-13 17:43 ` [PATCH v1 3/5] xprtrdma: Disable pad optimization by default Chuck Lever 2017-01-13 17:43 ` Chuck Lever 2017-01-13 17:43 ` [PATCH v1 4/5] xprtrdma: Reduce required number of send SGEs Chuck Lever 2017-01-13 17:43 ` Chuck Lever [not found] ` <20170113174322.32692.66126.stgit-FYjufvaPoItvLzlybtyyYzGyq/o6K9yX@public.gmane.org> 2017-01-13 18:01 ` Parav Pandit 2017-01-13 18:01 ` Parav Pandit [not found] ` <VI1PR0502MB30080923A8B244BBAD059358D1780-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org> 2017-01-13 18:30 ` Chuck Lever 2017-01-13 18:30 ` Chuck Lever [not found] ` <706404D7-A179-4E54-A2C7-534FCC1B5745-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 2017-01-13 19:14 ` Parav Pandit 2017-01-13 19:14 ` Parav Pandit 2017-01-13 17:43 ` [PATCH v1 5/5] xprtrdma: Shrink send SGEs array Chuck Lever 2017-01-13 17:43 ` Chuck Lever 2017-01-20 17:30 ` [PATCH v1 0/5] Fix "support large inline thresholds" Steve Wise 2017-01-20 17:30 ` Steve Wise 2017-01-20 18:17 ` Chuck Lever 2017-01-20 18:17 ` 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=20170113174257.32692.37552.stgit@manet.1015granger.net \ --to=chuck.lever-qhclzuegtsvqt0dzr+alfa@public.gmane.org \ --cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.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: linkBe 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.