From: Dave Wysochanski <dwysocha@redhat.com>
To: Bruce Fields <bfields@fieldses.org>,
Chuck Lever III <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH v2 1/1] nfsd4: Expose the callback address and state of each NFS4 client
Date: Mon, 17 May 2021 16:29:45 -0400 [thread overview]
Message-ID: <1621283385-24390-2-git-send-email-dwysocha@redhat.com> (raw)
In-Reply-To: <1621283385-24390-1-git-send-email-dwysocha@redhat.com>
In addition to the client's address, display the callback channel
state and address in the 'info' file. Define and use a common
function for this information that can be used by both callback
trace events and the NFS4 client 'info' file.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
fs/nfsd/nfs4state.c | 2 ++
fs/nfsd/trace.c | 15 +++++++++++++++
fs/nfsd/trace.h | 9 ++-------
3 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index b2573d3ecd3c..f3b8221bb543 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2385,6 +2385,8 @@ static int client_info_show(struct seq_file *m, void *v)
seq_printf(m, "\nImplementation time: [%lld, %ld]\n",
clp->cl_nii_time.tv_sec, clp->cl_nii_time.tv_nsec);
}
+ seq_printf(m, "callback state: %s\n", cb_state2str(clp->cl_cb_state));
+ seq_printf(m, "callback address: %pISpc\n", &clp->cl_cb_conn.cb_addr);
drop_client(clp);
return 0;
diff --git a/fs/nfsd/trace.c b/fs/nfsd/trace.c
index f008b95ceec2..6291b5d10824 100644
--- a/fs/nfsd/trace.c
+++ b/fs/nfsd/trace.c
@@ -2,3 +2,18 @@
#define CREATE_TRACE_POINTS
#include "trace.h"
+
+const char *cb_state2str(const int state)
+{
+ switch (state) {
+ case NFSD4_CB_UP:
+ return "UP";
+ case NFSD4_CB_UNKNOWN:
+ return "UNKNOWN";
+ case NFSD4_CB_DOWN:
+ return "DOWN";
+ case NFSD4_CB_FAULT:
+ return "FAULT";
+ }
+ return "UNDEFINED";
+}
diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index 10cc3aaf1089..8908d48b2aa6 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -876,12 +876,7 @@
TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id)
)
-#define show_cb_state(val) \
- __print_symbolic(val, \
- { NFSD4_CB_UP, "UP" }, \
- { NFSD4_CB_UNKNOWN, "UNKNOWN" }, \
- { NFSD4_CB_DOWN, "DOWN" }, \
- { NFSD4_CB_FAULT, "FAULT"})
+const char *cb_state2str(const int state);
DECLARE_EVENT_CLASS(nfsd_cb_class,
TP_PROTO(const struct nfs4_client *clp),
@@ -901,7 +896,7 @@
),
TP_printk("addr=%pISpc client %08x:%08x state=%s",
__entry->addr, __entry->cl_boot, __entry->cl_id,
- show_cb_state(__entry->state))
+ cb_state2str(__entry->state))
);
#define DEFINE_NFSD_CB_EVENT(name) \
--
1.8.3.1
next prev parent reply other threads:[~2021-05-17 20:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-17 20:29 [PATCH v2 0/1] Add callback address and state to nfsd4 client info Dave Wysochanski
2021-05-17 20:29 ` Dave Wysochanski [this message]
2021-05-25 20:58 ` [PATCH v2 1/1] nfsd4: Expose the callback address and state of each NFS4 client Bruce Fields
2021-05-25 21:48 ` Chuck Lever III
2021-05-26 18:30 ` Bruce Fields
2021-05-26 19:13 ` David Wysochanski
2021-05-26 1:32 ` Trond Myklebust
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1621283385-24390-2-git-send-email-dwysocha@redhat.com \
--to=dwysocha@redhat.com \
--cc=bfields@fieldses.org \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox