SUNRPC: Add tracepoint to rpc_call_rpcerror()
authorChuck Lever <chuck.lever@oracle.com>
Tue, 12 May 2020 21:13:23 +0000 (17:13 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Thu, 11 Jun 2020 17:33:48 +0000 (13:33 -0400)
Add a tracepoint in another common exit point for failing RPCs.

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/clnt.c

index f6896bcfd97f6f1971192c51f043487576bb860d..f1fd3fae5b0f4faf670dc2ce6cd5a838121b4046 100644 (file)
@@ -365,6 +365,34 @@ DEFINE_RPC_REPLY_EVENT(stale_creds);
 DEFINE_RPC_REPLY_EVENT(bad_creds);
 DEFINE_RPC_REPLY_EVENT(auth_tooweak);
 
+TRACE_EVENT(rpc_call_rpcerror,
+       TP_PROTO(
+               const struct rpc_task *task,
+               int tk_status,
+               int rpc_status
+       ),
+
+       TP_ARGS(task, tk_status, rpc_status),
+
+       TP_STRUCT__entry(
+               __field(unsigned int, task_id)
+               __field(unsigned int, client_id)
+               __field(int, tk_status)
+               __field(int, rpc_status)
+       ),
+
+       TP_fast_assign(
+               __entry->client_id = task->tk_client->cl_clid;
+               __entry->task_id = task->tk_pid;
+               __entry->tk_status = tk_status;
+               __entry->rpc_status = rpc_status;
+       ),
+
+       TP_printk("task:%u@%u tk_status=%d rpc_status=%d",
+               __entry->task_id, __entry->client_id,
+               __entry->tk_status, __entry->rpc_status)
+);
+
 TRACE_EVENT(rpc_stats_latency,
 
        TP_PROTO(
index 61b21dafd7c0da1538ec8705d78372d67090dbb2..2621258bd8fc949618f35996b52d00ff44b7584a 100644 (file)
@@ -1624,6 +1624,7 @@ const char
 static void
 __rpc_call_rpcerror(struct rpc_task *task, int tk_status, int rpc_status)
 {
+       trace_rpc_call_rpcerror(task, tk_status, rpc_status);
        task->tk_rpc_status = rpc_status;
        rpc_exit(task, tk_status);
 }