]> git.baikalelectronics.ru Git - kernel.git/commitdiff
nfsd4: Expose the callback address and state of each NFS4 client
authorDave Wysochanski <dwysocha@redhat.com>
Wed, 2 Jun 2021 17:51:39 +0000 (13:51 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 7 Jul 2021 00:14:41 +0000 (20:14 -0400)
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>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4state.c

index c01ecb7b3fd3435e61d0fbd96462061bcd83777a..6c64ce93510f72088557de0eb7e5c4b1a9659025 100644 (file)
@@ -2358,6 +2358,21 @@ static void seq_quote_mem(struct seq_file *m, char *data, int len)
        seq_printf(m, "\"");
 }
 
+static const char *cb_state2str(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;
@@ -2386,6 +2401,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;