All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/4] cifs: Reformat DebugData and index connections by conn_id.
@ 2021-02-04  8:11 Shyam Prasad N
  2021-02-04 10:17 ` Aurélien Aptel
  0 siblings, 1 reply; 16+ messages in thread
From: Shyam Prasad N @ 2021-02-04  8:11 UTC (permalink / raw)
  To: Steve French, CIFS, ronnie sahlberg, Aurélien Aptel,
	Pavel Shilovsky

-- 
Regards,
Shyam

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

* Re: [PATCH 4/4] cifs: Reformat DebugData and index connections by conn_id.
  2021-02-04  8:11 [PATCH 4/4] cifs: Reformat DebugData and index connections by conn_id Shyam Prasad N
@ 2021-02-04 10:17 ` Aurélien Aptel
  2021-02-04 12:03   ` Shyam Prasad N
  0 siblings, 1 reply; 16+ messages in thread
From: Aurélien Aptel @ 2021-02-04 10:17 UTC (permalink / raw)
  To: Shyam Prasad N, Steve French, CIFS, ronnie sahlberg, Pavel Shilovsky


-ENOPATCH :)

Cheers,
-- 
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)


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

* Re: [PATCH 4/4] cifs: Reformat DebugData and index connections by conn_id.
  2021-02-04 10:17 ` Aurélien Aptel
@ 2021-02-04 12:03   ` Shyam Prasad N
  2021-02-04 14:45     ` Aurélien Aptel
  0 siblings, 1 reply; 16+ messages in thread
From: Shyam Prasad N @ 2021-02-04 12:03 UTC (permalink / raw)
  To: Aurélien Aptel; +Cc: Steve French, CIFS, ronnie sahlberg, Pavel Shilovsky

[-- Attachment #1: Type: text/plain, Size: 437 bytes --]

Sorry. I thought I had attached. :)

On Thu, Feb 4, 2021 at 2:17 AM Aurélien Aptel <aaptel@suse.com> wrote:
>
>
> -ENOPATCH :)
>
> Cheers,
> --
> Aurélien Aptel / SUSE Labs Samba Team
> GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
> SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
> GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
>


-- 
Regards,
Shyam

[-- Attachment #2: 0004-cifs-Reformat-DebugData-and-index-connections-by-con.patch --]
[-- Type: application/octet-stream, Size: 7712 bytes --]

From 3bcdb27794d5c486b8c7ae86be2d0d5d8f39efc7 Mon Sep 17 00:00:00 2001
From: Shyam Prasad N <sprasad@microsoft.com>
Date: Wed, 3 Feb 2021 23:27:52 -0800
Subject: [PATCH 4/4] cifs: Reformat DebugData and index connections by
 conn_id.

Reformat the output of /proc/fs/cifs/DebugData to print the
conn_id for each connection. Also reordered and numbered the data
into a more reader-friendly format.

This is what the new format looks like:
$ cat /proc/fs/cifs/DebugData
Display Internal CIFS Data Structures for Debugging
---------------------------------------------------
CIFS Version 2.30
Features: DFS,FSCACHE,STATS,DEBUG,ALLOW_INSECURE_LEGACY,WEAK_PW_HASH,CIFS_POSIX,UPCALL(SPNEGO),XATTR,ACL
CIFSMaxBufSize: 16384
Active VFS Requests: 0

Servers:
1) ConnectionId: 0x1
Number of credits: 371 Dialect 0x300
TCP status: 1 Instance: 1
Local Users To Server: 1 SecMode: 0x1 Req On Wire: 0 In Send: 0 In MaxReq Wait: 0

        Sessions:
        1) Name: 10.10.10.10 Uses: 1 Capability: 0x300077     Session Status: 1
        Security type: RawNTLMSSP  SessionId: 0x785560000019
        User: 1000 Cred User: 0

        Shares:
        0) IPC: \\10.10.10.10\IPC$ Mounts: 1 DevInfo: 0x0 Attributes: 0x0
        PathComponentMax: 0 Status: 1 type: 0 Serial Number: 0x0
        Share Capabilities: None        Share Flags: 0x30
        tid: 0x1        Maximal Access: 0x11f01ff

        1) \\10.10.10.10\shyam_test2 Mounts: 1 DevInfo: 0x20020 Attributes: 0xc706ff
        PathComponentMax: 255 Status: 1 type: DISK Serial Number: 0xd4723975
        Share Capabilities: None Aligned, Partition Aligned,    Share Flags: 0x0
        tid: 0x5        Optimal sector size: 0x1000     Maximal Access: 0x1f01ff

        MIDs:

        Server interfaces: 3
        1)      Speed: 10000000000 bps
                Capabilities: rss
                IPv4: 10.10.10.1

        2)      Speed: 10000000000 bps
                Capabilities: rss
                IPv6: fe80:0000:0000:0000:18b4:0000:0000:0000

        3)      Speed: 1000000000 bps
                Capabilities: rss
                IPv4: 10.10.10.10
                [CONNECTED]

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
---
 fs/cifs/cifs_debug.c | 70 ++++++++++++++++++++++++--------------------
 1 file changed, 39 insertions(+), 31 deletions(-)

diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index b231dcf1d1f9..2abb494344db 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -227,7 +227,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 	struct TCP_Server_Info *server;
 	struct cifs_ses *ses;
 	struct cifs_tcon *tcon;
