aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifs_debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/cifs_debug.c')
-rw-r--r--fs/cifs/cifs_debug.c277
1 files changed, 149 insertions, 128 deletions
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 69a12aae91d3..490e34bbf27a 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -107,12 +107,13 @@ void cifs_dump_mids(struct TCP_Server_Info *server)
107#ifdef CONFIG_PROC_FS 107#ifdef CONFIG_PROC_FS
108static int cifs_debug_data_proc_show(struct seq_file *m, void *v) 108static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
109{ 109{
110 struct list_head *tmp; 110 struct list_head *tmp1, *tmp2, *tmp3;
111 struct list_head *tmp1;
112 struct mid_q_entry *mid_entry; 111 struct mid_q_entry *mid_entry;
112 struct TCP_Server_Info *server;
113 struct cifsSesInfo *ses; 113 struct cifsSesInfo *ses;
114 struct cifsTconInfo *tcon; 114 struct cifsTconInfo *tcon;
115 int i; 115 int i, j;
116 __u32 dev_type;
116 117
117 seq_puts(m, 118 seq_puts(m,
118 "Display Internal CIFS Data Structures for Debugging\n" 119 "Display Internal CIFS Data Structures for Debugging\n"
@@ -122,46 +123,78 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
122 seq_printf(m, "Servers:"); 123 seq_printf(m, "Servers:");
123 124
124 i = 0; 125 i = 0;
125 read_lock(&GlobalSMBSeslock); 126 read_lock(&cifs_tcp_ses_lock);
126 list_for_each(tmp, &GlobalSMBSessionList) { 127 list_for_each(tmp1, &cifs_tcp_ses_list) {
128 server = list_entry(tmp1, struct TCP_Server_Info,
129 tcp_ses_list);
127 i++; 130 i++;
128 ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList); 131 list_for_each(tmp2, &server->smb_ses_list) {
129 if ((ses->serverDomain == NULL) || (ses->serverOS == NULL) || 132 ses = list_entry(tmp2, struct cifsSesInfo,
130 (ses->serverNOS == NULL)) { 133 smb_ses_list);
131 seq_printf(m, "\nentry for %s not fully " 134 if ((ses->serverDomain == NULL) ||
132 "displayed\n\t", ses->serverName); 135 (ses->serverOS == NULL) ||
133 } else { 136 (ses->serverNOS == NULL)) {
134 seq_printf(m, 137 seq_printf(m, "\n%d) entry for %s not fully "
135 "\n%d) Name: %s Domain: %s Mounts: %d OS:" 138 "displayed\n\t", i, ses->serverName);
136 " %s \n\tNOS: %s\tCapability: 0x%x\n\tSMB" 139 } else {
140 seq_printf(m,
141 "\n%d) Name: %s Domain: %s Uses: %d OS:"
142 " %s\n\tNOS: %s\tCapability: 0x%x\n\tSMB"
137 " session status: %d\t", 143 " session status: %d\t",
138 i, ses->serverName, ses->serverDomain, 144 i, ses->serverName, ses->serverDomain,
139 atomic_read(&ses->inUse), 145 ses->ses_count, ses->serverOS, ses->serverNOS,
140 ses->serverOS, ses->serverNOS,
141 ses->capabilities, ses->status); 146 ses->capabilities, ses->status);
142 } 147 }
143 if (ses->server) {
144 seq_printf(m, "TCP status: %d\n\tLocal Users To " 148 seq_printf(m, "TCP status: %d\n\tLocal Users To "
145 "Server: %d SecMode: 0x%x Req On Wire: %d", 149 "Server: %d SecMode: 0x%x Req On Wire: %d",
146 ses->server->tcpStatus, 150 server->tcpStatus, server->srv_count,
147 atomic_read(&ses->server->socketUseCount), 151 server->secMode,
148 ses->server->secMode, 152 atomic_read(&server->inFlight));
149 atomic_read(&ses->server->inFlight));
150 153
151#ifdef CONFIG_CIFS_STATS2 154#ifdef CONFIG_CIFS_STATS2
152 seq_printf(m, " In Send: %d In MaxReq Wait: %d", 155 seq_printf(m, " In Send: %d In MaxReq Wait: %d",
153 atomic_read(&ses->server->inSend), 156 atomic_read(&server->inSend),
154 atomic_read(&ses->server->num_waiters)); 157 atomic_read(&server->num_waiters));
155#endif 158#endif
156 159
157 seq_puts(m, "\nMIDs:\n"); 160 seq_puts(m, "\n\tShares:");
161 j = 0;
162 list_for_each(tmp3, &ses->tcon_list) {
163 tcon = list_entry(tmp3, struct cifsTconInfo,
164 tcon_list);
165 ++j;
166 dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType);
167 seq_printf(m, "\n\t%d) %s Mounts: %d ", j,
168 tcon->treeName, tcon->tc_count);
169 if (tcon->nativeFileSystem) {
170 seq_printf(m, "Type: %s ",
171 tcon->nativeFileSystem);
172 }
173 seq_printf(m, "DevInfo: 0x%x Attributes: 0x%x"
174 "\nPathComponentMax: %d Status: 0x%d",
175 le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics),
176 le32_to_cpu(tcon->fsAttrInfo.Attributes),
177 le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength),
178 tcon->tidStatus);
179 if (dev_type == FILE_DEVICE_DISK)
180 seq_puts(m, " type: DISK ");
181 else if (dev_type == FILE_DEVICE_CD_ROM)
182 seq_puts(m, " type: CDROM ");
183 else
184 seq_printf(m, " type: %d ", dev_type);
185
186 if (tcon->need_reconnect)
187 seq_puts(m, "\tDISCONNECTED ");
188 seq_putc(m, '\n');
189 }
190
191 seq_puts(m, "\n\tMIDs:\n");
158 192
159 spin_lock(&GlobalMid_Lock); 193 spin_lock(&GlobalMid_Lock);
160 list_for_each(tmp1, &ses->server->pending_mid_q) { 194 list_for_each(tmp3, &server->pending_mid_q) {
161 mid_entry = list_entry(tmp1, struct 195 mid_entry = list_entry(tmp3, struct mid_q_entry,
162 mid_q_entry,
163 qhead); 196 qhead);
164 seq_printf(m, "State: %d com: %d pid:" 197 seq_printf(m, "\tState: %d com: %d pid:"
165 " %d tsk: %p mid %d\n", 198 " %d tsk: %p mid %d\n",
166 mid_entry->midState, 199 mid_entry->midState,
167 (int)mid_entry->command, 200 (int)mid_entry->command,
@@ -171,44 +204,8 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
171 } 204 }
172 spin_unlock(&GlobalMid_Lock); 205 spin_unlock(&GlobalMid_Lock);
173 } 206 }
174
175 }
176 read_unlock(&GlobalSMBSeslock);
177 seq_putc(m, '\n');
178
179 seq_puts(m, "Shares:");
180
181 i = 0;
182 read_lock(&GlobalSMBSeslock);
183 list_for_each(tmp, &GlobalTreeConnectionList) {
184 __u32 dev_type;
185 i++;
186 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
187 dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType);
188 seq_printf(m, "\n%d) %s Uses: %d ", i,
189 tcon->treeName, atomic_read(&tcon->useCount));
190 if (tcon->nativeFileSystem) {
191 seq_printf(m, "Type: %s ",
192 tcon->nativeFileSystem);
193 }
194 seq_printf(m, "DevInfo: 0x%x Attributes: 0x%x"
195 "\nPathComponentMax: %d Status: %d",
196 le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics),
197 le32_to_cpu(tcon->fsAttrInfo.Attributes),
198 le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength),
199 tcon->tidStatus);
200 if (dev_type == FILE_DEVICE_DISK)
201 seq_puts(m, " type: DISK ");
202 else if (dev_type == FILE_DEVICE_CD_ROM)
203 seq_puts(m, " type: CDROM ");
204 else
205 seq_printf(m, " type: %d ", dev_type);
206
207 if (tcon->tidStatus == CifsNeedReconnect)
208 seq_puts(m, "\tDISCONNECTED ");
209 } 207 }
210 read_unlock(&GlobalSMBSeslock); 208 read_unlock(&cifs_tcp_ses_lock);
211
212 seq_putc(m, '\n'); 209 seq_putc(m, '\n');
213 210
214 /* BB add code to dump additional info such as TCP session info now */ 211 /* BB add code to dump additional info such as TCP session info now */
@@ -234,7 +231,9 @@ static ssize_t cifs_stats_proc_write(struct file *file,
234{ 231{
235 char c; 232 char c;
236 int rc; 233 int rc;
237 struct list_head *tmp; 234 struct list_head *tmp1, *tmp2, *tmp3;
235 struct TCP_Server_Info *server;
236 struct cifsSesInfo *ses;
238 struct cifsTconInfo *tcon; 237 struct cifsTconInfo *tcon;
239 238
240 rc = get_user(c, buffer); 239 rc = get_user(c, buffer);
@@ -242,33 +241,42 @@ static ssize_t cifs_stats_proc_write(struct file *file,
242 return rc; 241 return rc;
243 242
244 if (c == '1' || c == 'y' || c == 'Y' || c == '0') { 243 if (c == '1' || c == 'y' || c == 'Y' || c == '0') {
245 read_lock(&GlobalSMBSeslock);
246#ifdef CONFIG_CIFS_STATS2 244#ifdef CONFIG_CIFS_STATS2
247 atomic_set(&totBufAllocCount, 0); 245 atomic_set(&totBufAllocCount, 0);
248 atomic_set(&totSmBufAllocCount, 0); 246 atomic_set(&totSmBufAllocCount, 0);
249#endif /* CONFIG_CIFS_STATS2 */ 247#endif /* CONFIG_CIFS_STATS2 */
250 list_for_each(tmp, &GlobalTreeConnectionList) { 248 read_lock(&cifs_tcp_ses_lock);
251 tcon = list_entry(tmp, struct cifsTconInfo, 249 list_for_each(tmp1, &cifs_tcp_ses_list) {
252 cifsConnectionList); 250 server = list_entry(tmp1, struct TCP_Server_Info,
253 atomic_set(&tcon->num_smbs_sent, 0); 251 tcp_ses_list);
254 atomic_set(&tcon->num_writes, 0); 252 list_for_each(tmp2, &server->smb_ses_list) {
255 atomic_set(&tcon->num_reads, 0); 253 ses = list_entry(tmp2, struct cifsSesInfo,
256 atomic_set(&tcon->num_oplock_brks, 0); 254 smb_ses_list);
257 atomic_set(&tcon->num_opens, 0); 255 list_for_each(tmp3, &ses->tcon_list) {
258 atomic_set(&tcon->num_closes, 0); 256 tcon = list_entry(tmp3,
259 atomic_set(&tcon->num_deletes, 0); 257 struct cifsTconInfo,
260 atomic_set(&tcon->num_mkdirs, 0); 258 tcon_list);
261 atomic_set(&tcon->num_rmdirs, 0); 259 atomic_set(&tcon->num_smbs_sent, 0);
262 atomic_set(&tcon->num_renames, 0); 260 atomic_set(&tcon->num_writes, 0);
263 atomic_set(&tcon->num_t2renames, 0); 261 atomic_set(&tcon->num_reads, 0);
264 atomic_set(&tcon->num_ffirst, 0); 262 atomic_set(&tcon->num_oplock_brks, 0);
265 atomic_set(&tcon->num_fnext, 0); 263 atomic_set(&tcon->num_opens, 0);
266 atomic_set(&tcon->num_fclose, 0); 264 atomic_set(&tcon->num_closes, 0);
267 atomic_set(&tcon->num_hardlinks, 0); 265 atomic_set(&tcon->num_deletes, 0);
268 atomic_set(&tcon->num_symlinks, 0); 266 atomic_set(&tcon->num_mkdirs, 0);
269 atomic_set(&tcon->num_locks, 0); 267 atomic_set(&tcon->num_rmdirs, 0);
268 atomic_set(&tcon->num_renames, 0);
269 atomic_set(&tcon->num_t2renames, 0);
270 atomic_set(&tcon->num_ffirst, 0);
271 atomic_set(&tcon->num_fnext, 0);
272 atomic_set(&tcon->num_fclose, 0);
273 atomic_set(&tcon->num_hardlinks, 0);
274 atomic_set(&tcon->num_symlinks, 0);
275 atomic_set(&tcon->num_locks, 0);
276 }
277 }
270 } 278 }
271 read_unlock(&GlobalSMBSeslock); 279 read_unlock(&cifs_tcp_ses_lock);
272 } 280 }
273 281
274 return count; 282 return count;
@@ -277,7 +285,9 @@ static ssize_t cifs_stats_proc_write(struct file *file,
277static int cifs_stats_proc_show(struct seq_file *m, void *v) 285static int cifs_stats_proc_show(struct seq_file *m, void *v)
278{ 286{
279 int i; 287 int i;
280 struct list_head *tmp; 288 struct list_head *tmp1, *tmp2, *tmp3;
289 struct TCP_Server_Info *server;
290 struct cifsSesInfo *ses;
281 struct cifsTconInfo *tcon; 291 struct cifsTconInfo *tcon;
282 292
283 seq_printf(m, 293 seq_printf(m,
@@ -306,44 +316,55 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
306 GlobalCurrentXid, GlobalMaxActiveXid); 316 GlobalCurrentXid, GlobalMaxActiveXid);
307 317
308 i = 0; 318 i = 0;
309 read_lock(&GlobalSMBSeslock); 319 read_lock(&cifs_tcp_ses_lock);
310 list_for_each(tmp, &GlobalTreeConnectionList) { 320 list_for_each(tmp1, &cifs_tcp_ses_list) {
311 i++; 321 server = list_entry(tmp1, struct TCP_Server_Info,
312 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); 322 tcp_ses_list);
313 seq_printf(m, "\n%d) %s", i, tcon->treeName); 323 list_for_each(tmp2, &server->smb_ses_list) {
314 if (tcon->tidStatus == CifsNeedReconnect) 324 ses = list_entry(tmp2, struct cifsSesInfo,
315 seq_puts(m, "\tDISCONNECTED "); 325 smb_ses_list);
316 seq_printf(m, "\nSMBs: %d Oplock Breaks: %d", 326 list_for_each(tmp3, &ses->tcon_list) {
317 atomic_read(&tcon->num_smbs_sent), 327 tcon = list_entry(tmp3,
318 atomic_read(&tcon->num_oplock_brks)); 328 struct cifsTconInfo,
319 seq_printf(m, "\nReads: %d Bytes: %lld", 329 tcon_list);
320 atomic_read(&tcon->num_reads), 330 i++;
321 (long long)(tcon->bytes_read)); 331 seq_printf(m, "\n%d) %s", i, tcon->treeName);
322 seq_printf(m, "\nWrites: %d Bytes: %lld", 332 if (tcon->need_reconnect)
323 atomic_read(&tcon->num_writes), 333 seq_puts(m, "\tDISCONNECTED ");
324 (long long)(tcon->bytes_written)); 334 seq_printf(m, "\nSMBs: %d Oplock Breaks: %d",
325 seq_printf(m, 335 atomic_read(&tcon->num_smbs_sent),
326 "\nLocks: %d HardLinks: %d Symlinks: %d", 336 atomic_read(&tcon->num_oplock_brks));
327 atomic_read(&tcon->num_locks), 337 seq_printf(m, "\nReads: %d Bytes: %lld",
328 atomic_read(&tcon->num_hardlinks), 338 atomic_read(&tcon->num_reads),
329 atomic_read(&tcon->num_symlinks)); 339 (long long)(tcon->bytes_read));
330 340 seq_printf(m, "\nWrites: %d Bytes: %lld",
331 seq_printf(m, "\nOpens: %d Closes: %d Deletes: %d", 341 atomic_read(&tcon->num_writes),
332 atomic_read(&tcon->num_opens), 342 (long long)(tcon->bytes_written));
333 atomic_read(&tcon->num_closes), 343 seq_printf(m, "\nLocks: %d HardLinks: %d "
334 atomic_read(&tcon->num_deletes)); 344 "Symlinks: %d",
335 seq_printf(m, "\nMkdirs: %d Rmdirs: %d", 345 atomic_read(&tcon->num_locks),
336 atomic_read(&tcon->num_mkdirs), 346 atomic_read(&tcon->num_hardlinks),
337 atomic_read(&tcon->num_rmdirs)); 347 atomic_read(&tcon->num_symlinks));
338 seq_printf(m, "\nRenames: %d T2 Renames %d", 348 seq_printf(m, "\nOpens: %d Closes: %d"
339 atomic_read(&tcon->num_renames), 349 "Deletes: %d",
340 atomic_read(&tcon->num_t2renames)); 350 atomic_read(&tcon->num_opens),
341 seq_printf(m, "\nFindFirst: %d FNext %d FClose %d", 351 atomic_read(&tcon->num_closes),
342 atomic_read(&tcon->num_ffirst), 352 atomic_read(&tcon->num_deletes));
343 atomic_read(&tcon->num_fnext), 353 seq_printf(m, "\nMkdirs: %d Rmdirs: %d",
344 atomic_read(&tcon->num_fclose)); 354 atomic_read(&tcon->num_mkdirs),
355 atomic_read(&tcon->num_rmdirs));
356 seq_printf(m, "\nRenames: %d T2 Renames %d",
357 atomic_read(&tcon->num_renames),
358 atomic_read(&tcon->num_t2renames));
359 seq_printf(m, "\nFindFirst: %d FNext %d "
360 "FClose %d",
361 atomic_read(&tcon->num_ffirst),
362 atomic_read(&tcon->num_fnext),
363 atomic_read(&tcon->num_fclose));
364 }
365 }
345 } 366 }
346 read_unlock(&GlobalSMBSeslock); 367 read_unlock(&cifs_tcp_ses_lock);
347 368
348 seq_putc(m, '\n'); 369 seq_putc(m, '\n');
349 return 0; 370 return 0;