aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/cifs/cifs_debug.c56
-rw-r--r--fs/cifs/cifsglob.h3
-rw-r--r--fs/cifs/smb2ops.c3
-rw-r--r--fs/cifs/smb2pdu.c3
4 files changed, 65 insertions, 0 deletions
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 3e812428ac8d..ba178b09de0b 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -145,6 +145,58 @@ cifs_dump_iface(struct seq_file *m, struct cifs_server_iface *iface)
145 seq_printf(m, "\t\tIPv6: %pI6\n", &ipv6->sin6_addr); 145 seq_printf(m, "\t\tIPv6: %pI6\n", &ipv6->sin6_addr);
146} 146}
147 147
148static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
149{
150 struct list_head *stmp, *tmp, *tmp1, *tmp2;
151 struct TCP_Server_Info *server;
152 struct cifs_ses *ses;
153 struct cifs_tcon *tcon;
154 struct cifsFileInfo *cfile;
155
156 seq_puts(m, "# Version:1\n");
157 seq_puts(m, "# Format:\n");
158 seq_puts(m, "# <tree id> <persistent fid> <flags> <count> <pid> <uid>");
159#ifdef CONFIG_CIFS_DEBUG2
160 seq_printf(m, " <filename> <mid>\n");
161#else
162 seq_printf(m, " <filename>\n");
163#endif /* CIFS_DEBUG2 */
164 spin_lock(&cifs_tcp_ses_lock);
165 list_for_each(stmp, &cifs_tcp_ses_list) {
166 server = list_entry(stmp, struct TCP_Server_Info,
167 tcp_ses_list);
168 list_for_each(tmp, &server->smb_ses_list) {
169 ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
170 list_for_each(tmp1, &ses->tcon_list) {
171 tcon = list_entry(tmp1, struct cifs_tcon, tcon_list);
172 spin_lock(&tcon->open_file_lock);
173 list_for_each(tmp2, &tcon->openFileList) {
174 cfile = list_entry(tmp2, struct cifsFileInfo,
175 tlist);
176 seq_printf(m,
177 "0x%x 0x%llx 0x%x %d %d %d %s",
178 tcon->tid,
179 cfile->fid.persistent_fid,
180 cfile->f_flags,
181 cfile->count,
182 cfile->pid,
183 from_kuid(&init_user_ns, cfile->uid),
184 cfile->dentry->d_name.name);
185#ifdef CONFIG_CIFS_DEBUG2
186 seq_printf(m, " 0x%llx\n", cfile->fid.mid);
187#else
188 seq_printf(m, "\n");
189#endif /* CIFS_DEBUG2 */
190 }
191 spin_unlock(&tcon->open_file_lock);
192 }
193 }
194 }
195 spin_unlock(&cifs_tcp_ses_lock);
196 seq_putc(m, '\n');
197 return 0;
198}
199
148static int cifs_debug_data_proc_show(struct seq_file *m, void *v) 200static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
149{ 201{
150 struct list_head *tmp1, *tmp2, *tmp3; 202 struct list_head *tmp1, *tmp2, *tmp3;
@@ -565,6 +617,9 @@ cifs_proc_init(void)
565 proc_create_single("DebugData", 0, proc_fs_cifs, 617 proc_create_single("DebugData", 0, proc_fs_cifs,
566 cifs_debug_data_proc_show); 618 cifs_debug_data_proc_show);
567 619
620 proc_create_single("open_files", 0400, proc_fs_cifs,
621 cifs_debug_files_proc_show);
622
568 proc_create("Stats", 0644, proc_fs_cifs, &cifs_stats_proc_fops); 623 proc_create("Stats", 0644, proc_fs_cifs, &cifs_stats_proc_fops);
569 proc_create("cifsFYI", 0644, proc_fs_cifs, &cifsFYI_proc_fops); 624 proc_create("cifsFYI", 0644, proc_fs_cifs, &cifsFYI_proc_fops);
570 proc_create("traceSMB", 0644, proc_fs_cifs, &traceSMB_proc_fops); 625 proc_create("traceSMB", 0644, proc_fs_cifs, &traceSMB_proc_fops);
@@ -601,6 +656,7 @@ cifs_proc_clean(void)
601 return; 656 return;
602 657
603 remove_proc_entry("DebugData", proc_fs_cifs); 658 remove_proc_entry("DebugData", proc_fs_cifs);
659 remove_proc_entry("open_files", proc_fs_cifs);
604 remove_proc_entry("cifsFYI", proc_fs_cifs); 660 remove_proc_entry("cifsFYI", proc_fs_cifs);
605 remove_proc_entry("traceSMB", proc_fs_cifs); 661 remove_proc_entry("traceSMB", proc_fs_cifs);
606 remove_proc_entry("Stats", proc_fs_cifs); 662 remove_proc_entry("Stats", proc_fs_cifs);
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index ed1e0fcb69e3..d7c0443d47a4 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -1125,6 +1125,9 @@ struct cifs_fid {
1125 __u8 create_guid[16]; 1125 __u8 create_guid[16];
1126 struct cifs_pending_open *pending_open; 1126 struct cifs_pending_open *pending_open;
1127 unsigned int epoch; 1127 unsigned int epoch;
1128#ifdef CONFIG_CIFS_DEBUG2
1129 __u64 mid;
1130#endif /* CIFS_DEBUG2 */
1128 bool purge_cache; 1131 bool purge_cache;
1129}; 1132};
1130 1133
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 8489b5f706c3..225fec1cfa67 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -1079,6 +1079,9 @@ smb2_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock)
1079 1079
1080 cfile->fid.persistent_fid = fid->persistent_fid; 1080 cfile->fid.persistent_fid = fid->persistent_fid;
1081 cfile->fid.volatile_fid = fid->volatile_fid; 1081 cfile->fid.volatile_fid = fid->volatile_fid;
1082#ifdef CONFIG_CIFS_DEBUG2
1083 cfile->fid.mid = fid->mid;
1084#endif /* CIFS_DEBUG2 */
1082 server->ops->set_oplock_level(cinode, oplock, fid->epoch, 1085 server->ops->set_oplock_level(cinode, oplock, fid->epoch,
1083 &fid->purge_cache); 1086 &fid->purge_cache);
1084 cinode->can_cache_brlcks = CIFS_CACHE_WRITE(cinode); 1087 cinode->can_cache_brlcks = CIFS_CACHE_WRITE(cinode);
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index a92d3840db9d..27f86537a5d1 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2309,6 +2309,9 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
2309 atomic_inc(&tcon->num_remote_opens); 2309 atomic_inc(&tcon->num_remote_opens);
2310 oparms->fid->persistent_fid = rsp->PersistentFileId; 2310 oparms->fid->persistent_fid = rsp->PersistentFileId;
2311 oparms->fid->volatile_fid = rsp->VolatileFileId; 2311 oparms->fid->volatile_fid = rsp->VolatileFileId;
2312#ifdef CONFIG_CIFS_DEBUG2
2313 oparms->fid->mid = le64_to_cpu(rsp->sync_hdr.MessageId);
2314#endif /* CIFS_DEBUG2 */
2312 2315
2313 if (buf) { 2316 if (buf) {
2314 memcpy(buf, &rsp->CreationTime, 32); 2317 memcpy(buf, &rsp->CreationTime, 32);