[PATCH v1 12/14] SUNRPC: Report RPC messages that can't be decoded via a tracepoint
From: Chuck Lever <hidden>
Date: 2021-10-16 22:47:39
Subsystem:
kernel nfsd, sunrpc, and lockd servers, networking [general], nfs, sunrpc, and lockd clients, the rest, tracing · Maintainers:
Chuck Lever, Jeff Layton, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Trond Myklebust, Anna Schumaker, Linus Torvalds, Steven Rostedt, Masami Hiramatsu
Replace a dprintk call site. The new tracepoint can be left enabled
persistently to capture problems.
This commit removes the last remaining call site for svc_printk(),
so that function is removed as well.
Signed-off-by: Chuck Lever <redacted>
---
include/trace/events/sunrpc.h | 20 ++++++++++++++++++++
net/sunrpc/svc.c | 29 +----------------------------
2 files changed, 21 insertions(+), 28 deletions(-)
diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h
index 85459c40eb35..9d0e7904230e 100644
--- a/include/trace/events/sunrpc.h
+++ b/include/trace/events/sunrpc.h
@@ -1746,6 +1746,26 @@ TRACE_EVENT(svc_decode_proc_unavail_err,
)
);
+TRACE_EVENT(svc_decode_header_err,
+ TP_PROTO(
+ const struct svc_rqst *rqst
+ ),
+
+ TP_ARGS(rqst),
+
+ TP_STRUCT__entry(
+ __string(addr, rqst->rq_xprt ?
+ rqst->rq_xprt->xpt_remotebuf : "(null)")
+ ),
+
+ TP_fast_assign(
+ __assign_str(addr, rqst->rq_xprt ?
+ rqst->rq_xprt->xpt_remotebuf : "(null)");
+ ),
+
+ TP_printk("addr=%s", __get_str(addr))
+);
+
DECLARE_EVENT_CLASS(svc_rqst_event,
TP_PROTO(diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index a0f37e89393f..ae3c2d31d6dc 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -33,8 +33,6 @@
#include "fail.h"
-#define RPCDBG_FACILITY RPCDBG_SVCDSP
-
static void svc_unregister(const struct svc_serv *serv, struct net *net);
#define svc_serv_is_pooled(serv) ((serv)->sv_ops->svo_function)
@@ -1156,30 +1154,6 @@ static void svc_unregister(const struct svc_serv *serv, struct net *net)
spin_unlock_irqrestore(¤t->sighand->siglock, flags);
}
-/*
- * dprintk the given error with the address of the client that caused it.
- */
-#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
-static __printf(2, 3)
-void svc_printk(struct svc_rqst *rqstp, const char *fmt, ...)
-{
- struct va_format vaf;
- va_list args;
- char buf[RPC_MAX_ADDRBUFLEN];
-
- va_start(args, fmt);
-
- vaf.fmt = fmt;
- vaf.va = &args;
-
- dprintk("svc: %s: %pV", svc_print_addr(rqstp, buf, sizeof(buf)), &vaf);
-
- va_end(args);
-}
-#else
-static __printf(2,3) void svc_printk(struct svc_rqst *rqstp, const char *fmt, ...) {}
-#endif
-
__be32
svc_generic_init_request(struct svc_rqst *rqstp,
const struct svc_program *progp,@@ -1420,8 +1394,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
goto sendit;
err_garbage:
- svc_printk(rqstp, "failed to decode args\n");
-
+ trace_svc_decode_header_err(rqstp);
rpc_stat = rpc_garbage_args;
err_bad:
serv->sv_stats->rpcbadfmt++;