From patchwork Wed Jun 19 17:24:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 2750981 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5F2D6C0AB1 for ; Wed, 19 Jun 2013 17:24:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6185120258 for ; Wed, 19 Jun 2013 17:24:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5B1652025A for ; Wed, 19 Jun 2013 17:24:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757200Ab3FSRYL (ORCPT ); Wed, 19 Jun 2013 13:24:11 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:38214 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756904Ab3FSRYI (ORCPT ); Wed, 19 Jun 2013 13:24:08 -0400 Received: by mail-pa0-f41.google.com with SMTP id bj3so5393267pad.14 for ; Wed, 19 Jun 2013 10:24:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=cZKb7zA4KVLDCu/vIThoVdsUgYPDp6ASnah5uWSkQJ0=; b=E5EarOk4LLmXgCsRRjpEf3xqmwVLwBEHkOVKrVh8uE3bbR/9MMwIA4WRaKfE65QTBB 6nMRqezkgWTV+yOIOWxKivlS+TBS7MBDzdkx+/AQZ8YdFrxMIEXO7kInyFt8qs27s1Iu ScI5csmVhLOCU1nXPP5wUwsLyfYSx9r6Qgj5eLKkjtUaTKWLu3uuLVnTE50Bl6UcVlcV WUMiajbadJFGmGn57mNSQk+Jce1Y2rS3NUCyGOPthEeByb8hyR4RjEyIo1JpX4w2KXRK tfQN4/jyW7BsQgM46DWqoGwirtZ7AmSveaM0uolCp0yXDnX6W9Pnb6op35LacReoybeU dgyg== MIME-Version: 1.0 X-Received: by 10.66.241.1 with SMTP id we1mr7897175pac.83.1371662648008; Wed, 19 Jun 2013 10:24:08 -0700 (PDT) Received: by 10.68.225.130 with HTTP; Wed, 19 Jun 2013 10:24:07 -0700 (PDT) Date: Wed, 19 Jun 2013 12:24:07 -0500 Message-ID: Subject: [PATCH] Dump SMB3 share capabilities and flags From: Steve French To: Jeff Layton , Pavel Shilovsky , linux-cifs@vger.kernel.org Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 tcon->need_reconnect = false; Acked-by: Jeff Layton diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index 856f8f5..9a39650 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c @@ -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 "); diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index f13cbbe..d6f6939 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -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 *); diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 14539c7..32bb62e 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -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, "\nShare 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: %d", 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, diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index cb155bf..a6237ae 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, } tcon->share_flags = le32_to_cpu(rsp->ShareFlags); + tcon->capabilities = le32_to_cpu(rsp->Capabilities); tcon->maximal_access = le32_to_cpu(rsp->MaximalAccess); tcon->tidStatus = CifsGood;