diff mbox series

[RFC,5/9] svcrdma: Add trace point to examine client-provided write segment

Message ID 20200214155008.3848.6982.stgit@klimt.1015granger.net (mailing list archive)
State New, archived
Headers show
Series Address bugzilla 198053 and more ... | expand

Commit Message

Chuck Lever Feb. 14, 2020, 3:50 p.m. UTC
Ensure clients send large enough Write chunks.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 include/trace/events/rpcrdma.h          |    7 ++++---
 net/sunrpc/xprtrdma/svc_rdma_recvfrom.c |   12 +++++++++---
 2 files changed, 13 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/include/trace/events/rpcrdma.h b/include/trace/events/rpcrdma.h
index 6f0d3e8ce95c..773f6d9fd800 100644
--- a/include/trace/events/rpcrdma.h
+++ b/include/trace/events/rpcrdma.h
@@ -1507,7 +1507,7 @@ 
 );
 
 #define DEFINE_SEGMENT_EVENT(name)					\
-		DEFINE_EVENT(svcrdma_segment_event, svcrdma_encode_##name,\
+		DEFINE_EVENT(svcrdma_segment_event, svcrdma_##name,\
 				TP_PROTO(				\
 					u32 handle,			\
 					u32 length,			\
@@ -1515,8 +1515,9 @@ 
 				),					\
 				TP_ARGS(handle, length, offset))
 
-DEFINE_SEGMENT_EVENT(rseg);
-DEFINE_SEGMENT_EVENT(wseg);
+DEFINE_SEGMENT_EVENT(decode_wseg);
+DEFINE_SEGMENT_EVENT(encode_rseg);
+DEFINE_SEGMENT_EVENT(encode_wseg);
 
 DECLARE_EVENT_CLASS(svcrdma_chunk_event,
 	TP_PROTO(
diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
index 71127d898562..2f16c0625226 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
@@ -420,13 +420,19 @@  static __be32 *xdr_check_write_chunk(__be32 *p, const __be32 *end,
 
 	segcount = be32_to_cpup(p++);
 	for (i = 0; i < segcount; i++) {
-		p++;	/* handle */
-		if (be32_to_cpup(p++) > maxlen)
+		u32 handle, length;
+		u64 offset;
+
+		handle = be32_to_cpup(p++);
+		length = be32_to_cpup(p++);
+		if (length > maxlen)
 			return NULL;
-		p += 2;	/* offset */
+		p = xdr_decode_hyper(p, &offset);
 
 		if (p > end)
 			return NULL;
+
+		trace_svcrdma_decode_wseg(handle, length, offset);
 	}
 
 	return p;