]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
CIFS: dump IPC tcon in debug proc file
authorAurelien Aptel <aaptel@suse.com>
Fri, 9 Mar 2018 08:33:00 +0000 (09:33 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 14 Mar 2018 10:42:33 +0000 (11:42 +0100)
BugLink: http://bugs.launchpad.net/bugs/1747572
dump it as first share with an "IPC: " prefix.

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
(cherry picked from commit 02cf5905e35df7e08691b6becda167858486da9a)
Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
fs/cifs/cifs_debug.c

index 9727e1dcacd558a89e5fa0c206e82b6f0941a99c..ef75e958812371b1259496c69091c756f9d8fa7e 100644 (file)
@@ -107,6 +107,32 @@ void cifs_dump_mids(struct TCP_Server_Info *server)
 }
 
 #ifdef CONFIG_PROC_FS
+static void cifs_debug_tcon(struct seq_file *m, struct cifs_tcon *tcon)
+{
+       __u32 dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType);
+
+       seq_printf(m, "%s Mounts: %d ", tcon->treeName, tcon->tc_count);
+       if (tcon->nativeFileSystem)
+               seq_printf(m, "Type: %s ", tcon->nativeFileSystem);
+       seq_printf(m, "DevInfo: 0x%x Attributes: 0x%x\n\tPathComponentMax: %d Status: %d",
+                  le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics),
+                  le32_to_cpu(tcon->fsAttrInfo.Attributes),
+                  le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength),
+                  tcon->tidStatus);
+       if (dev_type == FILE_DEVICE_DISK)
+               seq_puts(m, " type: DISK ");
+       else if (dev_type == FILE_DEVICE_CD_ROM)
+               seq_puts(m, " type: CDROM ");
+       else
+               seq_printf(m, " type: %d ", dev_type);
+       if (tcon->ses->server->ops->dump_share_caps)
+               tcon->ses->server->ops->dump_share_caps(m, tcon);
+
+       if (tcon->need_reconnect)
+               seq_puts(m, "\tDISCONNECTED ");
+       seq_putc(m, '\n');
+}
+
 static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 {
        struct list_head *tmp1, *tmp2, *tmp3;
@@ -115,7 +141,6 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
        struct cifs_ses *ses;
        struct cifs_tcon *tcon;
        int i, j;
-       __u32 dev_type;
 
        seq_puts(m,
                    "Display Internal CIFS Data Structures for Debugging\n"
@@ -184,35 +209,19 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 
                        seq_puts(m, "\n\tShares:");
                        j = 0;
+
+                       seq_printf(m, "\n\t%d) IPC: ", j);
+                       if (ses->tcon_ipc)
+                               cifs_debug_tcon(m, ses->tcon_ipc);
+                       else
+                               seq_puts(m, "none\n");
+
                        list_for_each(tmp3, &ses->tcon_list) {
                                tcon = list_entry(tmp3, struct cifs_tcon,
                                                  tcon_list);
                                ++j;
-                               dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType);
-                               seq_printf(m, "\n\t%d) %s Mounts: %d ", j,
-                                          tcon->treeName, tcon->tc_count);
-                               if (tcon->nativeFileSystem) {
-                                       seq_printf(m, "Type: %s ",
-                                                  tcon->nativeFileSystem);
-                               }
-                               seq_printf(m, "DevInfo: 0x%x Attributes: 0x%x"
-                                       "\n\tPathComponentMax: %d Status: %d",
-                                       le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics),
-                                       le32_to_cpu(tcon->fsAttrInfo.Attributes),
-                                       le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength),
-                                       tcon->tidStatus);
-                               if (dev_type == FILE_DEVICE_DISK)
-                                       seq_puts(m, " type: DISK ");
-                               else if (dev_type == FILE_DEVICE_CD_ROM)
-                                       seq_puts(m, " type: CDROM ");
-                               else
-                                       seq_printf(m, " type: %d ", dev_type);
-                               if (server->ops->dump_share_caps)
-                                       server->ops->dump_share_caps(m, tcon);
-
-                               if (tcon->need_reconnect)
-                                       seq_puts(m, "\tDISCONNECTED ");
-                               seq_putc(m, '\n');
+                               seq_printf(m, "\n\t%d) ", j);
+                               cifs_debug_tcon(m, tcon);
                        }
 
                        seq_puts(m, "\n\tMIDs:\n");