From 9594cacc07c4fd3200ca94f5c3a2b451d83a1d95 Mon Sep 17 00:00:00 2001 From: Steve Wise Date: Wed, 1 Oct 2014 18:50:07 -0500 Subject: [PATCH] svcrdma: advertise the correct max payload Pull in this: commit 7e5be28827bf5c1989218c4b7bf64fdbc3d679b5 Author: Steve Wise Date: Tue Sep 23 17:11:22 2014 -0500 svcrdma: advertise the correct max payload Signed-off-by: Steve Wise --- ...a--advertise-the-correct-max-payload.patch | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 linux-next-cherry-picks/0168-svcrdma--advertise-the-correct-max-payload.patch diff --git a/linux-next-cherry-picks/0168-svcrdma--advertise-the-correct-max-payload.patch b/linux-next-cherry-picks/0168-svcrdma--advertise-the-correct-max-payload.patch new file mode 100644 index 0000000..2e3b516 --- /dev/null +++ b/linux-next-cherry-picks/0168-svcrdma--advertise-the-correct-max-payload.patch @@ -0,0 +1,53 @@ +commit 7e5be28827bf5c1989218c4b7bf64fdbc3d679b5 +Author: Steve Wise +Date: Tue Sep 23 17:11:22 2014 -0500 + + svcrdma: advertise the correct max payload + + Svcrdma currently advertises 1MB, which is too large. The correct value + is the minimum of RPCSVC_MAXPAYLOAD and the max scatter-gather allowed + in an NFSRDMA IO chunk * the host page size. This bug is usually benign + because the Linux X64 NFSRDMA client correctly limits the payload size to + the correct value (64*4096 = 256KB). But if the Linux client is PPC64 + with a 64KB page size, then the client will indeed use a payload size + that will overflow the server. + + Signed-off-by: Steve Wise + Signed-off-by: J. Bruce Fields + +diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c +index 374feb4..4e61880 100644 +--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c ++++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c +@@ -91,7 +91,7 @@ struct svc_xprt_class svc_rdma_class = { + .xcl_name = "rdma", + .xcl_owner = THIS_MODULE, + .xcl_ops = &svc_rdma_ops, +- .xcl_max_payload = RPCSVC_MAXPAYLOAD_TCP, ++ .xcl_max_payload = RPCSVC_MAXPAYLOAD_RDMA, + }; + + struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *xprt) +diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h +index c419498..ac7fc9a 100644 +--- a/net/sunrpc/xprtrdma/xprt_rdma.h ++++ b/net/sunrpc/xprtrdma/xprt_rdma.h +@@ -51,6 +51,7 @@ + #include /* rpc_xprt */ + #include /* RPC/RDMA protocol */ + #include /* xprt parameters */ ++#include /* RPCSVC_MAXPAYLOAD */ + + #define RDMA_RESOLVE_TIMEOUT (5000) /* 5 seconds */ + #define RDMA_CONNECT_RETRY_MAX (2) /* retries if no listener backlog */ +@@ -392,4 +393,10 @@ extern struct kmem_cache *svc_rdma_ctxt_cachep; + /* Workqueue created in svc_rdma.c */ + extern struct workqueue_struct *svc_rdma_wq; + ++#if RPCSVC_MAXPAYLOAD < (RPCRDMA_MAX_DATA_SEGS << PAGE_SHIFT) ++#define RPCSVC_MAXPAYLOAD_RDMA RPCSVC_MAXPAYLOAD ++#else ++#define RPCSVC_MAXPAYLOAD_RDMA (RPCRDMA_MAX_DATA_SEGS << PAGE_SHIFT) ++#endif ++ + #endif /* _LINUX_SUNRPC_XPRT_RDMA_H */ -- 2.41.0