Merge tag '5.12-smb3-part1' of git://git.samba.org/sfrench/cifs-2.6
[platform/kernel/linux-starfive.git] / fs / cifs / cifs_debug.c
index aa697cc..3aedc48 100644 (file)
@@ -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,25 @@ 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);
+
+               if (server->hostname)
+                       seq_printf(m, "Hostname: %s ", server->hostname);
 #ifdef CONFIG_CIFS_SMB_DIRECT
                if (!server->rdma)
                        goto skip_rdma;
@@ -362,46 +374,48 @@ skip_rdma:
                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 ",
-                                       i, ses->serverName, ses->ses_count,
+                               seq_printf(m, "\n\t%d) Address: %s Uses: %d Capability: 0x%x\tSession Status: %d ",
+                                       i, ses->ip_addr, 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 ",
-                               i, ses->serverName, ses->serverDomain,
+                                   "\n\t%d) Name: %s  Domain: %s Uses: %d OS: %s "
+                                   "\n\tNOS: %s\tCapability: 0x%x"
+                                       "\n\tSMB session status: %d ",
+                               i, ses->ip_addr, 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 +428,13 @@ skip_rdma:
                                   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 +451,43 @@ skip_rdma:
                                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");
                        }
                        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');