summaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtrdma/physical_ops.c
diff options
context:
space:
mode:
authorChuck Lever2016-05-02 20:41:05 +0200
committerAnna Schumaker2016-05-17 21:47:58 +0200
commit302d3deb20682a076e1ab551821cacfdc81c5e4f (patch)
treef379f2c56120ba7d6f970306d4520c4cc5517726 /net/sunrpc/xprtrdma/physical_ops.c
parentxprtrdma: Limit number of RDMA segments in RPC-over-RDMA headers (diff)
downloadkernel-qcow2-linux-302d3deb20682a076e1ab551821cacfdc81c5e4f.tar.gz
kernel-qcow2-linux-302d3deb20682a076e1ab551821cacfdc81c5e4f.tar.xz
kernel-qcow2-linux-302d3deb20682a076e1ab551821cacfdc81c5e4f.zip
xprtrdma: Prevent inline overflow
When deciding whether to send a Call inline, rpcrdma_marshal_req doesn't take into account header bytes consumed by chunk lists. This results in Call messages on the wire that are sometimes larger than the inline threshold. Likewise, when a Write list or Reply chunk is in play, the server's reply has to emit an RDMA Send that includes a larger-than-minimal RPC-over-RDMA header. The actual size of a Call message cannot be estimated until after the chunk lists have been registered. Thus the size of each RPC-over-RDMA header can be estimated only after chunks are registered; but the decision to register chunks is based on the size of that header. Chicken, meet egg. The best a client can do is estimate header size based on the largest header that might occur, and then ensure that inline content is always smaller than that. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Tested-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'net/sunrpc/xprtrdma/physical_ops.c')
-rw-r--r--net/sunrpc/xprtrdma/physical_ops.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/sunrpc/xprtrdma/physical_ops.c b/net/sunrpc/xprtrdma/physical_ops.c
index e16ed54d24ed..2dc6ec2b006a 100644
--- a/net/sunrpc/xprtrdma/physical_ops.c
+++ b/net/sunrpc/xprtrdma/physical_ops.c
@@ -36,8 +36,11 @@ physical_op_open(struct rpcrdma_ia *ia, struct rpcrdma_ep *ep,
__func__, PTR_ERR(mr));
return -ENOMEM;
}
-
ia->ri_dma_mr = mr;
+
+ rpcrdma_set_max_header_sizes(ia, cdata, min_t(unsigned int,
+ RPCRDMA_MAX_DATA_SEGS,
+ RPCRDMA_MAX_HDR_SEGS));
return 0;
}