From 47bf5fc55e8abad50ed354880e7857b3a18a9a31 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 12 Dec 2019 10:29:37 -0500 Subject: [PATCH] Fix: sunrpc: use signed integer for client id Within include/linux/sunrpc/clnt.h:struct rpc_cltn, the cl_clid field is an unsigned integer, which is the type expected by the tracepoint signature. However, looking into net/sunrpc/clnt.c:rpc_alloc_clid(), its allocation considers negative signed integer as errors. Therefore, in order to properly show "-1" in the trace output (rather than MAX_INT) when called with a NULL task->tk_client, move to a signed integer as backing type for the client_id field. Signed-off-by: Mathieu Desnoyers --- instrumentation/events/lttng-module/rpc.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/instrumentation/events/lttng-module/rpc.h b/instrumentation/events/lttng-module/rpc.h index b8e4ae60..4dd9cabf 100644 --- a/instrumentation/events/lttng-module/rpc.h +++ b/instrumentation/events/lttng-module/rpc.h @@ -17,7 +17,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_status, TP_FIELDS( ctf_integer(unsigned int, task_id, task->tk_pid) - ctf_integer(unsigned int, client_id, task->tk_client->cl_clid) + ctf_integer(int, client_id, task->tk_client->cl_clid) ctf_integer(int, status, task->tk_status) ) ) @@ -42,7 +42,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_status, TP_FIELDS( ctf_integer(unsigned int, task_id, task->tk_pid) - ctf_integer(unsigned int, client_id, task->tk_client->cl_clid) + ctf_integer(int, client_id, task->tk_client->cl_clid) ctf_integer(int, status, task->tk_status) ) ) @@ -99,7 +99,7 @@ LTTNG_TRACEPOINT_EVENT(rpc_connect_status, TP_FIELDS( ctf_integer(unsigned int, task_id, task->tk_pid) - ctf_integer(unsigned int, client_id, task->tk_client->cl_clid) + ctf_integer(int, client_id, task->tk_client->cl_clid) ctf_integer(int, status, task->tk_status) ) ) @@ -111,7 +111,7 @@ LTTNG_TRACEPOINT_EVENT(rpc_connect_status, TP_FIELDS( ctf_integer(unsigned int, task_id, task->tk_pid) - ctf_integer(unsigned int, client_id, task->tk_client->cl_clid) + ctf_integer(int, client_id, task->tk_client->cl_clid) ctf_integer(int, status, status) ) ) @@ -138,7 +138,8 @@ LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_running, TP_FIELDS( ctf_integer(unsigned int, task_id, task->tk_pid) - ctf_integer(unsigned int, client_id, task->tk_client ? task->tk_client->cl_clid : -1) + ctf_integer(int, client_id, task->tk_client ? + task->tk_client->cl_clid : -1) ctf_integer_hex(const void *, action, action) ctf_integer(unsigned long, runstate, task->tk_runstate) ctf_integer(int, status, task->tk_status) @@ -175,7 +176,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_queued, TP_FIELDS( ctf_integer(unsigned int, task_id, task->tk_pid) - ctf_integer(unsigned int, client_id, task->tk_client ? + ctf_integer(int, client_id, task->tk_client ? task->tk_client->cl_clid : -1) ctf_integer(unsigned long, timeout, task->tk_timeout) ctf_integer(unsigned long, runstate, task->tk_runstate) @@ -208,7 +209,8 @@ LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_running, TP_FIELDS( ctf_integer(unsigned int, task_id, task->tk_pid) - ctf_integer(unsigned int, client_id, task->tk_client ? task->tk_client->cl_clid : -1) + ctf_integer(int, client_id, task->tk_client ? + task->tk_client->cl_clid : -1) ctf_integer_hex(const void *, action, action) ctf_integer(unsigned long, runstate, task->tk_runstate) ctf_integer(int, status, task->tk_status) @@ -245,7 +247,8 @@ LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_queued, TP_FIELDS( ctf_integer(unsigned int, task_id, task->tk_pid) - ctf_integer(unsigned int, client_id, task->tk_client->cl_clid) + ctf_integer(int, client_id, task->tk_client ? + task->tk_client->cl_clid : -1) ctf_integer(unsigned long, timeout, task->tk_timeout) ctf_integer(unsigned long, runstate, task->tk_runstate) ctf_integer(int, status, task->tk_status) -- 2.34.1