All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Add callback address and state to nfsd client info
@ 2021-05-14 13:30 Dave Wysochanski
  2021-05-14 13:30 ` [PATCH 1/1] nfsd4: Expose the callback address and state of each NFS4 client Dave Wysochanski
  2021-05-14 14:15 ` [PATCH 0/1] Add callback address and state to nfsd client info Bruce Fields
  0 siblings, 2 replies; 6+ messages in thread
From: Dave Wysochanski @ 2021-05-14 13:30 UTC (permalink / raw)
  To: Bruce Fields, Chuck Lever III; +Cc: linux-nfs

For troubleshooting, it is useful to show the callback address and state,
even though we do have this equivalent info inside Chuck's ftrace patches.
Note there is a show_cb_state() inside fs/nfsd/trace.h and this code
has a similar function.  It may be better to consolidate these two
if these additions are ok for nfsd client info, but not sure where
a good header is to place it - do we need a new file, maybe
fs/nfsd/nfs4callback.h?

Dave Wysochanski (1):
  nfsd4: Expose the callback address and state of each NFS4 client

 fs/nfsd/nfs4state.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/1] nfsd4: Expose the callback address and state of each NFS4 client
  2021-05-14 13:30 [PATCH 0/1] Add callback address and state to nfsd client info Dave Wysochanski
@ 2021-05-14 13:30 ` Dave Wysochanski
  2021-05-14 15:06   ` Chuck Lever III
  2021-05-14 14:15 ` [PATCH 0/1] Add callback address and state to nfsd client info Bruce Fields
  1 sibling, 1 reply; 6+ messages in thread
From: Dave Wysochanski @ 2021-05-14 13:30 UTC (permalink / raw)
  To: Bruce Fields, Chuck Lever III; +Cc: linux-nfs

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/1] Add callback address and state to nfsd client info
  2021-05-14 13:30 [PATCH 0/1] Add callback address and state to nfsd client info Dave Wysochanski
  2021-05-14 13:30 ` [PATCH 1/1] nfsd4: Expose the callback address and state of each NFS4 client Dave Wysochanski
@ 2021-05-14 14:15 ` Bruce Fields
  2021-05-14 16:41   ` David Wysochanski
  1 sibling, 1 reply; 6+ messages in thread
From: Bruce Fields @ 2021-05-14 14:15 UTC (permalink / raw)
  To: Dave Wysochanski; +Cc: Chuck Lever III, linux-nfs

On Fri, May 14, 2021 at 09:30:40AM -0400, Dave Wysochanski wrote:
> For troubleshooting, it is useful to show the callback address and state,
> even though we do have this equivalent info inside Chuck's ftrace patches.

Good idea.

> Note there is a show_cb_state() inside fs/nfsd/trace.h and this code
> has a similar function.  It may be better to consolidate these two
> if these additions are ok for nfsd client info, but not sure where
> a good header is to place it - do we need a new file, maybe
> fs/nfsd/nfs4callback.h?

nfs4state.c already includes trace.h, do we need anything more?

I'll admit I've just been adding things wherever seems expedient for a
while, so there may be some more logical way to organize nfsd headers.

--b.

> 
> Dave Wysochanski (1):
>   nfsd4: Expose the callback address and state of each NFS4 client
> 
>  fs/nfsd/nfs4state.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> -- 
> 1.8.3.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] nfsd4: Expose the callback address and state of each NFS4 client
  2021-05-14 13:30 ` [PATCH 1/1] nfsd4: Expose the callback address and state of each NFS4 client Dave Wysochanski
@ 2021-05-14 15:06   ` Chuck Lever III
  2021-05-14 16:25     ` David Wysochanski
  0 siblings, 1 reply; 6+ messages in thread
From: Chuck Lever III @ 2021-05-14 15:06 UTC (permalink / raw)
  To: Dave Wysochanski; +Cc: Bruce Fields, Linux NFS Mailing List

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




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] nfsd4: Expose the callback address and state of each NFS4 client
  2021-05-14 15:06   ` Chuck Lever III
@ 2021-05-14 16:25     ` David Wysochanski
  0 siblings, 0 replies; 6+ messages in thread
From: David Wysochanski @ 2021-05-14 16:25 UTC (permalink / raw)
  To: Chuck Lever III; +Cc: Bruce Fields, Linux NFS Mailing List

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/1] Add callback address and state to nfsd client info
  2021-05-14 14:15 ` [PATCH 0/1] Add callback address and state to nfsd client info Bruce Fields
@ 2021-05-14 16:41   ` David Wysochanski
  0 siblings, 0 replies; 6+ messages in thread
From: David Wysochanski @ 2021-05-14 16:41 UTC (permalink / raw)
  To: Bruce Fields; +Cc: Chuck Lever III, linux-nfs

On Fri, May 14, 2021 at 10:15 AM Bruce Fields <bfields@fieldses.org> wrote:
>
> On Fri, May 14, 2021 at 09:30:40AM -0400, Dave Wysochanski wrote:
> > For troubleshooting, it is useful to show the callback address and state,
> > even though we do have this equivalent info inside Chuck's ftrace patches.
>
> Good idea.
>
> > Note there is a show_cb_state() inside fs/nfsd/trace.h and this code
> > has a similar function.  It may be better to consolidate these two
> > if these additions are ok for nfsd client info, but not sure where
> > a good header is to place it - do we need a new file, maybe
> > fs/nfsd/nfs4callback.h?
>
> nfs4state.c already includes trace.h, do we need anything more?
>

Probably not.  I am testing a renamed function (I find that
"<typename>2str" is more common in the kernel) "cb_state2str"
defined in fs/nfsd/trace.c and declaration in fs/nfsd/trace.h

If that makes sense I'll send a v2.




> I'll admit I've just been adding things wherever seems expedient for a
> while, so there may be some more logical way to organize nfsd headers.
>
> --b.
>
> >
> > Dave Wysochanski (1):
> >   nfsd4: Expose the callback address and state of each NFS4 client
> >
> >  fs/nfsd/nfs4state.c | 17 +++++++++++++++++
> >  1 file changed, 17 insertions(+)
> >
> > --
> > 1.8.3.1
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-14 16:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-14 13:30 [PATCH 0/1] Add callback address and state to nfsd client info Dave Wysochanski
2021-05-14 13:30 ` [PATCH 1/1] nfsd4: Expose the callback address and state of each NFS4 client Dave Wysochanski
2021-05-14 15:06   ` Chuck Lever III
2021-05-14 16:25     ` David Wysochanski
2021-05-14 14:15 ` [PATCH 0/1] Add callback address and state to nfsd client info Bruce Fields
2021-05-14 16:41   ` David Wysochanski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.