From 601d22213c84ba0665bf24bce5e0696bbfda384c Mon Sep 17 00:00:00 2001 From: Chuck Lever Date: Thu, 29 Apr 2021 14:56:26 +0800 Subject: [PATCH] SUNRPC: Fix backchannel latency metrics mainline inclusion from mainline-v5.5-rc1 commit 8729aaba74626c4ebce3abf1b9e96bb62d2958ca category: bugfix bugzilla: 51810 CVE: NA ------------------------------------------------- I noticed that for callback requests, the reported backlog latency is always zero, and the rtt value is crazy big. The problem was that rqst->rq_xtime is never set for backchannel requests. Fixes: 78215759e20d ("SUNRPC: Make RTT measurement more ... ") Signed-off-by: Chuck Lever Signed-off-by: J. Bruce Fields Signed-off-by: Lu Wei Reviewed-by: Yue Haibing Signed-off-by: Yang Yingliang --- net/sunrpc/xprtrdma/svc_rdma_backchannel.c | 1 + net/sunrpc/xprtsock.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c index fc6ea5b7e32c..9d962a4cf610 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c +++ b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c @@ -198,6 +198,7 @@ rpcrdma_bc_send_request(struct svcxprt_rdma *rdma, struct rpc_rqst *rqst) pr_info("%s: %*ph\n", __func__, 64, rqst->rq_buffer); #endif + rqst->rq_xtime = ktime_get(); rc = svc_rdma_bc_sendto(rdma, rqst, ctxt); if (rc) { svc_rdma_send_ctxt_put(rdma, ctxt); diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index bd5a7da70ae0..60ebb402ba61 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -2698,6 +2698,9 @@ static int bc_sendto(struct rpc_rqst *req) tailoff = (unsigned long)xbufp->tail[0].iov_base & ~PAGE_MASK; headoff = (unsigned long)xbufp->head[0].iov_base & ~PAGE_MASK; + + req->rq_xtime = ktime_get(); + len = svc_send_common(sock, xbufp, virt_to_page(xbufp->head[0].iov_base), headoff, xbufp->tail[0].iov_base, tailoff); @@ -2719,7 +2722,6 @@ static int bc_send_request(struct rpc_task *task) struct svc_xprt *xprt; int len; - dprintk("sending request with xid: %08x\n", ntohl(req->rq_xid)); /* * Get the server socket associated with this callback xprt */ -- GitLab