diff mbox series

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

Message ID 1620999041-9341-2-git-send-email-dwysocha@redhat.com (mailing list archive)
State New, archived
Headers show
Series Add callback address and state to nfsd client info | expand

Commit Message

David Wysochanski May 14, 2021, 1:30 p.m. UTC
In addition to the client's address, display the callback channel
state and address in the 'info' file.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 fs/nfsd/nfs4state.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Chuck Lever May 14, 2021, 3:06 p.m. UTC | #1
Howdy Dave-

> On May 14, 2021, at 9:30 AM, Dave Wysochanski <dwysocha@redhat.com> wrote:
> 
> In addition to the client's address, display the callback channel
> state and address in the 'info' file.
> 
> Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
> ---
> fs/nfsd/nfs4state.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
> 
> 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";

No objection to the addition of this information. Style nit:
the "case" and "switch" lines should have the same amount of
indentation.


> +	}
> +	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
> 

--
Chuck Lever
David Wysochanski May 14, 2021, 4:25 p.m. UTC | #2
On Fri, May 14, 2021 at 11:06 AM Chuck Lever III <chuck.lever@oracle.com> wrote:
>
> Howdy Dave-
>
> > On May 14, 2021, at 9:30 AM, Dave Wysochanski <dwysocha@redhat.com> wrote:
> >
> > In addition to the client's address, display the callback channel
> > state and address in the 'info' file.
> >
> > Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
> > ---
> > fs/nfsd/nfs4state.c | 17 +++++++++++++++++
> > 1 file changed, 17 insertions(+)
> >
> > 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";
>
> No objection to the addition of this information. Style nit:
> the "case" and "switch" lines should have the same amount of
> indentation.
>

whoops!  Thanks Chuck - I'll be sure to run checkpatch and fix it up in v2.

>
> > +     }
> > +     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
> >
>
> --
> Chuck Lever
>
>
>
diff mbox series

Patch

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;