Skip to contentSkip to conversation

Add callback address and state to nfsd4 client info

PATCH Applied Dave Wysochanski 2 participants 3 messages Jun 2, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover Add callback address and state to nfsd4 client info

Changes since v2
- start with v1 patch
- fix case statement indents, run checkpatch (Chuck Lever)
- rename cb_state_str to cb_state2str

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

 fs/nfsd/nfs4state.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
Signature · 1 line
2.31.1
#1 lore raw

PATCH v3 1/1 nfsd4: Expose the callback address and state of each NFS4 client

In addition to the client's address, display the callback channel state and address in the 'info' file.

---
 fs/nfsd/nfs4state.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
fs/nfsd/nfs4state.c +17 -0
index c404c6ec52af..967912b4a7dd 100644
@@ -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;
Signature · 1 line
2.31.1
Applied
#2 lore raw

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

Thanks, applied.--b.

Quoted 46 lines · Dave Wysochanski

In addition to the client's address, display the callback channel state and address in the 'info' file.

---
 fs/nfsd/nfs4state.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
fs/nfsd/nfs4state.c +17 -0
index c404c6ec52af..967912b4a7dd 100644
@@ -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;
Signature · 1 line
2.31.1