Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50e1092b authored by James Lentini's avatar James Lentini Committed by Trond Myklebust
Browse files

SUNRPC xprtrdma: fix XDR tail buf marshalling for all ops



rpcrdma_convert_iovs is passed an xdr_buf representing either an RPC
request or an RPC reply. In the case of a request, several
calculations and tests involving pos are unnecessary. In the case of a
reply, several calculations and tests involving pos are incorrect (the
code tests pos against the reply xdr buf's len field, which is always
0 at the time rpcrdma_convert_iovs is executed). This change removes
the incorrect/unnecessary calculations and tests involving pos.

This fixes an observed problem when reading certain file sizes over
NFS/RDMA.

Signed-off-by: default avatarTom Tucker <tom@opengridcomputing.com>
Signed-off-by: default avatarTom Talpey <talpey@netapp.com>
Signed-off-by: default avatarJames Lentini <jlentini@netapp.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 5cef338b
Loading
Loading
Loading
Loading
+1 −8
Original line number Original line Diff line number Diff line
@@ -92,7 +92,6 @@ rpcrdma_convert_iovs(struct xdr_buf *xdrbuf, int pos,
		seg[n].mr_page = NULL;
		seg[n].mr_page = NULL;
		seg[n].mr_offset = xdrbuf->head[0].iov_base;
		seg[n].mr_offset = xdrbuf->head[0].iov_base;
		seg[n].mr_len = xdrbuf->head[0].iov_len;
		seg[n].mr_len = xdrbuf->head[0].iov_len;
		pos += xdrbuf->head[0].iov_len;
		++n;
		++n;
	}
	}


@@ -104,7 +103,6 @@ rpcrdma_convert_iovs(struct xdr_buf *xdrbuf, int pos,
		seg[n].mr_len = min_t(u32,
		seg[n].mr_len = min_t(u32,
			PAGE_SIZE - xdrbuf->page_base, xdrbuf->page_len);
			PAGE_SIZE - xdrbuf->page_base, xdrbuf->page_len);
		len = xdrbuf->page_len - seg[n].mr_len;
		len = xdrbuf->page_len - seg[n].mr_len;
		pos += len;
		++n;
		++n;
		p = 1;
		p = 1;
		while (len > 0) {
		while (len > 0) {
@@ -119,20 +117,15 @@ rpcrdma_convert_iovs(struct xdr_buf *xdrbuf, int pos,
		}
		}
	}
	}


	if (pos < xdrbuf->len && xdrbuf->tail[0].iov_len) {
	if (xdrbuf->tail[0].iov_len) {
		if (n == nsegs)
		if (n == nsegs)
			return 0;
			return 0;
		seg[n].mr_page = NULL;
		seg[n].mr_page = NULL;
		seg[n].mr_offset = xdrbuf->tail[0].iov_base;
		seg[n].mr_offset = xdrbuf->tail[0].iov_base;
		seg[n].mr_len = xdrbuf->tail[0].iov_len;
		seg[n].mr_len = xdrbuf->tail[0].iov_len;
		pos += xdrbuf->tail[0].iov_len;
		++n;
		++n;
	}
	}


	if (pos < xdrbuf->len)
		dprintk("RPC:       %s: marshaled only %d of %d\n",
				__func__, pos, xdrbuf->len);

	return n;
	return n;
}
}