linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH v1 16/22] SUNRPC: Hoist trace_xprtrdma_op_setport into generic code
Date: Wed, 08 Jul 2020 16:10:24 -0400	[thread overview]
Message-ID: <20200708201024.22129.40185.stgit@manet.1015granger.net> (raw)
In-Reply-To: <20200708200121.22129.92375.stgit@manet.1015granger.net>

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 include/trace/events/rpcrdma.h  |    1 -
 include/trace/events/sunrpc.h   |   29 +++++++++++++++++++++++++++++
 net/sunrpc/rpcb_clnt.c          |   29 ++++++++++++++---------------
 net/sunrpc/xprtrdma/transport.c |    3 ---
 4 files changed, 43 insertions(+), 19 deletions(-)

diff --git a/include/trace/events/rpcrdma.h b/include/trace/events/rpcrdma.h
index 4a93c166512b..137cec2d7a47 100644
--- a/include/trace/events/rpcrdma.h
+++ b/include/trace/events/rpcrdma.h
@@ -382,7 +382,6 @@ DEFINE_CONN_EVENT(connect);
 DEFINE_CONN_EVENT(disconnect);
 
 DEFINE_RXPRT_EVENT(xprtrdma_op_inject_dsc);
-DEFINE_RXPRT_EVENT(xprtrdma_op_setport);
 
 TRACE_EVENT(xprtrdma_op_connect,
 	TP_PROTO(
diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h
index e6df6740a242..946bb73afc95 100644
--- a/include/trace/events/sunrpc.h
+++ b/include/trace/events/sunrpc.h
@@ -1305,6 +1305,35 @@ TRACE_EVENT(rpcb_getport,
 	)
 );
 
+TRACE_EVENT(rpcb_setport,
+	TP_PROTO(
+		const struct rpc_task *task,
+		int status,
+		unsigned short port
+	),
+
+	TP_ARGS(task, status, port),
+
+	TP_STRUCT__entry(
+		__field(unsigned int, task_id)
+		__field(unsigned int, client_id)
+		__field(int, status)
+		__field(unsigned short, port)
+	),
+
+	TP_fast_assign(
+		__entry->task_id = task->tk_pid;
+		__entry->client_id = task->tk_client->cl_clid;
+		__entry->status = status;
+		__entry->port = port;
+	),
+
+	TP_printk("task:%u@%u status=%d port=%u",
+		__entry->task_id, __entry->client_id,
+		__entry->status, __entry->port
+	)
+);
+
 DECLARE_EVENT_CLASS(svc_xdr_buf_class,
 	TP_PROTO(
 		const struct svc_rqst *rqst,
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index d5c00c0da4f8..596c83ba647f 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -801,34 +801,33 @@ static void rpcb_getport_done(struct rpc_task *child, void *data)
 {
 	struct rpcbind_args *map = data;
 	struct rpc_xprt *xprt = map->r_xprt;
-	int status = child->tk_status;
+
+	map->r_status = child->tk_status;
 
 	/* Garbage reply: retry with a lesser rpcbind version */
-	if (status == -EIO)
-		status = -EPROTONOSUPPORT;
+	if (map->r_status == -EIO)
+		map->r_status = -EPROTONOSUPPORT;
 
 	/* rpcbind server doesn't support this rpcbind protocol version */
-	if (status == -EPROTONOSUPPORT)
+	if (map->r_status == -EPROTONOSUPPORT)
 		xprt->bind_index++;
 
-	if (status < 0) {
+	if (map->r_status < 0) {
 		/* rpcbind server not available on remote host? */
-		xprt->ops->set_port(xprt, 0);
+		map->r_port = 0;
+
 	} else if (map->r_port == 0) {
 		/* Requested RPC service wasn't registered on remote host */
-		xprt->ops->set_port(xprt, 0);
-		status = -EACCES;
+		map->r_status = -EACCES;
 	} else {
 		/* Succeeded */
-		xprt->ops->set_port(xprt, map->r_port);
-		xprt_set_bound(xprt);
-		status = 0;
+		map->r_status = 0;
 	}
 
-	dprintk("RPC: %5u rpcb_getport_done(status %d, port %u)\n",
-			child->tk_pid, status, map->r_port);
-
-	map->r_status = status;
+	trace_rpcb_setport(child, map->r_status, map->r_port);
+	xprt->ops->set_port(xprt, map->r_port);
+	if (map->r_port)
+		xprt_set_bound(xprt);
 }
 
 /*
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index 819a922830da..8915e42240d3 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -413,9 +413,6 @@ xprt_rdma_set_port(struct rpc_xprt *xprt, u16 port)
 	kfree(xprt->address_strings[RPC_DISPLAY_HEX_PORT]);
 	snprintf(buf, sizeof(buf), "%4hx", port);
 	xprt->address_strings[RPC_DISPLAY_HEX_PORT] = kstrdup(buf, GFP_KERNEL);
-
-	trace_xprtrdma_op_setport(container_of(xprt, struct rpcrdma_xprt,
-					       rx_xprt));
 }
 
 /**


  parent reply	other threads:[~2020-07-08 20:10 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08 20:08 [PATCH v1 00/22] SUNRPC: Replace dprintk calls with tracepoints Chuck Lever
2020-07-08 20:09 ` [PATCH v1 01/22] SUNRPC: Remove trace_xprt_complete_rqst() Chuck Lever
2020-07-08 20:09 ` [PATCH v1 02/22] SUNRPC: Hoist trace_xprtrdma_op_allocate into generic code Chuck Lever
2020-07-08 20:09 ` [PATCH v1 03/22] SUNRPC: Remove debugging instrumentation from xprt_release Chuck Lever
2020-07-08 20:09 ` [PATCH v1 04/22] SUNRPC: Update debugging instrumentation in xprt_do_reserve() Chuck Lever
2020-07-08 20:09 ` [PATCH v1 05/22] SUNRPC: Replace dprintk() call site in xprt_prepare_transmit Chuck Lever
2020-07-08 20:09 ` [PATCH v1 06/22] SUNRPC: Replace dprintk() call site in xs_nospace() Chuck Lever
2020-07-08 20:09 ` [PATCH v1 07/22] SUNRPC: Remove the dprint_status() macro Chuck Lever
2020-07-08 20:09 ` [PATCH v1 08/22] SUNRPC: Remove dprintk call site in call_start() Chuck Lever
2020-07-08 20:09 ` [PATCH v1 09/22] SUNRPC: Replace connect dprintk call sites with a tracepoint Chuck Lever
2020-07-08 20:09 ` [PATCH v1 10/22] SUNRPC: Mitigate cond_resched() in xprt_transmit() Chuck Lever
2020-07-08 20:09 ` [PATCH v1 11/22] SUNRPC: Add trace_rpc_timeout_status() Chuck Lever
2020-07-08 20:10 ` [PATCH v1 12/22] SUNRPC: Trace call_refresh events Chuck Lever
2020-07-08 20:10 ` [PATCH v1 13/22] SUNRPC: Remove dprintk call site in call_decode Chuck Lever
2020-07-08 20:10 ` [PATCH v1 14/22] SUNRPC: Clean up call_bind_status() observability Chuck Lever
2020-07-08 20:10 ` [PATCH v1 15/22] SUNRPC: Remove rpcb_getport_async dprintk call sites Chuck Lever
2020-07-08 20:10 ` Chuck Lever [this message]
2020-07-08 20:10 ` [PATCH v1 17/22] SUNRPC: Remove dprintk call sites in rpcbind XDR functions Chuck Lever
2020-07-08 20:10 ` [PATCH v1 18/22] SUNRPC: Remove more dprintks in rpcb_clnt.c Chuck Lever
2020-07-08 20:10 ` [PATCH v1 19/22] SUNRPC: Replace rpcbind dprintk call sites with tracepoints Chuck Lever
2020-07-08 20:10 ` [PATCH v1 20/22] SUNRPC: Clean up RPC scheduler tracepoints Chuck Lever
2020-07-08 20:10 ` [PATCH v1 21/22] SUNRPC: Remove dprintk call sites in RPC queuing functions Chuck Lever
2020-07-08 20:10 ` [PATCH v1 22/22] SUNRPC: Remove remaining dprintks from sched.c Chuck Lever
2020-08-17 17:25 ` [PATCH v1 00/22] SUNRPC: Replace dprintk calls with tracepoints Chuck Lever

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200708201024.22129.40185.stgit@manet.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).