Re: [PATCH v2 1/1] nfsd4: Expose the callback address and state of each NFS4 client

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 25, 2021 at 09:48:38PM +0000, Chuck Lever III wrote:
> 
> 
> > On May 25, 2021, at 4:58 PM, Bruce Fields <bfields@xxxxxxxxxxxx> wrote:
> > 
> > When I run trace-cmd report I get output like:
> > 
> >  [nfsd:nfsd_cb_state] function cb_state2str not defined
> >  [nfsd:nfsd_cb_shutdown] function cb_state2str not defined
> >  [nfsd:nfsd_cb_probe] function cb_state2str not defined
> >  [nfsd:nfsd_cb_lost] function cb_state2str not defined
> > 
> > I don't know how this is supposed to work.  Is it OK for tracepoint definitions
> > to reference kernel functions if they're defined in the right way somehow?  If
> > not, I don't know what the solution would be for sharing this--define a macro
> > that expands to the array literal and use that in both places?  Or maybe just
> > live with the the redundancy.
> 
> Living with the redundancy is OK with me.

OK, I'll revert back to Dave's first version of this patch.

--b.

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 49c052243b5c..89a7cada334d 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2357,6 +2357,21 @@ static void seq_quote_mem(struct seq_file *m, char *data, int len)
 	seq_printf(m, "\"");
 }
 
+static const char *cb_state_str(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";
+}
+
 static int client_info_show(struct seq_file *m, void *v)
 {
 	struct inode *inode = m->private;
@@ -2385,6 +2400,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_state_str(clp->cl_cb_state));
+	seq_printf(m, "callback address: %pISpc\n", &clp->cl_cb_conn.cb_addr);
 	drop_client(clp);
 
 	return 0;
-- 
1.8.3.1




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux