Add ability to dipslay SMB3 share flags and capabilities for debugging
authorSteve French <smfrench@gmail.com>
Wed, 19 Jun 2013 19:15:30 +0000 (14:15 -0500)
committerSteve French <smfrench@gmail.com>
Mon, 24 Jun 2013 06:56:46 +0000 (01:56 -0500)
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>
fs/cifs/cifs_debug.c
fs/cifs/cifsglob.h
fs/cifs/smb2ops.c
fs/cifs/smb2pdu.c

index 856f8f5..0315824 100644 (file)
@@ -213,7 +213,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
                                                   tcon->nativeFileSystem);
                                }
                                seq_printf(m, "DevInfo: 0x%x Attributes: 0x%x"
-                                       "\nPathComponentMax: %d Status: 0x%d",
+                                       "\n\tPathComponentMax: %d Status: 0x%d",
                                        le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics),
                                        le32_to_cpu(tcon->fsAttrInfo.Attributes),
                                        le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength),
@@ -224,6 +224,8 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
                                        seq_puts(m, " type: CDROM ");
                                else
                                        seq_printf(m, " type: %d ", dev_type);
+                               if (server->ops->dump_share_caps)
+                                       server->ops->dump_share_caps(m, tcon);
 
                                if (tcon->need_reconnect)
                                        seq_puts(m, "\tDISCONNECTED ");
index f13cbbe..9a1e37a 100644 (file)
@@ -223,6 +223,7 @@ struct smb_version_operations {
        void (*dump_detail)(void *);
        void (*clear_stats)(struct cifs_tcon *);
        void (*print_stats)(struct seq_file *m, struct cifs_tcon *);
+       void (*dump_share_caps)(struct seq_file *, struct cifs_tcon *);
        /* verify the message */
        int (*check_message)(char *, unsigned int);
        bool (*is_oplock_break)(char *, struct TCP_Server_Info *);
@@ -809,7 +810,7 @@ struct cifs_tcon {
 #ifdef CONFIG_CIFS_SMB2
        bool print:1;           /* set if connection to printer share */
        bool bad_network_name:1; /* set if ret status STATUS_BAD_NETWORK_NAME */
-       __u32 capabilities;
+       __le32 capabilities;
        __u32 share_flags;
        __u32 maximal_access;
        __u32 vol_serial_number;
index 14539c7..76df656 100644 (file)
@@ -281,6 +281,25 @@ smb2_clear_stats(struct cifs_tcon *tcon)
 }
 
 static void
+smb2_dump_share_caps(struct seq_file *m, struct cifs_tcon *tcon)
+{
+       seq_puts(m, "\n\tShare Capabilities:");
+       if (tcon->capabilities & SMB2_SHARE_CAP_DFS)
+               seq_puts(m, " DFS,");
+       if (tcon->capabilities & SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY)
+               seq_puts(m, " CONTINUOUS AVAILABILITY,");
+       if (tcon->capabilities & SMB2_SHARE_CAP_SCALEOUT)
+               seq_puts(m, " SCALEOUT,");
+       if (tcon->capabilities & SMB2_SHARE_CAP_CLUSTER)
+               seq_puts(m, " CLUSTER,");
+       if (tcon->capabilities & SMB2_SHARE_CAP_ASYMMETRIC)
+               seq_puts(m, " ASYMMETRIC,");
+       if (tcon->capabilities == 0)
+               seq_puts(m, " None");
+       seq_printf(m, "\tShare Flags: 0x%x", tcon->share_flags);
+}
+
+static void
 smb2_print_stats(struct seq_file *m, struct cifs_tcon *tcon)
 {
 #ifdef CONFIG_CIFS_STATS
@@ -645,6 +664,7 @@ struct smb_version_operations smb30_operations = {
        .dump_detail = smb2_dump_detail,
        .clear_stats = smb2_clear_stats,
        .print_stats = smb2_print_stats,
+       .dump_share_caps = smb2_dump_share_caps,
        .is_oplock_break = smb2_is_valid_oplock_break,
        .need_neg = smb2_need_neg,
        .negotiate = smb2_negotiate,
index cb155bf..f7422a6 100644 (file)
@@ -741,6 +741,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
        }
 
        tcon->share_flags = le32_to_cpu(rsp->ShareFlags);
+       tcon->capabilities = rsp->Capabilities; /* we keep caps little endian */
        tcon->maximal_access = le32_to_cpu(rsp->MaximalAccess);
        tcon->tidStatus = CifsGood;
        tcon->need_reconnect = false;