SUNRPC: Remove rpcb_getport_async dprintk call sites
authorChuck Lever <chuck.lever@oracle.com>
Wed, 8 Jul 2020 20:10:19 +0000 (16:10 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Mon, 21 Sep 2020 14:21:09 +0000 (10:21 -0400)
In many cases, tracepoints already report these errors. In others,
the dprintks were mainly useful when this code was less mature.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
include/trace/events/sunrpc.h
net/sunrpc/rpcb_clnt.c

index 353d9a18e2548f4dcff1b953d22268fdf8438670..6e5eba54fd308f71cdbcfd84ab4914559abb7838 100644 (file)
@@ -1269,6 +1269,41 @@ TRACE_EVENT(xs_stream_read_request,
                        __entry->copied, __entry->reclen, __entry->offset)
 );
 
+TRACE_EVENT(rpcb_getport,
+       TP_PROTO(
+               const struct rpc_clnt *clnt,
+               const struct rpc_task *task,
+               unsigned int bind_version
+       ),
+
+       TP_ARGS(clnt, task, bind_version),
+
+       TP_STRUCT__entry(
+               __field(unsigned int, task_id)
+               __field(unsigned int, client_id)
+               __field(unsigned int, program)
+               __field(unsigned int, version)
+               __field(int, protocol)
+               __field(unsigned int, bind_version)
+               __string(servername, task->tk_xprt->servername)
+       ),
+
+       TP_fast_assign(
+               __entry->task_id = task->tk_pid;
+               __entry->client_id = clnt->cl_clid;
+               __entry->program = clnt->cl_prog;
+               __entry->version = clnt->cl_vers;
+               __entry->protocol = task->tk_xprt->prot;
+               __entry->bind_version = bind_version;
+               __assign_str(servername, task->tk_xprt->servername);
+       ),
+
+       TP_printk("task:%u@%u server=%s program=%u version=%u protocol=%d bind_version=%u",
+               __entry->task_id, __entry->client_id, __get_str(servername),
+               __entry->program, __entry->version, __entry->protocol,
+               __entry->bind_version
+       )
+);
 
 DECLARE_EVENT_CLASS(svc_xdr_buf_class,
        TP_PROTO(
index 4a67685c83eb4f6d8d1b32f3fe1a2d85617a9ae5..e306aab89a0bd8704e76daa9c1452facef496bc1 100644 (file)
@@ -31,6 +31,8 @@
 #include <linux/sunrpc/sched.h>
 #include <linux/sunrpc/xprtsock.h>
 
+#include <trace/events/sunrpc.h>
+
 #include "netns.h"
 
 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
@@ -693,18 +695,12 @@ void rpcb_getport_async(struct rpc_task *task)
        rcu_read_unlock();
        xprt = xprt_get(task->tk_xprt);
 
-       dprintk("RPC: %5u %s(%s, %u, %u, %d)\n",
-               task->tk_pid, __func__,
-               xprt->servername, clnt->cl_prog, clnt->cl_vers, xprt->prot);
-
        /* Put self on the wait queue to ensure we get notified if
         * some other task is already attempting to bind the port */
        rpc_sleep_on_timeout(&xprt->binding, task,
                        NULL, jiffies + xprt->bind_timeout);
 
        if (xprt_test_and_set_binding(xprt)) {
-               dprintk("RPC: %5u %s: waiting for another binder\n",
-                       task->tk_pid, __func__);
                xprt_put(xprt);
                return;
        }
@@ -712,8 +708,6 @@ void rpcb_getport_async(struct rpc_task *task)
        /* Someone else may have bound if we slept */
        if (xprt_bound(xprt)) {
                status = 0;
-               dprintk("RPC: %5u %s: already bound\n",
-                       task->tk_pid, __func__);
                goto bailout_nofree;
        }
 
@@ -732,20 +726,15 @@ void rpcb_getport_async(struct rpc_task *task)
                break;
        default:
                status = -EAFNOSUPPORT;
-               dprintk("RPC: %5u %s: bad address family\n",
-                               task->tk_pid, __func__);
                goto bailout_nofree;
        }
        if (proc == NULL) {
                xprt->bind_index = 0;
                status = -EPFNOSUPPORT;
-               dprintk("RPC: %5u %s: no more getport versions available\n",
-                       task->tk_pid, __func__);
                goto bailout_nofree;
        }
 
-       dprintk("RPC: %5u %s: trying rpcbind version %u\n",
-               task->tk_pid, __func__, bind_version);
+       trace_rpcb_getport(clnt, task, bind_version);
 
        rpcb_clnt = rpcb_create(xprt->xprt_net,
                                clnt->cl_nodename,
@@ -754,16 +743,12 @@ void rpcb_getport_async(struct rpc_task *task)
                                clnt->cl_cred);
        if (IS_ERR(rpcb_clnt)) {
                status = PTR_ERR(rpcb_clnt);
-               dprintk("RPC: %5u %s: rpcb_create failed, error %ld\n",
-                       task->tk_pid, __func__, PTR_ERR(rpcb_clnt));
                goto bailout_nofree;
        }
 
        map = kzalloc(sizeof(struct rpcbind_args), GFP_NOFS);
        if (!map) {
                status = -ENOMEM;
-               dprintk("RPC: %5u %s: no memory available\n",
-                       task->tk_pid, __func__);
                goto bailout_release_client;
        }
        map->r_prog = clnt->cl_prog;
@@ -780,8 +765,6 @@ void rpcb_getport_async(struct rpc_task *task)
                map->r_addr = rpc_sockaddr2uaddr(sap, GFP_NOFS);
                if (!map->r_addr) {
                        status = -ENOMEM;
-                       dprintk("RPC: %5u %s: no memory available\n",
-                               task->tk_pid, __func__);
                        goto bailout_free_args;
                }
                map->r_owner = "";