Skip to content

Commit

Permalink
xprtrdma: Fix use of xdr_stream_encode_item_{present, absent}
Browse files Browse the repository at this point in the history
These new helpers do not return 0 on success, they return the
encoded size. Thus they are not a drop-in replacement for the
old helpers.

Fixes: 5c266df ("SUNRPC: Add encoders for list item discriminators")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
  • Loading branch information
Chuck Lever authored and Anna Schumaker committed Apr 20, 2020
1 parent bdb2ce8 commit 48a124e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions net/sunrpc/xprtrdma/rpc_rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,9 @@ static int rpcrdma_encode_read_list(struct rpcrdma_xprt *r_xprt,
} while (nsegs);

done:
return xdr_stream_encode_item_absent(xdr);
if (xdr_stream_encode_item_absent(xdr) < 0)
return -EMSGSIZE;
return 0;
}

/* Register and XDR encode the Write list. Supports encoding a list
Expand Down Expand Up @@ -454,7 +456,9 @@ static int rpcrdma_encode_write_list(struct rpcrdma_xprt *r_xprt,
*segcount = cpu_to_be32(nchunks);

done:
return xdr_stream_encode_item_absent(xdr);
if (xdr_stream_encode_item_absent(xdr) < 0)
return -EMSGSIZE;
return 0;
}

/* Register and XDR encode the Reply chunk. Supports encoding an array
Expand All @@ -480,8 +484,11 @@ static int rpcrdma_encode_reply_chunk(struct rpcrdma_xprt *r_xprt,
int nsegs, nchunks;
__be32 *segcount;

if (wtype != rpcrdma_replych)
return xdr_stream_encode_item_absent(xdr);
if (wtype != rpcrdma_replych) {
if (xdr_stream_encode_item_absent(xdr) < 0)
return -EMSGSIZE;
return 0;
}

seg = req->rl_segments;
nsegs = rpcrdma_convert_iovs(r_xprt, &rqst->rq_rcv_buf, 0, wtype, seg);
Expand Down

0 comments on commit 48a124e

Please sign in to comment.