[PATCH] cifs: add a counter for number of reconnects to a server

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

 



Signed-off-by: Ronnie Sahlberg <lsahlber@xxxxxxxxxx>
---
 fs/cifs/cifs_debug.c | 2 ++
 fs/cifs/cifsglob.h   | 4 ++++
 fs/cifs/connect.c    | 1 +
 3 files changed, 7 insertions(+)

diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index e92a2fee3c57..35187a3399a8 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -327,6 +327,8 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 			atomic_read(&server->smbd_conn->mr_used_count));
 skip_rdma:
 #endif
+		seq_printf(m, "\nNumber of reconnects: %d",
+			server->num_reconnects);
 		seq_printf(m, "\nNumber of credits: %d Dialect 0x%x",
 			server->credits,  server->dialect);
 		if (server->sign)
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 9f1d6315dc5c..011ed5de2a45 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -716,6 +716,10 @@ struct TCP_Server_Info {
 	 * reconnect.
 	 */
 	int nr_targets;
+	/*
+	 * Number of reconnects.
+	 */
+	int num_reconnects;
 };
 
 struct cifs_credits {
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 6ad2e6d379bd..0c401ddc0a6f 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -512,6 +512,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
 	/* do not want to be sending data on a socket we are freeing */
 	cifs_dbg(FYI, "%s: tearing down socket\n", __func__);
 	mutex_lock(&server->srv_mutex);
+	server->num_reconnects++;
 	if (server->ssocket) {
 		cifs_dbg(FYI, "State: 0x%x Flags: 0x%lx\n",
 			 server->ssocket->state, server->ssocket->flags);
-- 
2.13.6




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux