summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2017-02-08 16:59:46 -0500
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2017-02-10 14:02:36 -0500
commit24abdf1be15c478e2821d6fc903a4a4440beff02 (patch)
treef608fee0fff90ac8bd8a63f0cb8d53782d4cf0b5 /net
parent26ae102f2cfd0215daa57dc790aa3bfe534403a9 (diff)
xprtrdma: Fix Read chunk padding
When pad optimization is disabled, rpcrdma_convert_iovs still does not add explicit XDR round-up padding to a Read chunk. Commit 677eb17e94ed ("xprtrdma: Fix XDR tail buffer marshalling") incorrectly short-circuited the test for whether round-up padding is needed that appears later in rpcrdma_convert_iovs. However, if this is indeed a regular 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") Cc: stable@vger.kernel.org # v4.9+ Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/xprtrdma/rpc_rdma.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
index c52e0f2ffe52..a524d3c2e8ac 100644
--- a/net/sunrpc/xprtrdma/rpc_rdma.c
+++ b/net/sunrpc/xprtrdma/rpc_rdma.c
@@ -226,8 +226,10 @@ rpcrdma_convert_iovs(struct xdr_buf *xdrbuf, unsigned int pos,
226 if (len && n == RPCRDMA_MAX_SEGS) 226 if (len && n == RPCRDMA_MAX_SEGS)
227 goto out_overflow; 227 goto out_overflow;
228 228
229 /* When encoding the read list, the tail is always sent inline */ 229 /* When encoding a Read chunk, the tail iovec contains an
230 if (type == rpcrdma_readch) 230 * XDR pad and may be omitted.
231 */
232 if (type == rpcrdma_readch && xprt_rdma_pad_optimize)
231 return n; 233 return n;
232 234
233 /* When encoding the Write list, some servers need to see an extra 235 /* When encoding the Write list, some servers need to see an extra
@@ -238,10 +240,6 @@ rpcrdma_convert_iovs(struct xdr_buf *xdrbuf, unsigned int pos,
238 return n; 240 return n;
239 241
240 if (xdrbuf->tail[0].iov_len) { 242 if (xdrbuf->tail[0].iov_len) {
241 /* the rpcrdma protocol allows us to omit any trailing
242 * xdr pad bytes, saving the server an RDMA operation. */
243 if (xdrbuf->tail[0].iov_len < 4 && xprt_rdma_pad_optimize)
244 return n;
245 n = rpcrdma_convert_kvec(&xdrbuf->tail[0], seg, n); 243 n = rpcrdma_convert_kvec(&xdrbuf->tail[0], seg, n);
246 if (n == RPCRDMA_MAX_SEGS) 244 if (n == RPCRDMA_MAX_SEGS)
247 goto out_overflow; 245 goto out_overflow;