From patchwork Wed Oct 10 04:33:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 1572121 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id ED539DF24C for ; Wed, 10 Oct 2012 04:33:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751213Ab2JJEdM (ORCPT ); Wed, 10 Oct 2012 00:33:12 -0400 Received: from mail-qa0-f53.google.com ([209.85.216.53]:51851 "EHLO mail-qa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751003Ab2JJEdM (ORCPT ); Wed, 10 Oct 2012 00:33:12 -0400 Received: by mail-qa0-f53.google.com with SMTP id s11so157897qaa.19 for ; Tue, 09 Oct 2012 21:33:10 -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:cc:content-type; bh=IuMz/2dzATJ6L4eyoR7uco62mRDIsDDa22J3ESgdnCo=; b=XJvEuj8ZWZYphP4UoM2lCgaJHp1cSBYW92jRcW4ypdidMQ8MHPSVYt+y85ftFa5QxY svNP5nl8P8ep/raZhNg1DLwT/+90bOiowiIaRX2OI/N0PHIISS1Qj9CjyC5rRQXJKDAH 6g483WxQF2qDMFXKX3uxZObO9CU+W8yhYZHG9aak8QLk8FietEcVLbAkbwn6zKloGjc1 MFsYOCnSNzOGphH1jtTbB2NMWFh80dGLxrtNFBE0n/t+yigYYD0kBUiRJkSni9KSUbvM wyt8FgwVd4eGWG/RJqWY5v7ls7HthXg4pntxhMI/GEZ6jP6Eeeaja0lyp2z7nkiU9T4x QpnA== MIME-Version: 1.0 Received: by 10.224.222.13 with SMTP id ie13mr38609954qab.69.1349843590906; Tue, 09 Oct 2012 21:33:10 -0700 (PDT) Received: by 10.49.73.170 with HTTP; Tue, 9 Oct 2012 21:33:10 -0700 (PDT) Date: Tue, 9 Oct 2012 23:33:10 -0500 Message-ID: Subject: SMB2.02 dialect support From: Steve French To: Pavel Shilovsky Cc: linux-cifs@vger.kernel.org Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org This patch enables optional (via Kconfig, specifying vers=2.0 on mount) support for testing SMB2.02 dialect diff --git a/fs/cifs/Kconfig b/fs/cifs/Kconfig index 2075ddf..461e2f5 100644 --- a/fs/cifs/Kconfig +++ b/fs/cifs/Kconfig @@ -172,6 +172,21 @@ config CIFS_SMB2 Unless you are a developer or tester, say N. +config CIFS_SMB20_DIALECT + bool "Support for original SMB2.0 dialect (EXPERIMENTAL)" + depends on CIFS && CIFS_SMB2 + + help + This enables experimental support for the original SMB2.02 dialect. + This could be helpful for developers testing against the earliest + SMB2 capable servers such as Windows Vista, Samba Version 3.6 + and Windows 2008. Without this selection enabled, only the + more recent SMB2.1 and SMB3 dialects are enabled. Since SMB2.1 + and SMB3 dialects are better than the original SMB2 dialect for + more recent servers (such as Windows 2008R2, Windows 7, and Samba 4), + and earlier servers support the cifs protocol well, unless you are a + developer or tester, say N. + config CIFS_FSCACHE bool "Provide CIFS client caching support" depends on CIFS=m && FSCACHE || CIFS=y && FSCACHE=y diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index f5af252..3763624 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -178,6 +178,7 @@ struct smb_rqst { enum smb_version { Smb_1 = 1, + Smb_20, Smb_21, Smb_30, }; diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 5c670b9..8a17cf2 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -274,6 +274,7 @@ static const match_table_t cifs_cacheflavor_tokens = { static const match_table_t cifs_smb_version_tokens = { { Smb_1, SMB1_VERSION_STRING }, + { Smb_20, SMB20_VERSION_STRING}, { Smb_21, SMB21_VERSION_STRING }, { Smb_30, SMB30_VERSION_STRING }, }; @@ -1074,6 +1075,11 @@ cifs_parse_smb_version(char *value, struct smb_vol *vol) vol->vals = &smb1_values; break; #ifdef CONFIG_CIFS_SMB2 +#ifdef CONFIG_CIFS_SMB20_DIALECT + case Smb_20: + vol->ops = &smb21_operations; /* currently identical with 2.1 */ + vol->vals = &smb20_values; +#endif /* CIFS_SMB20_DIALECT */ case Smb_21: vol->ops = &smb21_operations; vol->vals = &smb21_values; diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 4d9dbe0..3dd47dc 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -643,6 +643,25 @@ struct smb_version_operations smb21_operations = { .new_lease_key = smb2_new_lease_key, }; +#ifdef CONFIG_CIFS_SMB20_DIALECT +struct smb_version_values smb20_values = { + .version_string = SMB20_VERSION_STRING, + .protocol_id = SMB20_PROT_ID, + .req_capabilities = 0, /* MBZ */ + .large_lock_type = 0, + .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK, + .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK, + .unlock_lock_type = SMB2_LOCKFLAG_UNLOCK, + .header_size = sizeof(struct smb2_hdr), + .max_header_size = MAX_SMB2_HDR_SIZE, + .read_rsp_size = sizeof(struct smb2_read_rsp) - 1, + .lock_cmd = SMB2_LOCK, + .cap_unix = 0, + .cap_nt_find = SMB2_NT_FIND, + .cap_large_files = SMB2_LARGE_FILES, +}; +#endif /* CONFIG_CIFS_SMB2_DIALECT */ + struct smb_version_values smb21_values = { .version_string = SMB21_VERSION_STRING, .protocol_id = SMB21_PROT_ID,