mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
xprtrdma: Fix Read chunk padding
commit24abdf1be1upstream. When pad optimization is disabled, rpcrdma_convert_iovs still does not add explicit XDR round-up padding to a Read chunk. Commit677eb17e94("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:677eb17e94("xprtrdma: Fix XDR tail buffer marshalling") Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
788d81d4e5
commit
ec3bc2c5ed
@@ -226,8 +226,10 @@ rpcrdma_convert_iovs(struct xdr_buf *xdrbuf, unsigned int pos,
|
|||||||
if (len && n == RPCRDMA_MAX_SEGS)
|
if (len && n == RPCRDMA_MAX_SEGS)
|
||||||
goto out_overflow;
|
goto out_overflow;
|
||||||
|
|
||||||
/* When encoding the read list, the tail is always sent inline */
|
/* When encoding a Read chunk, the tail iovec contains an
|
||||||
if (type == rpcrdma_readch)
|
* XDR pad and may be omitted.
|
||||||
|
*/
|
||||||
|
if (type == rpcrdma_readch && xprt_rdma_pad_optimize)
|
||||||
return n;
|
return n;
|
||||||
|
|
||||||
/* When encoding the Write list, some servers need to see an extra
|
/* 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,
|
|||||||
return n;
|
return n;
|
||||||
|
|
||||||
if (xdrbuf->tail[0].iov_len) {
|
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);
|
n = rpcrdma_convert_kvec(&xdrbuf->tail[0], seg, n);
|
||||||
if (n == RPCRDMA_MAX_SEGS)
|
if (n == RPCRDMA_MAX_SEGS)
|
||||||
goto out_overflow;
|
goto out_overflow;
|
||||||
|
|||||||
Reference in New Issue
Block a user