Skip to content

Commit

Permalink
SUNRPC: Replace rpcbind dprintk call sites with tracepoints
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chuck Lever authored and Anna Schumaker committed Sep 21, 2020
1 parent 1e66498 commit c3adcc7
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 20 deletions.
86 changes: 86 additions & 0 deletions include/trace/events/sunrpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,92 @@ TRACE_EVENT(rpcb_setport,
)
);

TRACE_EVENT(pmap_register,
TP_PROTO(
u32 program,
u32 version,
int protocol,
unsigned short port
),

TP_ARGS(program, version, protocol, port),

TP_STRUCT__entry(
__field(unsigned int, program)
__field(unsigned int, version)
__field(int, protocol)
__field(unsigned int, port)
),

TP_fast_assign(
__entry->program = program;
__entry->version = version;
__entry->protocol = protocol;
__entry->port = port;
),

TP_printk("program=%u version=%u protocol=%d port=%u",
__entry->program, __entry->version,
__entry->protocol, __entry->port
)
);

TRACE_EVENT(rpcb_register,
TP_PROTO(
u32 program,
u32 version,
const char *addr,
const char *netid
),

TP_ARGS(program, version, addr, netid),

TP_STRUCT__entry(
__field(unsigned int, program)
__field(unsigned int, version)
__string(addr, addr)
__string(netid, netid)
),

TP_fast_assign(
__entry->program = program;
__entry->version = version;
__assign_str(addr, addr);
__assign_str(netid, netid);
),

TP_printk("program=%u version=%u addr=%s netid=%s",
__entry->program, __entry->version,
__get_str(addr), __get_str(netid)
)
);

TRACE_EVENT(rpcb_unregister,
TP_PROTO(
u32 program,
u32 version,
const char *netid
),

TP_ARGS(program, version, netid),

TP_STRUCT__entry(
__field(unsigned int, program)
__field(unsigned int, version)
__string(netid, netid)
),

TP_fast_assign(
__entry->program = program;
__entry->version = version;
__assign_str(netid, netid);
),

TP_printk("program=%u version=%u netid=%s",
__entry->program, __entry->version, __get_str(netid)
)
);

DECLARE_EVENT_CLASS(svc_xdr_buf_class,
TP_PROTO(
const struct svc_rqst *rqst,
Expand Down
24 changes: 4 additions & 20 deletions net/sunrpc/rpcb_clnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@

#include "netns.h"

#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
# define RPCDBG_FACILITY RPCDBG_BIND
#endif

#define RPCBIND_SOCK_PATHNAME "/var/run/rpcbind.sock"

#define RPCBIND_PROGRAM (100000u)
Expand Down Expand Up @@ -444,9 +440,7 @@ int rpcb_register(struct net *net, u32 prog, u32 vers, int prot, unsigned short
struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
bool is_set = false;

dprintk("RPC: %sregistering (%u, %u, %d, %u) with local "
"rpcbind\n", (port ? "" : "un"),
prog, vers, prot, port);
trace_pmap_register(prog, vers, prot, port);

msg.rpc_proc = &rpcb_procedures2[RPCBPROC_UNSET];
if (port != 0) {
Expand All @@ -472,11 +466,6 @@ static int rpcb_register_inet4(struct sunrpc_net *sn,

map->r_addr = rpc_sockaddr2uaddr(sap, GFP_KERNEL);

dprintk("RPC: %sregistering [%u, %u, %s, '%s'] with "
"local rpcbind\n", (port ? "" : "un"),
map->r_prog, map->r_vers,
map->r_addr, map->r_netid);

msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET];
if (port != 0) {
msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET];
Expand All @@ -503,11 +492,6 @@ static int rpcb_register_inet6(struct sunrpc_net *sn,

map->r_addr = rpc_sockaddr2uaddr(sap, GFP_KERNEL);

dprintk("RPC: %sregistering [%u, %u, %s, '%s'] with "
"local rpcbind\n", (port ? "" : "un"),
map->r_prog, map->r_vers,
map->r_addr, map->r_netid);

msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET];
if (port != 0) {
msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET];
Expand All @@ -524,9 +508,7 @@ static int rpcb_unregister_all_protofamilies(struct sunrpc_net *sn,
{
struct rpcbind_args *map = msg->rpc_argp;

dprintk("RPC: unregistering [%u, %u, '%s'] with "
"local rpcbind\n",
map->r_prog, map->r_vers, map->r_netid);
trace_rpcb_unregister(map->r_prog, map->r_vers, map->r_netid);

map->r_addr = "";
msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET];
Expand Down Expand Up @@ -598,6 +580,8 @@ int rpcb_v4_register(struct net *net, const u32 program, const u32 version,
if (address == NULL)
return rpcb_unregister_all_protofamilies(sn, &msg);

trace_rpcb_register(map.r_prog, map.r_vers, map.r_addr, map.r_netid);

switch (address->sa_family) {
case AF_INET:
return rpcb_register_inet4(sn, address, &msg);
Expand Down

0 comments on commit c3adcc7

Please sign in to comment.