-	int i, j;
+	int c, i, j;
 
 	seq_puts(m,
 		    "Display Internal CIFS Data Structures for Debugging\n"
@@ -275,14 +275,19 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 	seq_putc(m, '\n');
 	seq_printf(m, "CIFSMaxBufSize: %d\n", CIFSMaxBufSize);
 	seq_printf(m, "Active VFS Requests: %d\n", GlobalTotalActiveXid);
-	seq_printf(m, "Servers:");
 
-	i = 0;
+	seq_printf(m, "\nServers: ");
+
+	c = 0;
 	spin_lock(&cifs_tcp_ses_lock);
 	list_for_each(tmp1, &cifs_tcp_ses_list) {
 		server = list_entry(tmp1, struct TCP_Server_Info,
 				    tcp_ses_list);
 
+		c++;
+		seq_printf(m, "\n%d) ConnectionId: 0x%llx ",
+			c, server->conn_id);
+
 #ifdef CONFIG_CIFS_SMB_DIRECT
 		if (!server->rdma)
 			goto skip_rdma;
@@ -362,46 +367,49 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 		if (server->posix_ext_supported)
 			seq_printf(m, " posix");
 
-		i++;
+		if (server->rdma)
+			seq_printf(m, "\nRDMA ");
+		seq_printf(m, "\nTCP status: %d Instance: %d"
+				"\nLocal Users To "
+				"Server: %d SecMode: 0x%x Req On Wire: %d",
+				server->tcpStatus,
+				server->reconnect_instance,
+				server->srv_count,
+				server->sec_mode, in_flight(server));
+
+		seq_printf(m, " In Send: %d In MaxReq Wait: %d",
+				atomic_read(&server->in_send),
+				atomic_read(&server->num_waiters));
+
+		seq_printf(m, "\n\n\tSessions: ");
+		i = 0;
 		list_for_each(tmp2, &server->smb_ses_list) {
 			ses = list_entry(tmp2, struct cifs_ses,
 					 smb_ses_list);
+			i++;
 			if ((ses->serverDomain == NULL) ||
 				(ses->serverOS == NULL) ||
 				(ses->serverNOS == NULL)) {
-				seq_printf(m, "\n%d) Name: %s Uses: %d Capability: 0x%x\tSession Status: %d ",
+				seq_printf(m, "\n\t%d) Name: %s Uses: %d Capability: 0x%x\tSession Status: %d ",
 					i, ses->serverName, ses->ses_count,
 					ses->capabilities, ses->status);
 				if (ses->session_flags & SMB2_SESSION_FLAG_IS_GUEST)
-					seq_printf(m, "Guest\t");
+					seq_printf(m, "Guest ");
 				else if (ses->session_flags & SMB2_SESSION_FLAG_IS_NULL)
-					seq_printf(m, "Anonymous\t");
+					seq_printf(m, "Anonymous ");
 			} else {
 				seq_printf(m,
-				    "\n%d) Name: %s  Domain: %s Uses: %d OS:"
-				    " %s\n\tNOS: %s\tCapability: 0x%x\n\tSMB"
-				    " session status: %d ",
+				    "\n\t%d) Name: %s  Domain: %s Uses: %d OS: %s "
+				    "\n\tNOS: %s\tCapability: 0x%x"
+					"\n\tSMB session status: %d ",
 				i, ses->serverName, ses->serverDomain,
 				ses->ses_count, ses->serverOS, ses->serverNOS,
 				ses->capabilities, ses->status);
 			}
 
-			seq_printf(m,"Security type: %s\n",
+			seq_printf(m,"\n\tSecurity type: %s ",
 				get_security_type_str(server->ops->select_sectype(server, ses->sectype)));
 
-			if (server->rdma)
-				seq_printf(m, "RDMA\n\t");
-			seq_printf(m, "TCP status: %d Instance: %d\n\tLocal Users To "
-				   "Server: %d SecMode: 0x%x Req On Wire: %d",
-				   server->tcpStatus,
-				   server->reconnect_instance,
-				   server->srv_count,
-				   server->sec_mode, in_flight(server));
-
-			seq_printf(m, " In Send: %d In MaxReq Wait: %d",
-				atomic_read(&server->in_send),
-				atomic_read(&server->num_waiters));
-
 			/* dump session id helpful for use with network trace */
 			seq_printf(m, " SessionId: 0x%llx", ses->Suid);
 			if (ses->session_flags & SMB2_SESSION_FLAG_ENCRYPT_DATA)
@@ -414,13 +422,13 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 				   from_kuid(&init_user_ns, ses->cred_uid));
 
 			if (ses->chan_count > 1) {
-				seq_printf(m, "\n\n\tExtra Channels: %zu\n",
+				seq_printf(m, "\n\n\tExtra Channels: %zu ",
 					   ses->chan_count-1);
 				for (j = 1; j < ses->chan_count; j++)
 					cifs_dump_channel(m, j, &ses->chans[j]);
 			}
 
-			seq_puts(m, "\n\n\tShares:");
+			seq_puts(m, "\n\n\tShares: ");
 			j = 0;
 
 			seq_printf(m, "\n\t%d) IPC: ", j);
@@ -437,13 +445,13 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 				cifs_debug_tcon(m, tcon);
 			}
 
-			seq_puts(m, "\n\tMIDs:\n");
+			seq_puts(m, "\n\n\tMIDs: ");
 
 			spin_lock(&GlobalMid_Lock);
 			list_for_each(tmp3, &server->pending_mid_q) {
 				mid_entry = list_entry(tmp3, struct mid_q_entry,
 					qhead);
-				seq_printf(m, "\tState: %d com: %d pid:"
+				seq_printf(m, "\n\tState: %d com: %d pid:"
 					      " %d cbdata: %p mid %llu\n",
 					      mid_entry->mid_state,
 					      le16_to_cpu(mid_entry->command),
@@ -455,16 +463,16 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 
 			spin_lock(&ses->iface_lock);
 			if (ses->iface_count)
-				seq_printf(m, "\n\tServer interfaces: %zu\n",
+				seq_printf(m, "\n\n\tServer interfaces: %zu",
 					   ses->iface_count);
 			for (j = 0; j < ses->iface_count; j++) {
 				struct cifs_server_iface *iface;
 
 				iface = &ses->iface_list[j];
-				seq_printf(m, "\t%d)", j);
+				seq_printf(m, "\n\t%d)", j+1);
 				cifs_dump_iface(m, iface);
 				if (is_ses_using_iface(ses, iface))
-					seq_puts(m, "\t\t[CONNECTED]\n");
+					seq_puts(m, "\t\t[CONNECTED] \n");
 			}
 			spin_unlock(&ses->iface_lock);
 		}
-- 
2.25.1


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

* Re: [PATCH 4/4] cifs: Reformat DebugData and index connections by conn_id.
  2021-02-04 12:03   ` Shyam Prasad N
@ 2021-02-04 14:45     ` Aurélien Aptel
  2021-02-07  4:14       ` Shyam Prasad N
  0 siblings, 1 reply; 16+ messages in thread
From: Aurélien Aptel @ 2021-02-04 14:45 UTC (permalink / raw)
  To: Shyam Prasad N; +Cc: Steve French, CIFS, ronnie sahlberg, Pavel Shilovsky


Code looks ok.

There are little style issues reported by checkpatch.pl: Trailing
whitespaces and comma+space stuff; ignore the columns ones.

Cheers,
-- 
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)


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

* Re: [PATCH 4/4] cifs: Reformat DebugData and index connections by conn_id.
  2021-02-04 14:45     ` Aurélien Aptel
@ 2021-02-07  4:14       ` Shyam Prasad N
  2021-02-07  4:22         ` Steve French
  0 siblings, 1 reply; 16+ messages in thread
From: Shyam Prasad N @ 2021-02-07  4:14 UTC (permalink / raw)
  To: Aurélien Aptel; +Cc: Steve French, CIFS, ronnie sahlberg, Pavel Shilovsky

[-- Attachment #1: Type: text/plain, Size: 788 bytes --]

Attached patch with a few formatting changes per checkpatch.pl.
However, some of the multi-line strings look better when the strings
are in separate lines. Please let me know if you still feel they
should go into a single line.

Regards,
Shyam

On Thu, Feb 4, 2021 at 6:45 AM Aurélien Aptel <aaptel@suse.com> wrote:
>
>
> Code looks ok.
>
> There are little style issues reported by checkpatch.pl: Trailing
> whitespaces and comma+space stuff; ignore the columns ones.
>
> Cheers,
> --
> Aurélien Aptel / SUSE Labs Samba Team
> GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
> SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
> GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
>


-- 
Regards,
Shyam

[-- Attachment #2: 0004-cifs-Reformat-DebugData-and-index-connections-by-con.patch --]
[-- Type: application/octet-stream, Size: 7618 bytes --]

From 93ea1ca1af43adf6f3ec81537be66a7021f94bcd Mon Sep 17 00:00:00 2001
From: Shyam Prasad N <sprasad@microsoft.com>
Date: Wed, 3 Feb 2021 23:27:52 -0800
Subject: [PATCH 4/4] cifs: Reformat DebugData and index connections by
 conn_id.

Reformat the output of /proc/fs/cifs/DebugData to print the
conn_id for each connection. Also reordered and numbered the data
into a more reader-friendly format.

This is what the new format looks like:
$ cat /proc/fs/cifs/DebugData
Display Internal CIFS Data Structures for Debugging
---------------------------------------------------
CIFS Version 2.30
Features: DFS,FSCACHE,STATS,DEBUG,ALLOW_INSECURE_LEGACY,WEAK_PW_HASH,CIFS_POSIX,UPCALL(SPNEGO),XATTR,ACL
CIFSMaxBufSize: 16384
Active VFS Requests: 0

Servers:
1) ConnectionId: 0x1
Number of credits: 371 Dialect 0x300
TCP status: 1 Instance: 1
Local Users To Server: 1 SecMode: 0x1 Req On Wire: 0 In Send: 0 In MaxReq Wait: 0

        Sessions:
        1) Name: 10.10.10.10 Uses: 1 Capability: 0x300077     Session Status: 1
        Security type: RawNTLMSSP  SessionId: 0x785560000019
        User: 1000 Cred User: 0

        Shares:
        0) IPC: \\10.10.10.10\IPC$ Mounts: 1 DevInfo: 0x0 Attributes: 0x0
        PathComponentMax: 0 Status: 1 type: 0 Serial Number: 0x0
        Share Capabilities: None        Share Flags: 0x30
        tid: 0x1        Maximal Access: 0x11f01ff

        1) \\10.10.10.10\shyam_test2 Mounts: 1 DevInfo: 0x20020 Attributes: 0xc706ff
        PathComponentMax: 255 Status: 1 type: DISK Serial Number: 0xd4723975
        Share Capabilities: None Aligned, Partition Aligned,    Share Flags: 0x0
        tid: 0x5        Optimal sector size: 0x1000     Maximal Access: 0x1f01ff

        MIDs:

        Server interfaces: 3
        1)      Speed: 10000000000 bps
                Capabilities: rss
                IPv4: 10.10.10.1

        2)      Speed: 10000000000 bps
                Capabilities: rss
                IPv6: fe80:0000:0000:0000:18b4:0000:0000:0000

        3)      Speed: 1000000000 bps
                Capabilities: rss
                IPv4: 10.10.10.10
                [CONNECTED]

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
---
 fs/cifs/cifs_debug.c | 67 ++++++++++++++++++++++++--------------------
 1 file changed, 37 insertions(+), 30 deletions(-)

diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index b231dcf1d1f9..ef33115477d6 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -227,7 +227,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 	struct TCP_Server_Info *server;
 	struct cifs_ses *ses;
 	struct cifs_tcon *tcon;
-	int i, j;
+	int c, i, j;
 
 	seq_puts(m,
 		    "Display Internal CIFS Data Structures for Debugging\n"
@@ -275,14 +275,19 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 	seq_putc(m, '\n');
 	seq_printf(m, "CIFSMaxBufSize: %d\n", CIFSMaxBufSize);
 	seq_printf(m, "Active VFS Requests: %d\n", GlobalTotalActiveXid);
-	seq_printf(m, "Servers:");
 
-	i = 0;
+	seq_printf(m, "\nServers: ");
+
+	c = 0;
 	spin_lock(&cifs_tcp_ses_lock);
 	list_for_each(tmp1, &cifs_tcp_ses_list) {
 		server = list_entry(tmp1, struct TCP_Server_Info,
 				    tcp_ses_list);
 
+		c++;
+		seq_printf(m, "\n%d) ConnectionId: 0x%llx ",
+			c, server->conn_id);
+
 #ifdef CONFIG_CIFS_SMB_DIRECT
 		if (!server->rdma)
 			goto skip_rdma;
@@ -362,46 +367,48 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 		if (server->posix_ext_supported)
 			seq_printf(m, " posix");
 
-		i++;
+		if (server->rdma)
+			seq_printf(m, "\nRDMA ");
+		seq_printf(m, "\nTCP status: %d Instance: %d"
+				"\nLocal Users To Server: %d SecMode: 0x%x Req On Wire: %d",
+				server->tcpStatus,
+				server->reconnect_instance,
+				server->srv_count,
+				server->sec_mode, in_flight(server));
+
+		seq_printf(m, " In Send: %d In MaxReq Wait: %d",
+				atomic_read(&server->in_send),
+				atomic_read(&server->num_waiters));
+
+		seq_printf(m, "\n\n\tSessions: ");
+		i = 0;
 		list_for_each(tmp2, &server->smb_ses_list) {
 			ses = list_entry(tmp2, struct cifs_ses,
 					 smb_ses_list);
+			i++;
 			if ((ses->serverDomain == NULL) ||
 				(ses->serverOS == NULL) ||
 				(ses->serverNOS == NULL)) {
-				seq_printf(m, "\n%d) Name: %s Uses: %d Capability: 0x%x\tSession Status: %d ",
+				seq_printf(m, "\n\t%d) Name: %s Uses: %d Capability: 0x%x\tSession Status: %d ",
 					i, ses->serverName, ses->ses_count,
 					ses->capabilities, ses->status);
 				if (ses->session_flags & SMB2_SESSION_FLAG_IS_GUEST)
-					seq_printf(m, "Guest\t");
+					seq_printf(m, "Guest ");
 				else if (ses->session_flags & SMB2_SESSION_FLAG_IS_NULL)
-					seq_printf(m, "Anonymous\t");
+					seq_printf(m, "Anonymous ");
 			} else {
 				seq_printf(m,
-				    "\n%d) Name: %s  Domain: %s Uses: %d OS:"
-				    " %s\n\tNOS: %s\tCapability: 0x%x\n\tSMB"
-				    " session status: %d ",
+				    "\n\t%d) Name: %s  Domain: %s Uses: %d OS: %s "
+				    "\n\tNOS: %s\tCapability: 0x%x"
+					"\n\tSMB session status: %d ",
 				i, ses->serverName, ses->serverDomain,
 				ses->ses_count, ses->serverOS, ses->serverNOS,
 				ses->capabilities, ses->status);
 			}
 
-			seq_printf(m,"Security type: %s\n",
+			seq_printf(m, "\n\tSecurity type: %s ",
 				get_security_type_str(server->ops->select_sectype(server, ses->sectype)));
 
-			if (server->rdma)
-				seq_printf(m, "RDMA\n\t");
-			seq_printf(m, "TCP status: %d Instance: %d\n\tLocal Users To "
-				   "Server: %d SecMode: 0x%x Req On Wire: %d",
-				   server->tcpStatus,
-				   server->reconnect_instance,
-				   server->srv_count,
-				   server->sec_mode, in_flight(server));
-
-			seq_printf(m, " In Send: %d In MaxReq Wait: %d",
-				atomic_read(&server->in_send),
-				atomic_read(&server->num_waiters));
-
 			/* dump session id helpful for use with network trace */
 			seq_printf(m, " SessionId: 0x%llx", ses->Suid);
 			if (ses->session_flags & SMB2_SESSION_FLAG_ENCRYPT_DATA)
@@ -414,13 +421,13 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 				   from_kuid(&init_user_ns, ses->cred_uid));
 
 			if (ses->chan_count > 1) {
-				seq_printf(m, "\n\n\tExtra Channels: %zu\n",
+				seq_printf(m, "\n\n\tExtra Channels: %zu ",
 					   ses->chan_count-1);
 				for (j = 1; j < ses->chan_count; j++)
 					cifs_dump_channel(m, j, &ses->chans[j]);
 			}
 
-			seq_puts(m, "\n\n\tShares:");
+			seq_puts(m, "\n\n\tShares: ");
 			j = 0;
 
 			seq_printf(m, "\n\t%d) IPC: ", j);
@@ -437,13 +444,13 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 				cifs_debug_tcon(m, tcon);
 			}
 
-			seq_puts(m, "\n\tMIDs:\n");
+			seq_puts(m, "\n\n\tMIDs: ");
 
 			spin_lock(&GlobalMid_Lock);
 			list_for_each(tmp3, &server->pending_mid_q) {
 				mid_entry = list_entry(tmp3, struct mid_q_entry,
 					qhead);
-				seq_printf(m, "\tState: %d com: %d pid:"
+				seq_printf(m, "\n\tState: %d com: %d pid:"
 					      " %d cbdata: %p mid %llu\n",
 					      mid_entry->mid_state,
 					      le16_to_cpu(mid_entry->command),
@@ -455,13 +462,13 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 
 			spin_lock(&ses->iface_lock);
 			if (ses->iface_count)
-				seq_printf(m, "\n\tServer interfaces: %zu\n",
+				seq_printf(m, "\n\n\tServer interfaces: %zu",
 					   ses->iface_count);
 			for (j = 0; j < ses->iface_count; j++) {
 				struct cifs_server_iface *iface;
 
 				iface = &ses->iface_list[j];
-				seq_printf(m, "\t%d)", j);
+				seq_printf(m, "\n\t%d)", j+1);
 				cifs_dump_iface(m, iface);
 				if (is_ses_using_iface(ses, iface))
 					seq_puts(m, "\t\t[CONNECTED]\n");
-- 
2.25.1


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

* Re: [PATCH 4/4] cifs: Reformat DebugData and index connections by conn_id.
  2021-02-07  4:14       ` Shyam Prasad N
@ 2021-02-07  4:22         ` Steve French
  2021-02-08 11:36           ` Aurélien Aptel
  0 siblings, 1 reply; 16+ messages in thread
From: Steve French @ 2021-02-07  4:22 UTC (permalink / raw)
  To: Shyam Prasad N
  Cc: Aurélien Aptel, CIFS, ronnie sahlberg, Pavel Shilovsky

the multiline strings if they make it more readable are fine (probably
fine here), so can ignore
  "quoted string split across lines"
warning

On Sat, Feb 6, 2021 at 10:14 PM Shyam Prasad N <nspmangalore@gmail.com> wrote:
>
> Attached patch with a few formatting changes per checkpatch.pl.
> However, some of the multi-line strings look better when the strings
> are in separate lines. Please let me know if you still feel they
> should go into a single line.
>
> Regards,
> Shyam
>
> On Thu, Feb 4, 2021 at 6:45 AM Aurélien Aptel <aaptel@suse.com> wrote:
> >
> >
> > Code looks ok.
> >
> > There are little style issues reported by checkpatch.pl: Trailing
> > whitespaces and comma+space stuff; ignore the columns ones.
> >
> > Cheers,
> > --
> > Aurélien Aptel / SUSE Labs Samba Team
> > GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
> > SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
> > GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
> >
>
>
> --
> Regards,
> Shyam



-- 
Thanks,

Steve

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

* Re: [PATCH 4/4] cifs: Reformat DebugData and index connections by conn_id.
  2021-02-07  4:22         ` Steve French
@ 2021-02-08 11:36           ` Aurélien Aptel
  2021-02-11 13:13             ` Shyam Prasad N
  0 siblings, 1 reply; 16+ messages in thread
From: Aurélien Aptel @ 2021-02-08 11:36 UTC (permalink / raw)
  To: Steve French, Shyam Prasad N; +Cc: CIFS, ronnie sahlberg, Pavel Shilovsky

Steve French <smfrench@gmail.com> writes:
> the multiline strings if they make it more readable are fine (probably
> fine here), so can ignore
>   "quoted string split across lines"
> warning

Agreed

Reviewed-by: Aurelien Aptel <aaptel@suse.com>

-- 
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)


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

* Re: [PATCH 4/4] cifs: Reformat DebugData and index connections by conn_id.
  2021-02-08 11:36           ` Aurélien Aptel
@ 2021-02-11 13:13             ` Shyam Prasad N
  2021-02-11 14:24               ` Aurélien Aptel
  0 siblings, 1 reply; 16+ messages in thread
From: Shyam Prasad N @ 2021-02-11 13:13 UTC (permalink / raw)
  To: Aurélien Aptel; +Cc: Steve French, CIFS, ronnie sahlberg, Pavel Shilovsky

[-- Attachment #1: Type: text/plain, Size: 820 bytes --]

I noticed that the output looks rather odd when used with multichannel.
Attaching a revised patch with the changes.

Also attached a sample of new output.

Regards,
Shyam

On Mon, Feb 8, 2021 at 3:36 AM Aurélien Aptel <aaptel@suse.com> wrote:
>
> Steve French <smfrench@gmail.com> writes:
> > the multiline strings if they make it more readable are fine (probably
> > fine here), so can ignore
> >   "quoted string split across lines"
> > warning
>
> Agreed
>
> Reviewed-by: Aurelien Aptel <aaptel@suse.com>
>
> --
> Aurélien Aptel / SUSE Labs Samba Team
> GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
> SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
> GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
>


-- 
Regards,
Shyam

[-- Attachment #2: debug.txt --]
[-- Type: text/plain, Size: 2246 bytes --]

Display Internal CIFS Data Structures for Debugging
---------------------------------------------------
CIFS Version 2.30
Features: DFS,FSCACHE,STATS,DEBUG,ALLOW_INSECURE_LEGACY,WEAK_PW_HASH,CIFS_POSIX,UPCALL(SPNEGO),XATTR,ACL
CIFSMaxBufSize: 16384
Active VFS Requests: 6

Servers: 
1) ConnectionId: 0x1 
Number of credits: 326 Dialect 0x311
TCP status: 1 Instance: 1
Local Users To Server: 1 SecMode: 0x1 Req On Wire: 0
In Send: 0 In MaxReq Wait: 0

	Sessions: 
	1) Name: 10.229.158.38 Uses: 1 Capability: 0x300077	Session Status: 1 
	Security type: RawNTLMSSP  SessionId: 0x7c0014000049
	User: 1000 Cred User: 0

	Extra Channels: 3 

		Channel: 2 ConnectionId: 0x5
		Number of credits: 130 Dialect 0x311
		TCP status: 1 Instance: 1
		Local Users To Server: 1 SecMode: 0x1 Req On Wire: 0
		In Send: 0 In MaxReq Wait: 0

		Channel: 3 ConnectionId: 0x6
		Number of credits: 130 Dialect 0x311
		TCP status: 1 Instance: 1
		Local Users To Server: 1 SecMode: 0x1 Req On Wire: 0
		In Send: 0 In MaxReq Wait: 0

		Channel: 4 ConnectionId: 0x7
		Number of credits: 130 Dialect 0x311
		TCP status: 1 Instance: 1
		Local Users To Server: 1 SecMode: 0x1 Req On Wire: 0
		In Send: 0 In MaxReq Wait: 0

	Shares: 
	0) IPC: \\10.229.158.38\IPC$ Mounts: 1 DevInfo: 0x0 Attributes: 0x0
	PathComponentMax: 0 Status: 1 type: 0 Serial Number: 0x0
	Share Capabilities: None	Share Flags: 0x30
	tid: 0x1	Maximal Access: 0x11f01ff

	1) \\10.229.158.38\shyam_xfstests Mounts: 1 DevInfo: 0x20020 Attributes: 0xc706ff
	PathComponentMax: 255 Status: 1 type: DISK Serial Number: 0xd4723975
	Share Capabilities: None Aligned, Partition Aligned,	Share Flags: 0x0
	tid: 0x5	Optimal sector size: 0x1000	Maximal Access: 0x1f01ff


	Server interfaces: 6
	1)	Speed: 10000000000 bps
		Capabilities: rss 
		IPv4: 169.254.0.1

	2)	Speed: 10000000000 bps
		Capabilities: rss 
		IPv6: fe80:0000:0000:0000:18b4:f0d6:2cf9:200f

	3)	Speed: 1000000000 bps
		Capabilities: rss 
		IPv6: fe80:0000:0000:0000:dc9a:7f8b:57aa:14ac

	4)	Speed: 1000000000 bps
		Capabilities: rss 
		IPv4: 10.229.158.38
		[CONNECTED]

	5)	Speed: 1000000000 bps
		Capabilities: rss 
		IPv4: 169.254.20.172

	6)	Speed: 1000000000 bps
		Capabilities: rss 
		IPv6: fe80:0000:0000:0000:0085:1b73:dda4:2851


	MIDs: 
--


[-- Attachment #3: 0004-cifs-Reformat-DebugData-and-index-connections-by-con.patch --]
[-- Type: application/octet-stream, Size: 9157 bytes --]

From 992fe2d8c267b44c5cffd2ce5f1275e9f5ebbcaa Mon Sep 17 00:00:00 2001
From: Shyam Prasad N <sprasad@microsoft.com>
Date: Wed, 3 Feb 2021 23:27:52 -0800
Subject: [PATCH 4/4] cifs: Reformat DebugData and index connections by
 conn_id.

Reformat the output of /proc/fs/cifs/DebugData to print the
conn_id for each connection. Also reordered and numbered the data
into a more reader-friendly format.

This is what the new format looks like:
$ cat /proc/fs/cifs/DebugData
Display Internal CIFS Data Structures for Debugging
---------------------------------------------------
CIFS Version 2.30
Features: DFS,FSCACHE,STATS,DEBUG,ALLOW_INSECURE_LEGACY,WEAK_PW_HASH,CIFS_POSIX,UPCALL(SPNEGO),XATTR,ACL
CIFSMaxBufSize: 16384
Active VFS Requests: 0

Servers:
1) ConnectionId: 0x1
Number of credits: 371 Dialect 0x300
TCP status: 1 Instance: 1
Local Users To Server: 1 SecMode: 0x1 Req On Wire: 0 In Send: 0 In MaxReq Wait: 0

        Sessions:
        1) Name: 10.10.10.10 Uses: 1 Capability: 0x300077     Session Status: 1
        Security type: RawNTLMSSP  SessionId: 0x785560000019
        User: 1000 Cred User: 0

        Shares:
        0) IPC: \\10.10.10.10\IPC$ Mounts: 1 DevInfo: 0x0 Attributes: 0x0
        PathComponentMax: 0 Status: 1 type: 0 Serial Number: 0x0
        Share Capabilities: None        Share Flags: 0x30
        tid: 0x1        Maximal Access: 0x11f01ff

        1) \\10.10.10.10\shyam_test2 Mounts: 1 DevInfo: 0x20020 Attributes: 0xc706ff
        PathComponentMax: 255 Status: 1 type: DISK Serial Number: 0xd4723975
        Share Capabilities: None Aligned, Partition Aligned,    Share Flags: 0x0
        tid: 0x5        Optimal sector size: 0x1000     Maximal Access: 0x1f01ff

        MIDs:

        Server interfaces: 3
        1)      Speed: 10000000000 bps
                Capabilities: rss
                IPv4: 10.10.10.1

        2)      Speed: 10000000000 bps
                Capabilities: rss
                IPv6: fe80:0000:0000:0000:18b4:0000:0000:0000

        3)      Speed: 1000000000 bps
                Capabilities: rss
                IPv4: 10.10.10.10
                [CONNECTED]

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
---
 fs/cifs/cifs_debug.c | 117 +++++++++++++++++++++++++------------------
 1 file changed, 68 insertions(+), 49 deletions(-)

diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index b231dcf1d1f9..370cc88a3d02 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -133,11 +133,12 @@ cifs_dump_channel(struct seq_file *m, int i, struct cifs_chan *chan)
 {
 	struct TCP_Server_Info *server = chan->server;
 
-	seq_printf(m, "\t\tChannel %d Number of credits: %d Dialect 0x%x "
-		   "TCP status: %d Instance: %d Local Users To Server: %d "
-		   "SecMode: 0x%x Req On Wire: %d In Send: %d "
-		   "In MaxReq Wait: %d\n",
-		   i+1,
+	seq_printf(m, "\n\n\t\tChannel: %d ConnectionId: 0x%llx"
+		   "\n\t\tNumber of credits: %d Dialect 0x%x"
+		   "\n\t\tTCP status: %d Instance: %d"
+		   "\n\t\tLocal Users To Server: %d SecMode: 0x%x Req On Wire: %d"
+		   "\n\t\tIn Send: %d In MaxReq Wait: %d",
+		   i+1, server->conn_id,
 		   server->credits,
 		   server->dialect,
 		   server->tcpStatus,
@@ -227,7 +228,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 	struct TCP_Server_Info *server;
 	struct cifs_ses *ses;
 	struct cifs_tcon *tcon;
-	int i, j;
+	int c, i, j;
 
 	seq_puts(m,
 		    "Display Internal CIFS Data Structures for Debugging\n"
@@ -275,14 +276,23 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 	seq_putc(m, '\n');
 	seq_printf(m, "CIFSMaxBufSize: %d\n", CIFSMaxBufSize);
 	seq_printf(m, "Active VFS Requests: %d\n", GlobalTotalActiveXid);
-	seq_printf(m, "Servers:");
 
-	i = 0;
+	seq_printf(m, "\nServers: ");
+
+	c = 0;
 	spin_lock(&cifs_tcp_ses_lock);
 	list_for_each(tmp1, &cifs_tcp_ses_list) {
 		server = list_entry(tmp1, struct TCP_Server_Info,
 				    tcp_ses_list);
 
+		/* channel info will be printed as a part of sessions below */
+		if (server->is_channel)
+			continue;
+
+		c++;
+		seq_printf(m, "\n%d) ConnectionId: 0x%llx ",
+			c, server->conn_id);
+
 #ifdef CONFIG_CIFS_SMB_DIRECT
 		if (!server->rdma)
 			goto skip_rdma;
@@ -362,46 +372,48 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 		if (server->posix_ext_supported)
 			seq_printf(m, " posix");
 
-		i++;
+		if (server->rdma)
+			seq_printf(m, "\nRDMA ");
+		seq_printf(m, "\nTCP status: %d Instance: %d"
+				"\nLocal Users To Server: %d SecMode: 0x%x Req On Wire: %d",
+				server->tcpStatus,
+				server->reconnect_instance,
+				server->srv_count,
+				server->sec_mode, in_flight(server));
+
+		seq_printf(m, "\nIn Send: %d In MaxReq Wait: %d",
+				atomic_read(&server->in_send),
+				atomic_read(&server->num_waiters));
+
+		seq_printf(m, "\n\n\tSessions: ");
+		i = 0;
 		list_for_each(tmp2, &server->smb_ses_list) {
 			ses = list_entry(tmp2, struct cifs_ses,
 					 smb_ses_list);
+			i++;
 			if ((ses->serverDomain == NULL) ||
 				(ses->serverOS == NULL) ||
 				(ses->serverNOS == NULL)) {
-				seq_printf(m, "\n%d) Name: %s Uses: %d Capability: 0x%x\tSession Status: %d ",
+				seq_printf(m, "\n\t%d) Name: %s Uses: %d Capability: 0x%x\tSession Status: %d ",
 					i, ses->serverName, ses->ses_count,
 					ses->capabilities, ses->status);
 				if (ses->session_flags & SMB2_SESSION_FLAG_IS_GUEST)
-					seq_printf(m, "Guest\t");
+					seq_printf(m, "Guest ");
 				else if (ses->session_flags & SMB2_SESSION_FLAG_IS_NULL)
-					seq_printf(m, "Anonymous\t");
+					seq_printf(m, "Anonymous ");
 			} else {
 				seq_printf(m,
-				    "\n%d) Name: %s  Domain: %s Uses: %d OS:"
-				    " %s\n\tNOS: %s\tCapability: 0x%x\n\tSMB"
-				    " session status: %d ",
+				    "\n\t%d) Name: %s  Domain: %s Uses: %d OS: %s "
+				    "\n\tNOS: %s\tCapability: 0x%x"
+					"\n\tSMB session status: %d ",
 				i, ses->serverName, ses->serverDomain,
 				ses->ses_count, ses->serverOS, ses->serverNOS,
 				ses->capabilities, ses->status);
 			}
 
-			seq_printf(m,"Security type: %s\n",
+			seq_printf(m, "\n\tSecurity type: %s ",
 				get_security_type_str(server->ops->select_sectype(server, ses->sectype)));
 
-			if (server->rdma)
-				seq_printf(m, "RDMA\n\t");
-			seq_printf(m, "TCP status: %d Instance: %d\n\tLocal Users To "
-				   "Server: %d SecMode: 0x%x Req On Wire: %d",
-				   server->tcpStatus,
-				   server->reconnect_instance,
-				   server->srv_count,
-				   server->sec_mode, in_flight(server));
-
-			seq_printf(m, " In Send: %d In MaxReq Wait: %d",
-				atomic_read(&server->in_send),
-				atomic_read(&server->num_waiters));
-
 			/* dump session id helpful for use with network trace */
 			seq_printf(m, " SessionId: 0x%llx", ses->Suid);
 			if (ses->session_flags & SMB2_SESSION_FLAG_ENCRYPT_DATA)
@@ -414,13 +426,13 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 				   from_kuid(&init_user_ns, ses->cred_uid));
 
 			if (ses->chan_count > 1) {
-				seq_printf(m, "\n\n\tExtra Channels: %zu\n",
+				seq_printf(m, "\n\n\tExtra Channels: %zu ",
 					   ses->chan_count-1);
 				for (j = 1; j < ses->chan_count; j++)
 					cifs_dump_channel(m, j, &ses->chans[j]);
 			}
 
-			seq_puts(m, "\n\n\tShares:");
+			seq_puts(m, "\n\n\tShares: ");
 			j = 0;
 
 			seq_printf(m, "\n\t%d) IPC: ", j);
@@ -437,38 +449,45 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 				cifs_debug_tcon(m, tcon);
 			}
 
-			seq_puts(m, "\n\tMIDs:\n");
-
-			spin_lock(&GlobalMid_Lock);
-			list_for_each(tmp3, &server->pending_mid_q) {
-				mid_entry = list_entry(tmp3, struct mid_q_entry,
-					qhead);
-				seq_printf(m, "\tState: %d com: %d pid:"
-					      " %d cbdata: %p mid %llu\n",
-					      mid_entry->mid_state,
-					      le16_to_cpu(mid_entry->command),
-					      mid_entry->pid,
-					      mid_entry->callback_data,
-					      mid_entry->mid);
-			}
-			spin_unlock(&GlobalMid_Lock);
-
 			spin_lock(&ses->iface_lock);
 			if (ses->iface_count)
-				seq_printf(m, "\n\tServer interfaces: %zu\n",
+				seq_printf(m, "\n\n\tServer interfaces: %zu",
 					   ses->iface_count);
 			for (j = 0; j < ses->iface_count; j++) {
 				struct cifs_server_iface *iface;
 
 				iface = &ses->iface_list[j];
-				seq_printf(m, "\t%d)", j);
+				seq_printf(m, "\n\t%d)", j+1);
 				cifs_dump_iface(m, iface);
 				if (is_ses_using_iface(ses, iface))
 					seq_puts(m, "\t\t[CONNECTED]\n");
 			}
+			if (j == 0)
+				seq_printf(m, "\n\t[NONE]");
 			spin_unlock(&ses->iface_lock);
 		}
+		if (i == 0)
+			seq_printf(m, "\n\t\t[NONE]");
+
+		seq_puts(m, "\n\n\tMIDs: ");
+		spin_lock(&GlobalMid_Lock);
+		list_for_each(tmp3, &server->pending_mid_q) {
+			mid_entry = list_entry(tmp3, struct mid_q_entry,
+					qhead);
+			seq_printf(m, "\n\tState: %d com: %d pid:"
+					" %d cbdata: %p mid %llu\n",
+					mid_entry->mid_state,
+					le16_to_cpu(mid_entry->command),
+					mid_entry->pid,
+					mid_entry->callback_data,
+					mid_entry->mid);
+		}
+		spin_unlock(&GlobalMid_Lock);
+		seq_printf(m, "\n--\n");
 	}
+	if (c == 0)
+		seq_printf(m, "\n\t[NONE]");
+
 	spin_unlock(&cifs_tcp_ses_lock);
 	seq_putc(m, '\n');
 
-- 
2.25.1


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

* Re: [PATCH 4/4] cifs: Reformat DebugData and index connections by conn_id.
  2021-02-11 13:13             ` Shyam Prasad N
@ 2021-02-11 14:24               ` Aurélien Aptel
  2021-02-11 17:12                 ` Pavel Shilovsky
  0 siblings, 1 reply; 16+ messages in thread
From: Aurélien Aptel @ 2021-02-11 14:24 UTC (permalink / raw)
  To: Shyam Prasad N; +Cc: Steve French, CIFS, ronnie sahlberg, Pavel Shilovsky

Shyam Prasad N <nspmangalore@gmail.com> writes:
> I noticed that the output looks rather odd when used with multichannel.
> Attaching a revised patch with the changes.
>
> Also attached a sample of new output.

Reviewed-by: Aurelien Aptel <aaptel@suse.com>

-- 
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)


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

* Re: [PATCH 4/4] cifs: Reformat DebugData and index connections by conn_id.
  2021-02-11 14:24               ` Aurélien Aptel
@ 2021-02-11 17:12                 ` Pavel Shilovsky
  2021-02-11 19:41                   ` Tom Talpey
  2021-02-16 20:18                   ` Steve French
  0 siblings, 2 replies; 16+ messages in thread
From: Pavel Shilovsky @ 2021-02-11 17:12 UTC (permalink / raw)
  To: Aurélien Aptel; +Cc: Shyam Prasad N, Steve French, CIFS, ronnie sahlberg

Hi Shyam,

The output looks very informative! I have one comment:

Servers:
1) ConnectionId: 0x1
Number of credits: 326 Dialect 0x311
TCP status: 1 Instance: 1
Local Users To Server: 1 SecMode: 0x1 Req On Wire: 0
In Send: 0 In MaxReq Wait: 0

Sessions:
1) Name: 10.229.158.38 Uses: 1 Capability: 0x300077 Session Status: 1
                     ^^^^
Isn't this name (or hostname) a property of the connection? I would
expect an IP or a hostname to be printed in the connection settings
above.

--
Best regards,
Pavel Shilovsky

чт, 11 февр. 2021 г. в 06:24, Aurélien Aptel <aaptel@suse.com>:
>
> Shyam Prasad N <nspmangalore@gmail.com> writes:
> > I noticed that the output looks rather odd when used with multichannel.
> > Attaching a revised patch with the changes.
> >
> > Also attached a sample of new output.
>
> Reviewed-by: Aurelien Aptel <aaptel@suse.com>
>
> --
> Aurélien Aptel / SUSE Labs Samba Team
> GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
> SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
> GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
>

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

* Re: [PATCH 4/4] cifs: Reformat DebugData and index connections by conn_id.
  2021-02-11 17:12                 ` Pavel Shilovsky
@ 2021-02-11 19:41                   ` Tom Talpey
  2021-02-16 12:29                     ` Shyam Prasad N
  2021-02-16 20:18                   ` Steve French
  1 sibling, 1 reply; 16+ messages in thread
From: Tom Talpey @ 2021-02-11 19:41 UTC (permalink / raw)
  To: Pavel Shilovsky, Aurélien Aptel
  Cc: Shyam Prasad N, Steve French, CIFS, ronnie sahlberg

On 2/11/2021 12:12 PM, Pavel Shilovsky wrote:
> Hi Shyam,
> 
> The output looks very informative! I have one comment:
> 
> Servers:
> 1) ConnectionId: 0x1
> Number of credits: 326 Dialect 0x311
> TCP status: 1 Instance: 1
> Local Users To Server: 1 SecMode: 0x1 Req On Wire: 0
> In Send: 0 In MaxReq Wait: 0
> 
> Sessions:
> 1) Name: 10.229.158.38 Uses: 1 Capability: 0x300077 Session Status: 1
>                       ^^^^
> Isn't this name (or hostname) a property of the connection? I would
> expect an IP or a hostname to be printed in the connection settings
> above.

The servername is a property of the session, in this case since the
mount specified a dotted quad, it would correctly appear as the
servername at this level.

However, I definitely agree that an IP address is important in the
per-connection (channel) stanzas. Multichannel, multihoming, witness
redirects, and any number of things can vary among them. It would
be useful indeed to display them.

Including the transport type (TCP, RDMA...) and multichannel attributes
(link speed, RSS count, ...) would be useful too.

Tom.

> 
> --
> Best regards,
> Pavel Shilovsky
> 
> чт, 11 февр. 2021 г. в 06:24, Aurélien Aptel <aaptel@suse.com>:
>>
>> Shyam Prasad N <nspmangalore@gmail.com> writes:
>>> I noticed that the output looks rather odd when used with multichannel.
>>> Attaching a revised patch with the changes.
>>>
>>> Also attached a sample of new output.
>>
>> Reviewed-by: Aurelien Aptel <aaptel@suse.com>
>>
>> --
>> Aurélien Aptel / SUSE Labs Samba Team
>> GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
>> SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
>> GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
>>
> 

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

* Re: [PATCH 4/4] cifs: Reformat DebugData and index connections by conn_id.
  2021-02-11 19:41                   ` Tom Talpey
@ 2021-02-16 12:29                     ` Shyam Prasad N
  2021-02-16 19:56                       ` Steve French
  2021-02-16 22:30                       ` Steve French
  0 siblings, 2 replies; 16+ messages in thread
From: Shyam Prasad N @ 2021-02-16 12:29 UTC (permalink / raw)
  To: Tom Talpey
  Cc: Pavel Shilovsky, Aurélien Aptel, Steve French, CIFS,
	ronnie sahlberg

Hi Pavel,

Thanks for the review.
As Tom pointed out, the server name is currently a field in
TCP_Session_Info struct.
We do store the struct sockaddr_storage, which I'm guessing holds the
IP address in binary format, and we could use that. And may need to
consider IPv4 vs IPv6 when we do it.
I'll submit that as a new patch later on.

Hi Tom,

> Including the transport type (TCP, RDMA...) and multichannel attributes
> (link speed, RSS count, ...) would be useful too.
Can you please clarify this for me?
From what I can see from the code, RDMA connection DebugData is a
superset of TCP connection. The RDMA specific details get printed only
when server->rdma is set.

Regards,
Shyam

On Thu, Feb 11, 2021 at 11:41 AM Tom Talpey <tom@talpey.com> wrote:
>
> On 2/11/2021 12:12 PM, Pavel Shilovsky wrote:
> > Hi Shyam,
> >
> > The output looks very informative! I have one comment:
> >
> > Servers:
> > 1) ConnectionId: 0x1
> > Number of credits: 326 Dialect 0x311
> > TCP status: 1 Instance: 1
> > Local Users To Server: 1 SecMode: 0x1 Req On Wire: 0
> > In Send: 0 In MaxReq Wait: 0
> >
> > Sessions:
> > 1) Name: 10.229.158.38 Uses: 1 Capability: 0x300077 Session Status: 1
> >                       ^^^^
> > Isn't this name (or hostname) a property of the connection? I would
> > expect an IP or a hostname to be printed in the connection settings
> > above.
>
> The servername is a property of the session, in this case since the
> mount specified a dotted quad, it would correctly appear as the
> servername at this level.
>
> However, I definitely agree that an IP address is important in the
> per-connection (channel) stanzas. Multichannel, multihoming, witness
> redirects, and any number of things can vary among them. It would
> be useful indeed to display them.
>
> Including the transport type (TCP, RDMA...) and multichannel attributes
> (link speed, RSS count, ...) would be useful too.
>
> Tom.
>
> >
> > --
> > Best regards,
> > Pavel Shilovsky
> >
> > чт, 11 февр. 2021 г. в 06:24, Aurélien Aptel <aaptel@suse.com>:
> >>
> >> Shyam Prasad N <nspmangalore@gmail.com> writes:
> >>> I noticed that the output looks rather odd when used with multichannel.
> >>> Attaching a revised patch with the changes.
> >>>
> >>> Also attached a sample of new output.
> >>
> >> Reviewed-by: Aurelien Aptel <aaptel@suse.com>
> >>
> >> --
> >> Aurélien Aptel / SUSE Labs Samba Team
> >> GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
> >> SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
> >> GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
> >>
> >



-- 
Regards,
Shyam

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

* Re: [PATCH 4/4] cifs: Reformat DebugData and index connections by conn_id.
  2021-02-16 12:29                     ` Shyam Prasad N
@ 2021-02-16 19:56                       ` Steve French
  2021-02-16 20:48                         ` Tom Talpey
  2021-02-16 22:30                       ` Steve French
  1 sibling, 1 reply; 16+ messages in thread
From: Steve French @ 2021-02-16 19:56 UTC (permalink / raw)
  To: Shyam Prasad N
  Cc: Tom Talpey, Pavel Shilovsky, Aurélien Aptel, CIFS, ronnie sahlberg

On Tue, Feb 16, 2021 at 6:29 AM Shyam Prasad N <nspmangalore@gmail.com> wrote:
>
> Hi Pavel,
>
> Thanks for the review.
> As Tom pointed out, the server name is currently a field in
> TCP_Session_Info struct.
> We do store the struct sockaddr_storage, which I'm guessing holds the
> IP address in binary format, and we could use that. And may need to
> consider IPv4 vs IPv6 when we do it.
> I'll submit that as a new patch later on.
>
> Hi Tom,
>
> > Including the transport type (TCP, RDMA...) and multichannel attributes
> > (link speed, RSS count, ...) would be useful too.
> Can you please clarify this for me?
> From what I can see from the code, RDMA connection DebugData is a
> superset of TCP connection. The RDMA specific details get printed only
> when server->rdma is set.
>
> Regards,
> Shyam
>
> On Thu, Feb 11, 2021 at 11:41 AM Tom Talpey <tom@talpey.com> wrote:
> >
> > On 2/11/2021 12:12 PM, Pavel Shilovsky wrote:
> > > Hi Shyam,
> > >
> > > The output looks very informative! I have one comment:
> > >
> > > Servers:
> > > 1) ConnectionId: 0x1
> > > Number of credits: 326 Dialect 0x311
> > > TCP status: 1 Instance: 1
> > > Local Users To Server: 1 SecMode: 0x1 Req On Wire: 0
> > > In Send: 0 In MaxReq Wait: 0
> > >
> > > Sessions:
> > > 1) Name: 10.229.158.38 Uses: 1 Capability: 0x300077 Session Status: 1
> > >                       ^^^^
> > > Isn't this name (or hostname) a property of the connection? I would
> > > expect an IP or a hostname to be printed in the connection settings
> > > above.
> >
> > The servername is a property of the session, in this case since the
> > mount specified a dotted quad, it would correctly appear as the
> > servername at this level.
> >
> > However, I definitely agree that an IP address is important in the
> > per-connection (channel) stanzas. Multichannel, multihoming, witness
> > redirects, and any number of things can vary among them. It would
> > be useful indeed to display them.
> >
> > Including the transport type (TCP, RDMA...) and multichannel attributes
> > (link speed, RSS count, ...) would be useful too.

It does show whether interface supports RSS or RDMA in the channel
list for every session
(and whether that interface is 'CONNECTED' for that session).  See
below example from his
sample /proc/fs/cifs/DebugData output (although this part did not
change with his patch)

4) Speed: 1000000000 bps
Capabilities: rss
IPv4: 10.229.158.38
[CONNECTED]


Thanks,

Steve

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

* Re: [PATCH 4/4] cifs: Reformat DebugData and index connections by conn_id.
  2021-02-11 17:12                 ` Pavel Shilovsky
  2021-02-11 19:41                   ` Tom Talpey
@ 2021-02-16 20:18                   ` Steve French
  1 sibling, 0 replies; 16+ messages in thread
From: Steve French @ 2021-02-16 20:18 UTC (permalink / raw)
  To: Pavel Shilovsky
  Cc: Aurélien Aptel, Shyam Prasad N, CIFS, ronnie sahlberg

On Thu, Feb 11, 2021 at 11:12 AM Pavel Shilovsky <piastryyy@gmail.com> wrote:
>
> Hi Shyam,
>
> The output looks very informative! I have one comment:
>
> Servers:
> 1) ConnectionId: 0x1
> Number of credits: 326 Dialect 0x311
> TCP status: 1 Instance: 1
> Local Users To Server: 1 SecMode: 0x1 Req On Wire: 0
> In Send: 0 In MaxReq Wait: 0
>
> Sessions:
> 1) Name: 10.229.158.38 Uses: 1 Capability: 0x300077 Session Status: 1
>                      ^^^^
> Isn't this name (or hostname) a property of the connection? I would
> expect an IP or a hostname to be printed in the connection settings
> above.

The "Name:" (actually the IPv4 or IPv6 address, not the name) is from
ses->serverName not from the connection (tcp socket).  We should
probably change from "Name" to "Address" or equivalent in
/proc/fs/cifs/DebugData

See fs/cifs/connect.c lines 1841 and 1843

The "name" field could be added to the /proc/fs/cifs/DebugData output
for the TCP_Server_Info struct by e.g. dumping the "hostname" and/or
"server_RFC1001_name" fields.


-- 
Thanks,

Steve

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

* Re: [PATCH 4/4] cifs: Reformat DebugData and index connections by conn_id.
  2021-02-16 19:56                       ` Steve French
@ 2021-02-16 20:48                         ` Tom Talpey
  0 siblings, 0 replies; 16+ messages in thread
From: Tom Talpey @ 2021-02-16 20:48 UTC (permalink / raw)
  To: Steve French, Shyam Prasad N
  Cc: Pavel Shilovsky, Aurélien Aptel, CIFS, ronnie sahlberg

On 2/16/2021 2:56 PM, Steve French wrote:
> On Tue, Feb 16, 2021 at 6:29 AM Shyam Prasad N <nspmangalore@gmail.com> wrote:
>>
>> Hi Pavel,
>>
>> Thanks for the review.
>> As Tom pointed out, the server name is currently a field in
>> TCP_Session_Info struct.
>> We do store the struct sockaddr_storage, which I'm guessing holds the
>> IP address in binary format, and we could use that. And may need to
>> consider IPv4 vs IPv6 when we do it.
>> I'll submit that as a new patch later on.
>>
>> Hi Tom,
>>
>>> Including the transport type (TCP, RDMA...) and multichannel attributes
>>> (link speed, RSS count, ...) would be useful too.
>> Can you please clarify this for me?
>>  From what I can see from the code, RDMA connection DebugData is a
>> superset of TCP connection. The RDMA specific details get printed only
>> when server->rdma is set.

I would hope that the client would walk its list of connections and
report the local attributes such as source+destination addresses and
ports, along with the transport such as whether it's a TCP or RDMA
connection.

Here, for example (from your patch):

...cifs_dump_channel(struct seq_file *m, int i, struct cifs_chan *chan)
...
+	seq_printf(m, "\n\n\t\tChannel: %d ConnectionId: 0x%llx"
+		   "\n\t\tNumber of credits: %d Dialect 0x%x"
+		   "\n\t\tTCP status: %d Instance: %d"
+		   "\n\t\tLocal Users To Server: %d SecMode: 0x%x Req On Wire: %d"
+		   "\n\t\tIn Send: %d In MaxReq Wait: %d",
+		   i+1, server->conn_id,

I'd strongly suggest digging into the cifs->chan  and adding at least
some of the connection data.

In the second hunk, I believe that's only invoked if CONFIG_CIFS_SMB_DIRECT
is configured, and it doesn't have any of the actual connection
information either, although it does dump the rdma flag.

Bottom line, it seems to me that a more complete picture of
the endpoints would help a lot, especially when multichannel
allows multiple sockets, NICs, and protocols to be involved.

>> Regards,
>> Shyam
>>
>> On Thu, Feb 11, 2021 at 11:41 AM Tom Talpey <tom@talpey.com> wrote:
>>>
>>> On 2/11/2021 12:12 PM, Pavel Shilovsky wrote:
>>>> Hi Shyam,
>>>>
>>>> The output looks very informative! I have one comment:
>>>>
>>>> Servers:
>>>> 1) ConnectionId: 0x1
>>>> Number of credits: 326 Dialect 0x311
>>>> TCP status: 1 Instance: 1
>>>> Local Users To Server: 1 SecMode: 0x1 Req On Wire: 0
>>>> In Send: 0 In MaxReq Wait: 0
>>>>
>>>> Sessions:
>>>> 1) Name: 10.229.158.38 Uses: 1 Capability: 0x300077 Session Status: 1
>>>>                        ^^^^
>>>> Isn't this name (or hostname) a property of the connection? I would
>>>> expect an IP or a hostname to be printed in the connection settings
>>>> above.
>>>
>>> The servername is a property of the session, in this case since the
>>> mount specified a dotted quad, it would correctly appear as the
>>> servername at this level.
>>>
>>> However, I definitely agree that an IP address is important in the
>>> per-connection (channel) stanzas. Multichannel, multihoming, witness
>>> redirects, and any number of things can vary among them. It would
>>> be useful indeed to display them.
>>>
>>> Including the transport type (TCP, RDMA...) and multichannel attributes
>>> (link speed, RSS count, ...) would be useful too.
> 
> It does show whether interface supports RSS or RDMA in the channel
> list for every session
> (and whether that interface is 'CONNECTED' for that session).  See
> below example from his
> sample /proc/fs/cifs/DebugData output (although this part did not
> change with his patch)
> 
> 4) Speed: 1000000000 bps
> Capabilities: rss
> IPv4: 10.229.158.38
> [CONNECTED]

Steve, I believe this list is just the server's response to the
multichannel FSCTL_QUERY_NETWORK_INTERFACE_INFO, which is an
enumeration of *available* server-side interfaces? This is useful,
but isn't helpful to determine which interfaces the client session
is actually using to each one, and from what client NIC ports,
protocols, etc. All it gives is a "CONNECTED" indication to a
single server port. To figure anything else out means groveling
through netstat and guessing at port 445's.

Tom.

> 
> Thanks,
> 
> Steve
> 

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

* Re: [PATCH 4/4] cifs: Reformat DebugData and index connections by conn_id.
  2021-02-16 12:29                     ` Shyam Prasad N
  2021-02-16 19:56                       ` Steve French
@ 2021-02-16 22:30                       ` Steve French
  1 sibling, 0 replies; 16+ messages in thread
From: Steve French @ 2021-02-16 22:30 UTC (permalink / raw)
  To: Shyam Prasad N
  Cc: Tom Talpey, Pavel Shilovsky, Aurélien Aptel, CIFS, ronnie sahlberg

[-- Attachment #1: Type: text/plain, Size: 3226 bytes --]

I updated the patch (converting a few places that should be calling
seq_puts instead of seq_printf - see attached) but will also send a
followon to the list to see if we clean the /proc/fs/cifs/DebugData a
little more.

On Tue, Feb 16, 2021 at 6:29 AM Shyam Prasad N <nspmangalore@gmail.com> wrote:
>
> Hi Pavel,
>
> Thanks for the review.
> As Tom pointed out, the server name is currently a field in
> TCP_Session_Info struct.
> We do store the struct sockaddr_storage, which I'm guessing holds the
> IP address in binary format, and we could use that. And may need to
> consider IPv4 vs IPv6 when we do it.
> I'll submit that as a new patch later on.
>
> Hi Tom,
>
> > Including the transport type (TCP, RDMA...) and multichannel attributes
> > (link speed, RSS count, ...) would be useful too.
> Can you please clarify this for me?
> From what I can see from the code, RDMA connection DebugData is a
> superset of TCP connection. The RDMA specific details get printed only
> when server->rdma is set.
>
> Regards,
> Shyam
>
> On Thu, Feb 11, 2021 at 11:41 AM Tom Talpey <tom@talpey.com> wrote:
> >
> > On 2/11/2021 12:12 PM, Pavel Shilovsky wrote:
> > > Hi Shyam,
> > >
> > > The output looks very informative! I have one comment:
> > >
> > > Servers:
> > > 1) ConnectionId: 0x1
> > > Number of credits: 326 Dialect 0x311
> > > TCP status: 1 Instance: 1
> > > Local Users To Server: 1 SecMode: 0x1 Req On Wire: 0
> > > In Send: 0 In MaxReq Wait: 0
> > >
> > > Sessions:
> > > 1) Name: 10.229.158.38 Uses: 1 Capability: 0x300077 Session Status: 1
> > >                       ^^^^
> > > Isn't this name (or hostname) a property of the connection? I would
> > > expect an IP or a hostname to be printed in the connection settings
> > > above.
> >
> > The servername is a property of the session, in this case since the
> > mount specified a dotted quad, it would correctly appear as the
> > servername at this level.
> >
> > However, I definitely agree that an IP address is important in the
> > per-connection (channel) stanzas. Multichannel, multihoming, witness
> > redirects, and any number of things can vary among them. It would
> > be useful indeed to display them.
> >
> > Including the transport type (TCP, RDMA...) and multichannel attributes
> > (link speed, RSS count, ...) would be useful too.
> >
> > Tom.
> >
> > >
> > > --
> > > Best regards,
> > > Pavel Shilovsky
> > >
> > > чт, 11 февр. 2021 г. в 06:24, Aurélien Aptel <aaptel@suse.com>:
> > >>
> > >> Shyam Prasad N <nspmangalore@gmail.com> writes:
> > >>> I noticed that the output looks rather odd when used with multichannel.
> > >>> Attaching a revised patch with the changes.
> > >>>
> > >>> Also attached a sample of new output.
> > >>
> > >> Reviewed-by: Aurelien Aptel <aaptel@suse.com>
> > >>
> > >> --
> > >> Aurélien Aptel / SUSE Labs Samba Team
> > >> GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
> > >> SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
> > >> GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
> > >>
> > >
>
>
>
> --
> Regards,
> Shyam



-- 
Thanks,

Steve

[-- Attachment #2: 0001-cifs-Reformat-DebugData-and-index-connections-by-con.patch --]
[-- Type: text/x-patch, Size: 9304 bytes --]

From 03e9bb1a0b403c29d5e8679be68addc230472390 Mon Sep 17 00:00:00 2001
From: Shyam Prasad N <sprasad@microsoft.com>
Date: Wed, 3 Feb 2021 23:27:52 -0800
Subject: [PATCH] cifs: Reformat DebugData and index connections by conn_id.

Reformat the output of /proc/fs/cifs/DebugData to print the
conn_id for each connection. Also reordered and numbered the data
into a more reader-friendly format.

This is what the new format looks like:
$ cat /proc/fs/cifs/DebugData
Display Internal CIFS Data Structures for Debugging
---------------------------------------------------
CIFS Version 2.30
Features: DFS,FSCACHE,STATS,DEBUG,ALLOW_INSECURE_LEGACY,WEAK_PW_HASH,CIFS_POSIX,UPCALL(SPNEGO),XATTR,ACL
CIFSMaxBufSize: 16384
Active VFS Requests: 0

Servers:
1) ConnectionId: 0x1
Number of credits: 371 Dialect 0x300
TCP status: 1 Instance: 1
Local Users To Server: 1 SecMode: 0x1 Req On Wire: 0 In Send: 0 In MaxReq Wait: 0

        Sessions:
        1) Name: 10.10.10.10 Uses: 1 Capability: 0x300077     Session Status: 1
        Security type: RawNTLMSSP  SessionId: 0x785560000019
        User: 1000 Cred User: 0

        Shares:
        0) IPC: \\10.10.10.10\IPC$ Mounts: 1 DevInfo: 0x0 Attributes: 0x0
        PathComponentMax: 0 Status: 1 type: 0 Serial Number: 0x0
        Share Capabilities: None        Share Flags: 0x30
        tid: 0x1        Maximal Access: 0x11f01ff

        1) \\10.10.10.10\shyam_test2 Mounts: 1 DevInfo: 0x20020 Attributes: 0xc706ff
        PathComponentMax: 255 Status: 1 type: DISK Serial Number: 0xd4723975
        Share Capabilities: None Aligned, Partition Aligned,    Share Flags: 0x0
        tid: 0x5        Optimal sector size: 0x1000     Maximal Access: 0x1f01ff

        MIDs:

        Server interfaces: 3
        1)      Speed: 10000000000 bps
                Capabilities: rss
                IPv4: 10.10.10.1

        2)      Speed: 10000000000 bps
                Capabilities: rss
                IPv6: fe80:0000:0000:0000:18b4:0000:0000:0000

        3)      Speed: 1000000000 bps
                Capabilities: rss
                IPv4: 10.10.10.10
                [CONNECTED]

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/cifs_debug.c | 117 +++++++++++++++++++++++++------------------
 1 file changed, 68 insertions(+), 49 deletions(-)

diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index b231dcf1d1f9..370cc88a3d02 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -133,11 +133,12 @@ cifs_dump_channel(struct seq_file *m, int i, struct cifs_chan *chan)
 {
 	struct TCP_Server_Info *server = chan->server;
 
-	seq_printf(m, "\t\tChannel %d Number of credits: %d Dialect 0x%x "
-		   "TCP status: %d Instance: %d Local Users To Server: %d "
-		   "SecMode: 0x%x Req On Wire: %d In Send: %d "
-		   "In MaxReq Wait: %d\n",
-		   i+1,
+	seq_printf(m, "\n\n\t\tChannel: %d ConnectionId: 0x%llx"
+		   "\n\t\tNumber of credits: %d Dialect 0x%x"
+		   "\n\t\tTCP status: %d Instance: %d"
+		   "\n\t\tLocal Users To Server: %d SecMode: 0x%x Req On Wire: %d"
+		   "\n\t\tIn Send: %d In MaxReq Wait: %d",
+		   i+1, server->conn_id,
 		   server->credits,
 		   server->dialect,
 		   server->tcpStatus,
@@ -227,7 +228,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 	struct TCP_Server_Info *server;
 	struct cifs_ses *ses;
 	struct cifs_tcon *tcon;
-	int i, j;
+	int c, i, j;
 
 	seq_puts(m,
 		    "Display Internal CIFS Data Structures for Debugging\n"
@@ -275,14 +276,23 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 	seq_putc(m, '\n');
 	seq_printf(m, "CIFSMaxBufSize: %d\n", CIFSMaxBufSize);
 	seq_printf(m, "Active VFS Requests: %d\n", GlobalTotalActiveXid);
-	seq_printf(m, "Servers:");
 
-	i = 0;
+	seq_printf(m, "\nServers: ");
+
+	c = 0;
 	spin_lock(&cifs_tcp_ses_lock);
 	list_for_each(tmp1, &cifs_tcp_ses_list) {
 		server = list_entry(tmp1, struct TCP_Server_Info,
 				    tcp_ses_list);
 
+		/* channel info will be printed as a part of sessions below */
+		if (server->is_channel)
+			continue;
+
+		c++;
+		seq_printf(m, "\n%d) ConnectionId: 0x%llx ",
+			c, server->conn_id);
+
 #ifdef CONFIG_CIFS_SMB_DIRECT
 		if (!server->rdma)
 			goto skip_rdma;
@@ -362,46 +372,48 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 		if (server->posix_ext_supported)
 			seq_printf(m, " posix");
 
-		i++;
+		if (server->rdma)
+			seq_printf(m, "\nRDMA ");
+		seq_printf(m, "\nTCP status: %d Instance: %d"
+				"\nLocal Users To Server: %d SecMode: 0x%x Req On Wire: %d",
+				server->tcpStatus,
+				server->reconnect_instance,
+				server->srv_count,
+				server->sec_mode, in_flight(server));
+
+		seq_printf(m, "\nIn Send: %d In MaxReq Wait: %d",
+				atomic_read(&server->in_send),
+				atomic_read(&server->num_waiters));
+
+		seq_printf(m, "\n\n\tSessions: ");
+		i = 0;
 		list_for_each(tmp2, &server->smb_ses_list) {
 			ses = list_entry(tmp2, struct cifs_ses,
 					 smb_ses_list);
+			i++;
 			if ((ses->serverDomain == NULL) ||
 				(ses->serverOS == NULL) ||
 				(ses->serverNOS == NULL)) {
-				seq_printf(m, "\n%d) Name: %s Uses: %d Capability: 0x%x\tSession Status: %d ",
+				seq_printf(m, "\n\t%d) Name: %s Uses: %d Capability: 0x%x\tSession Status: %d ",
 					i, ses->serverName, ses->ses_count,
 					ses->capabilities, ses->status);
 				if (ses->session_flags & SMB2_SESSION_FLAG_IS_GUEST)
-					seq_printf(m, "Guest\t");
+					seq_printf(m, "Guest ");
 				else if (ses->session_flags & SMB2_SESSION_FLAG_IS_NULL)
-					seq_printf(m, "Anonymous\t");
+					seq_printf(m, "Anonymous ");
 			} else {
 				seq_printf(m,
-				    "\n%d) Name: %s  Domain: %s Uses: %d OS:"
-				    " %s\n\tNOS: %s\tCapability: 0x%x\n\tSMB"
-				    " session status: %d ",
+				    "\n\t%d) Name: %s  Domain: %s Uses: %d OS: %s "
+				    "\n\tNOS: %s\tCapability: 0x%x"
+					"\n\tSMB session status: %d ",
 				i, ses->serverName, ses->serverDomain,
 				ses->ses_count, ses->serverOS, ses->serverNOS,
 				ses->capabilities, ses->status);
 			}
 
-			seq_printf(m,"Security type: %s\n",
+			seq_printf(m, "\n\tSecurity type: %s ",
 				get_security_type_str(server->ops->select_sectype(server, ses->sectype)));
 
-			if (server->rdma)
-				seq_printf(m, "RDMA\n\t");
-			seq_printf(m, "TCP status: %d Instance: %d\n\tLocal Users To "
-				   "Server: %d SecMode: 0x%x Req On Wire: %d",
-				   server->tcpStatus,
-				   server->reconnect_instance,
-				   server->srv_count,
-				   server->sec_mode, in_flight(server));
-
-			seq_printf(m, " In Send: %d In MaxReq Wait: %d",
-				atomic_read(&server->in_send),
-				atomic_read(&server->num_waiters));
-
 			/* dump session id helpful for use with network trace */
 			seq_printf(m, " SessionId: 0x%llx", ses->Suid);
 			if (ses->session_flags & SMB2_SESSION_FLAG_ENCRYPT_DATA)
@@ -414,13 +426,13 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 				   from_kuid(&init_user_ns, ses->cred_uid));
 
 			if (ses->chan_count > 1) {
-				seq_printf(m, "\n\n\tExtra Channels: %zu\n",
+				seq_printf(m, "\n\n\tExtra Channels: %zu ",
 					   ses->chan_count-1);
 				for (j = 1; j < ses->chan_count; j++)
 					cifs_dump_channel(m, j, &ses->chans[j]);
 			}
 
-			seq_puts(m, "\n\n\tShares:");
+			seq_puts(m, "\n\n\tShares: ");
 			j = 0;
 
 			seq_printf(m, "\n\t%d) IPC: ", j);
@@ -437,38 +449,45 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 				cifs_debug_tcon(m, tcon);
 			}
 
-			seq_puts(m, "\n\tMIDs:\n");
-
-			spin_lock(&GlobalMid_Lock);
-			list_for_each(tmp3, &server->pending_mid_q) {
-				mid_entry = list_entry(tmp3, struct mid_q_entry,
-					qhead);
-				seq_printf(m, "\tState: %d com: %d pid:"
-					      " %d cbdata: %p mid %llu\n",
-					      mid_entry->mid_state,
-					      le16_to_cpu(mid_entry->command),
-					      mid_entry->pid,
-					      mid_entry->callback_data,
-					      mid_entry->mid);
-			}
-			spin_unlock(&GlobalMid_Lock);
-
 			spin_lock(&ses->iface_lock);
 			if (ses->iface_count)
-				seq_printf(m, "\n\tServer interfaces: %zu\n",
+				seq_printf(m, "\n\n\tServer interfaces: %zu",
 					   ses->iface_count);
 			for (j = 0; j < ses->iface_count; j++) {
 				struct cifs_server_iface *iface;
 
 				iface = &ses->iface_list[j];
-				seq_printf(m, "\t%d)", j);
+				seq_printf(m, "\n\t%d)", j+1);
 				cifs_dump_iface(m, iface);
 				if (is_ses_using_iface(ses, iface))
 					seq_puts(m, "\t\t[CONNECTED]\n");
 			}
+			if (j == 0)
+				seq_printf(m, "\n\t[NONE]");
 			spin_unlock(&ses->iface_lock);
 		}
+		if (i == 0)
+			seq_printf(m, "\n\t\t[NONE]");
+
+		seq_puts(m, "\n\n\tMIDs: ");
+		spin_lock(&GlobalMid_Lock);
+		list_for_each(tmp3, &server->pending_mid_q) {
+			mid_entry = list_entry(tmp3, struct mid_q_entry,
+					qhead);
+			seq_printf(m, "\n\tState: %d com: %d pid:"
+					" %d cbdata: %p mid %llu\n",
+					mid_entry->mid_state,
+					le16_to_cpu(mid_entry->command),
+					mid_entry->pid,
+					mid_entry->callback_data,
+					mid_entry->mid);
+		}
+		spin_unlock(&GlobalMid_Lock);
+		seq_printf(m, "\n--\n");
 	}
+	if (c == 0)
+		seq_printf(m, "\n\t[NONE]");
+
 	spin_unlock(&cifs_tcp_ses_lock);
 	seq_putc(m, '\n');
 
-- 
2.27.0


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

end of thread, other threads:[~2021-02-16 22:32 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04  8:11 [PATCH 4/4] cifs: Reformat DebugData and index connections by conn_id Shyam Prasad N
2021-02-04 10:17 ` Aurélien Aptel
2021-02-04 12:03   ` Shyam Prasad N
2021-02-04 14:45     ` Aurélien Aptel
2021-02-07  4:14       ` Shyam Prasad N
2021-02-07  4:22         ` Steve French
2021-02-08 11:36           ` Aurélien Aptel
2021-02-11 13:13             ` Shyam Prasad N
2021-02-11 14:24               ` Aurélien Aptel
2021-02-11 17:12                 ` Pavel Shilovsky
2021-02-11 19:41                   ` Tom Talpey
2021-02-16 12:29                     ` Shyam Prasad N
2021-02-16 19:56                       ` Steve French
2021-02-16 20:48                         ` Tom Talpey
2021-02-16 22:30                       ` Steve French
2021-02-16 20:18                   ` Steve French

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.