mirror of
https://github.com/torvalds/linux.git
synced 2025-08-16 06:31:34 +02:00
smb3 client: add way to show directory leases for improved debugging
When looking at performance issues around directory caching, or debugging directory lease issues, it is helpful to be able to display the current directory leases (as we can e.g. or open files). Create pseudo-file /proc/fs/cifs/open_dirs that displays current directory leases. Here is sample output: cat /proc/fs/cifs/open_dirs Version:1 Format: <tree id> <sess id> <persistent fid> <path> Num entries: 3 0xce4c1c68 0x7176aa54 0xd95ef58e \dira valid file info, valid dirents 0xce4c1c68 0x7176aa54 0xd031e211 \dir5 valid file info, valid dirents 0xce4c1c68 0x7176aa54 0x96533a90 \dir1 valid file info Reviewed-by: Bharath SM <bharathsm@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
28f09823de
commit
844e5c0eb1
2 changed files with 53 additions and 1 deletions
|
@ -14,7 +14,6 @@ struct cached_dirent {
|
||||||
char *name;
|
char *name;
|
||||||
int namelen;
|
int namelen;
|
||||||
loff_t pos;
|
loff_t pos;
|
||||||
|
|
||||||
struct cifs_fattr fattr;
|
struct cifs_fattr fattr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "smbdirect.h"
|
#include "smbdirect.h"
|
||||||
#endif
|
#endif
|
||||||
#include "cifs_swn.h"
|
#include "cifs_swn.h"
|
||||||
|
#include "cached_dir.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
cifs_dump_mem(char *label, void *data, int length)
|
cifs_dump_mem(char *label, void *data, int length)
|
||||||
|
@ -280,6 +281,54 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int cifs_debug_dirs_proc_show(struct seq_file *m, void *v)
|
||||||
|
{
|
||||||
|
struct list_head *stmp, *tmp, *tmp1;
|
||||||
|
struct TCP_Server_Info *server;
|
||||||
|
struct cifs_ses *ses;
|
||||||
|
struct cifs_tcon *tcon;
|
||||||
|
struct cached_fids *cfids;
|
||||||
|
struct cached_fid *cfid;
|
||||||
|
LIST_HEAD(entry);
|
||||||
|
|
||||||
|
seq_puts(m, "# Version:1\n");
|
||||||
|
seq_puts(m, "# Format:\n");
|
||||||
|
seq_puts(m, "# <tree id> <sess id> <persistent fid> <path>\n");
|
||||||
|
|
||||||
|
spin_lock(&cifs_tcp_ses_lock);
|
||||||
|
list_for_each(stmp, &cifs_tcp_ses_list) {
|
||||||
|
server = list_entry(stmp, struct TCP_Server_Info,
|
||||||
|
tcp_ses_list);
|
||||||
|
list_for_each(tmp, &server->smb_ses_list) {
|
||||||
|
ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
|
||||||
|
list_for_each(tmp1, &ses->tcon_list) {
|
||||||
|
tcon = list_entry(tmp1, struct cifs_tcon, tcon_list);
|
||||||
|
cfids = tcon->cfids;
|
||||||
|
spin_lock(&cfids->cfid_list_lock); /* check lock ordering */
|
||||||
|
seq_printf(m, "Num entries: %d\n", cfids->num_entries);
|
||||||
|
list_for_each_entry(cfid, &cfids->entries, entry) {
|
||||||
|
seq_printf(m, "0x%x 0x%llx 0x%llx %s",
|
||||||
|
tcon->tid,
|
||||||
|
ses->Suid,
|
||||||
|
cfid->fid.persistent_fid,
|
||||||
|
cfid->path);
|
||||||
|
if (cfid->file_all_info_is_valid)
|
||||||
|
seq_printf(m, "\tvalid file info");
|
||||||
|
if (cfid->dirents.is_valid)
|
||||||
|
seq_printf(m, ", valid dirents");
|
||||||
|
seq_printf(m, "\n");
|
||||||
|
}
|
||||||
|
spin_unlock(&cfids->cfid_list_lock);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spin_unlock(&cifs_tcp_ses_lock);
|
||||||
|
seq_putc(m, '\n');
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static __always_inline const char *compression_alg_str(__le16 alg)
|
static __always_inline const char *compression_alg_str(__le16 alg)
|
||||||
{
|
{
|
||||||
switch (alg) {
|
switch (alg) {
|
||||||
|
@ -863,6 +912,9 @@ cifs_proc_init(void)
|
||||||
proc_create_single("open_files", 0400, proc_fs_cifs,
|
proc_create_single("open_files", 0400, proc_fs_cifs,
|
||||||
cifs_debug_files_proc_show);
|
cifs_debug_files_proc_show);
|
||||||
|
|
||||||
|
proc_create_single("open_dirs", 0400, proc_fs_cifs,
|
||||||
|
cifs_debug_dirs_proc_show);
|
||||||
|
|
||||||
proc_create("Stats", 0644, proc_fs_cifs, &cifs_stats_proc_ops);
|
proc_create("Stats", 0644, proc_fs_cifs, &cifs_stats_proc_ops);
|
||||||
proc_create("cifsFYI", 0644, proc_fs_cifs, &cifsFYI_proc_ops);
|
proc_create("cifsFYI", 0644, proc_fs_cifs, &cifsFYI_proc_ops);
|
||||||
proc_create("traceSMB", 0644, proc_fs_cifs, &traceSMB_proc_ops);
|
proc_create("traceSMB", 0644, proc_fs_cifs, &traceSMB_proc_ops);
|
||||||
|
@ -907,6 +959,7 @@ cifs_proc_clean(void)
|
||||||
|
|
||||||
remove_proc_entry("DebugData", proc_fs_cifs);
|
remove_proc_entry("DebugData", proc_fs_cifs);
|
||||||
remove_proc_entry("open_files", proc_fs_cifs);
|
remove_proc_entry("open_files", proc_fs_cifs);
|
||||||
|
remove_proc_entry("open_dirs", proc_fs_cifs);
|
||||||
remove_proc_entry("cifsFYI", proc_fs_cifs);
|
remove_proc_entry("cifsFYI", proc_fs_cifs);
|
||||||
remove_proc_entry("traceSMB", proc_fs_cifs);
|
remove_proc_entry("traceSMB", proc_fs_cifs);
|
||||||
remove_proc_entry("Stats", proc_fs_cifs);
|
remove_proc_entry("Stats", proc_fs_cifs);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue