Commit 9e1a37da authored by Steve French's avatar Steve French

smb3: track the instance of each session for debugging

Each time we reconnect to the same server, bump an instance
counter (and display in /proc/fs/cifs/DebugData) to make it
easier to debug.
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
Reviewed-by: default avatarAurelien Aptel <aaptel@suse.com>
Reviewed-by: default avatarPavel Shilovsky <pshilov@microsoft.com>
parent 37e6a705
...@@ -285,7 +285,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) ...@@ -285,7 +285,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
if ((ses->serverDomain == NULL) || if ((ses->serverDomain == NULL) ||
(ses->serverOS == NULL) || (ses->serverOS == NULL) ||
(ses->serverNOS == NULL)) { (ses->serverNOS == NULL)) {
seq_printf(m, "\n%d) Name: %s Uses: %d Capability: 0x%x\tSession Status: %d\t", seq_printf(m, "\n%d) Name: %s Uses: %d Capability: 0x%x\tSession Status: %d ",
i, ses->serverName, ses->ses_count, i, ses->serverName, ses->ses_count,
ses->capabilities, ses->status); ses->capabilities, ses->status);
if (ses->session_flags & SMB2_SESSION_FLAG_IS_GUEST) if (ses->session_flags & SMB2_SESSION_FLAG_IS_GUEST)
...@@ -296,16 +296,18 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) ...@@ -296,16 +296,18 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
seq_printf(m, seq_printf(m,
"\n%d) Name: %s Domain: %s Uses: %d OS:" "\n%d) Name: %s Domain: %s Uses: %d OS:"
" %s\n\tNOS: %s\tCapability: 0x%x\n\tSMB" " %s\n\tNOS: %s\tCapability: 0x%x\n\tSMB"
" session status: %d\t", " session status: %d ",
i, ses->serverName, ses->serverDomain, i, ses->serverName, ses->serverDomain,
ses->ses_count, ses->serverOS, ses->serverNOS, ses->ses_count, ses->serverOS, ses->serverNOS,
ses->capabilities, ses->status); ses->capabilities, ses->status);
} }
if (server->rdma) if (server->rdma)
seq_printf(m, "RDMA\n\t"); seq_printf(m, "RDMA\n\t");
seq_printf(m, "TCP status: %d\n\tLocal Users To " seq_printf(m, "TCP status: %d Instance: %d\n\tLocal Users To "
"Server: %d SecMode: 0x%x Req On Wire: %d", "Server: %d SecMode: 0x%x Req On Wire: %d",
server->tcpStatus, server->srv_count, server->tcpStatus,
server->reconnect_instance,
server->srv_count,
server->sec_mode, in_flight(server)); server->sec_mode, in_flight(server));
#ifdef CONFIG_CIFS_STATS2 #ifdef CONFIG_CIFS_STATS2
......
...@@ -654,6 +654,7 @@ struct TCP_Server_Info { ...@@ -654,6 +654,7 @@ struct TCP_Server_Info {
/* 16th byte of RFC1001 workstation name is always null */ /* 16th byte of RFC1001 workstation name is always null */
char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL]; char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL];
__u32 sequence_number; /* for signing, protected by srv_mutex */ __u32 sequence_number; /* for signing, protected by srv_mutex */
__u32 reconnect_instance; /* incremented on each reconnect */
struct session_key session_key; struct session_key session_key;
unsigned long lstrp; /* when we got last response from this server */ unsigned long lstrp; /* when we got last response from this server */
struct cifs_secmech secmech; /* crypto sec mech functs, descriptors */ struct cifs_secmech secmech; /* crypto sec mech functs, descriptors */
......
...@@ -2396,6 +2396,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info) ...@@ -2396,6 +2396,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
volume_info->target_rfc1001_name, RFC1001_NAME_LEN_WITH_NULL); volume_info->target_rfc1001_name, RFC1001_NAME_LEN_WITH_NULL);
tcp_ses->session_estab = false; tcp_ses->session_estab = false;
tcp_ses->sequence_number = 0; tcp_ses->sequence_number = 0;
tcp_ses->reconnect_instance = 0;
tcp_ses->lstrp = jiffies; tcp_ses->lstrp = jiffies;
spin_lock_init(&tcp_ses->req_lock); spin_lock_init(&tcp_ses->req_lock);
INIT_LIST_HEAD(&tcp_ses->tcp_ses_list); INIT_LIST_HEAD(&tcp_ses->tcp_ses_list);
......
...@@ -110,6 +110,8 @@ smb2_set_credits(struct TCP_Server_Info *server, const int val) ...@@ -110,6 +110,8 @@ smb2_set_credits(struct TCP_Server_Info *server, const int val)
{ {
spin_lock(&server->req_lock); spin_lock(&server->req_lock);
server->credits = val; server->credits = val;
if (val == 1)
server->reconnect_instance++;
spin_unlock(&server->req_lock); spin_unlock(&server->req_lock);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment