aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorSteve French <smfrench@gmail.com>2013-06-19 15:15:30 -0400
committerSteve French <smfrench@gmail.com>2013-06-24 02:56:46 -0400
commit769ee6a4024434d1960acafd7adde38538bbe3da (patch)
tree6155f68bdfce210b203c2a8a93e99c48815c7f76 /fs/cifs
parent2b5dc286da3917435106da6431e8d06209b01953 (diff)
Add ability to dipslay SMB3 share flags and capabilities for debugging
SMB3 protocol adds various optional per-share capabilities (and SMB3.02 adds one more beyond that). Add ability to dump (/proc/fs/cifs/DebugData) the share capabilities and share flags to improve debugging. Signed-off-by: Steve French <smfrench@gmail.com> Acked-by: Jeff Layton <jlayton@redhat.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifs_debug.c4
-rw-r--r--fs/cifs/cifsglob.h3
-rw-r--r--fs/cifs/smb2ops.c20
-rw-r--r--fs/cifs/smb2pdu.c1
4 files changed, 26 insertions, 2 deletions
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 856f8f5fc295..0315824bbf01 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -213,7 +213,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
213 tcon->nativeFileSystem); 213 tcon->nativeFileSystem);
214 } 214 }
215 seq_printf(m, "DevInfo: 0x%x Attributes: 0x%x" 215 seq_printf(m, "DevInfo: 0x%x Attributes: 0x%x"
216 "\nPathComponentMax: %d Status: 0x%d", 216 "\n\tPathComponentMax: %d Status: 0x%d",
217 le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics), 217 le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics),
218 le32_to_cpu(tcon->fsAttrInfo.Attributes), 218 le32_to_cpu(tcon->fsAttrInfo.Attributes),
219 le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength), 219 le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength),
@@ -224,6 +224,8 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
224 seq_puts(m, " type: CDROM "); 224 seq_puts(m, " type: CDROM ");
225 else 225 else
226 seq_printf(m, " type: %d ", dev_type); 226 seq_printf(m, " type: %d ", dev_type);
227 if (server->ops->dump_share_caps)
228 server->ops->dump_share_caps(m, tcon);
227 229
228 if (tcon->need_reconnect) 230 if (tcon->need_reconnect)
229 seq_puts(m, "\tDISCONNECTED "); 231 seq_puts(m, "\tDISCONNECTED ");
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index f13cbbeaf098..9a1e37aad3b8 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -223,6 +223,7 @@ struct smb_version_operations {
223 void (*dump_detail)(void *); 223 void (*dump_detail)(void *);
224 void (*clear_stats)(struct cifs_tcon *); 224 void (*clear_stats)(struct cifs_tcon *);
225 void (*print_stats)(struct seq_file *m, struct cifs_tcon *); 225 void (*print_stats)(struct seq_file *m, struct cifs_tcon *);
226 void (*dump_share_caps)(struct seq_file *, struct cifs_tcon *);
226 /* verify the message */ 227 /* verify the message */
227 int (*check_message)(char *, unsigned int); 228 int (*check_message)(char *, unsigned int);
228 bool (*is_oplock_break)(char *, struct TCP_Server_Info *); 229 bool (*is_oplock_break)(char *, struct TCP_Server_Info *);
@@ -809,7 +810,7 @@ struct cifs_tcon {
809#ifdef CONFIG_CIFS_SMB2 810#ifdef CONFIG_CIFS_SMB2
810 bool print:1; /* set if connection to printer share */ 811 bool print:1; /* set if connection to printer share */
811 bool bad_network_name:1; /* set if ret status STATUS_BAD_NETWORK_NAME */ 812 bool bad_network_name:1; /* set if ret status STATUS_BAD_NETWORK_NAME */
812 __u32 capabilities; 813 __le32 capabilities;
813 __u32 share_flags; 814 __u32 share_flags;
814 __u32 maximal_access; 815 __u32 maximal_access;
815 __u32 vol_serial_number; 816 __u32 vol_serial_number;
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 14539c71e6e6..76df656e4b2d 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -281,6 +281,25 @@ smb2_clear_stats(struct cifs_tcon *tcon)
281} 281}
282 282
283static void 283static void
284smb2_dump_share_caps(struct seq_file *m, struct cifs_tcon *tcon)
285{
286 seq_puts(m, "\n\tShare Capabilities:");
287 if (tcon->capabilities & SMB2_SHARE_CAP_DFS)
288 seq_puts(m, " DFS,");
289 if (tcon->capabilities & SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY)
290 seq_puts(m, " CONTINUOUS AVAILABILITY,");
291 if (tcon->capabilities & SMB2_SHARE_CAP_SCALEOUT)
292 seq_puts(m, " SCALEOUT,");
293 if (tcon->capabilities & SMB2_SHARE_CAP_CLUSTER)
294 seq_puts(m, " CLUSTER,");
295 if (tcon->capabilities & SMB2_SHARE_CAP_ASYMMETRIC)
296 seq_puts(m, " ASYMMETRIC,");
297 if (tcon->capabilities == 0)
298 seq_puts(m, " None");
299 seq_printf(m, "\tShare Flags: 0x%x", tcon->share_flags);
300}
301
302static void
284smb2_print_stats(struct seq_file *m, struct cifs_tcon *tcon) 303smb2_print_stats(struct seq_file *m, struct cifs_tcon *tcon)
285{ 304{
286#ifdef CONFIG_CIFS_STATS 305#ifdef CONFIG_CIFS_STATS
@@ -645,6 +664,7 @@ struct smb_version_operations smb30_operations = {
645 .dump_detail = smb2_dump_detail, 664 .dump_detail = smb2_dump_detail,
646 .clear_stats = smb2_clear_stats, 665 .clear_stats = smb2_clear_stats,
647 .print_stats = smb2_print_stats, 666 .print_stats = smb2_print_stats,
667 .dump_share_caps = smb2_dump_share_caps,
648 .is_oplock_break = smb2_is_valid_oplock_break, 668 .is_oplock_break = smb2_is_valid_oplock_break,
649 .need_neg = smb2_need_neg, 669 .need_neg = smb2_need_neg,
650 .negotiate = smb2_negotiate, 670 .negotiate = smb2_negotiate,
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index cb155bfb3411..f7422a68b163 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -741,6 +741,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
741 } 741 }
742 742
743 tcon->share_flags = le32_to_cpu(rsp->ShareFlags); 743 tcon->share_flags = le32_to_cpu(rsp->ShareFlags);
744 tcon->capabilities = rsp->Capabilities; /* we keep caps little endian */
744 tcon->maximal_access = le32_to_cpu(rsp->MaximalAccess); 745 tcon->maximal_access = le32_to_cpu(rsp->MaximalAccess);
745 tcon->tidStatus = CifsGood; 746 tcon->tidStatus = CifsGood;
746 tcon->need_reconnect = false; 747 tcon->need_reconnect = false;