Skip to content

Commit 50e1092

Browse files
James LentiniTrond Myklebust
authored andcommitted
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: Tom Tucker <tom@opengridcomputing.com> Signed-off-by: Tom Talpey <talpey@netapp.com> Signed-off-by: James Lentini <jlentini@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
1 parent 5cef338 commit 50e1092

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

‎net/sunrpc/xprtrdma/rpc_rdma.c‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ rpcrdma_convert_iovs(struct xdr_buf *xdrbuf, int pos,
9292
seg[n].mr_page = NULL;
9393
seg[n].mr_offset = xdrbuf->head[0].iov_base;
9494
seg[n].mr_len = xdrbuf->head[0].iov_len;
95-
pos += xdrbuf->head[0].iov_len;
9695
++n;
9796
}
9897

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

122-
if (pos < xdrbuf->len && xdrbuf->tail[0].iov_len) {
120+
if (xdrbuf->tail[0].iov_len) {
123121
if (n == nsegs)
124122
return 0;
125123
seg[n].mr_page = NULL;
126124
seg[n].mr_offset = xdrbuf->tail[0].iov_base;
127125
seg[n].mr_len = xdrbuf->tail[0].iov_len;
128-
pos += xdrbuf->tail[0].iov_len;
129126
++n;
130127
}
131128

132-
if (pos < xdrbuf->len)
133-
dprintk("RPC: %s: marshaled only %d of %d\n",
134-
__func__, pos, xdrbuf->len);
135-
136129
return n;
137130
}
138131

0 commit comments

Comments
 (0)