From patchwork Mon Aug 20 18:42:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 1350621 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id A21643FC33 for ; Mon, 20 Aug 2012 18:43:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752859Ab2HTSnp (ORCPT ); Mon, 20 Aug 2012 14:43:45 -0400 Received: from mail-lpp01m010-f46.google.com ([209.85.215.46]:35568 "EHLO mail-lpp01m010-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752595Ab2HTSno (ORCPT ); Mon, 20 Aug 2012 14:43:44 -0400 Received: by lagy9 with SMTP id y9so3458452lag.19 for ; Mon, 20 Aug 2012 11:43:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=01Z0o2hJOkAJ6UTfs93O1tmsV8DcuoJH+ufXPjAJjZo=; b=gCVusv9Gwxa64ShX/X4yARZtD+UQ3c6ZAVlG3ecA2ZquT0al0MIpi41A5Ca/sGMrMb L8dLYzMdZrpzSXNtfnvqRkSGK4ymNCFwEVe3aeg98Hpd0qa+8as5QtcIFUCIGNksyCLj WoMJy7fkUVXAQ2pUOvxxsVyJDLtQR7UWcfVAqxKjWwlVohlxtqtol9FmzUlJhffAsrI2 bZKvL49HYxwMEQJU42tmecsz147OuB7giaQIZHFlh3FB9bxD2rCH4hYhlCx4icQaeceO zG6OpkD/XGC07PjGQaWKgLWbq139rH20J/Jb8ROxEcFN5sAz8ARzGEApYZjdu7SpwpEZ pBBA== Received: by 10.152.144.234 with SMTP id sp10mr14731915lab.51.1345488223277; Mon, 20 Aug 2012 11:43:43 -0700 (PDT) Received: from localhost.localdomain (PPPoE-78-29-75-95.san.ru. [78.29.75.95]) by mx.google.com with ESMTPS id mt19sm16434912lab.17.2012.08.20.11.43.41 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 20 Aug 2012 11:43:42 -0700 (PDT) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Cc: Pavel Shilovsky Subject: [PATCH 02/10] CIFS: Handle SMB2 lock flags Date: Mon, 20 Aug 2012 22:42:52 +0400 Message-Id: <1345488180-5942-3-git-send-email-pshilovsky@samba.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1345488180-5942-1-git-send-email-pshilovsky@samba.org> References: <1345488180-5942-1-git-send-email-pshilovsky@samba.org> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org From: Pavel Shilovsky Signed-off-by: Pavel Shilovsky --- fs/cifs/smb2ops.c | 12 ++++++++++++ fs/cifs/smb2pdu.h | 5 +++++ 2 files changed, 17 insertions(+), 0 deletions(-) diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index b1dedf8..e4a59d1 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -537,7 +537,15 @@ smb2_queryfs(const unsigned int xid, struct cifs_tcon *tcon, return rc; } +static bool +smb2_compare_fids(struct cifsFileInfo *ob1, struct cifsFileInfo *ob2) +{ + return ob1->fid.persistent_fid == ob2->fid.persistent_fid && + ob1->fid.volatile_fid == ob2->fid.volatile_fid; +} + struct smb_version_operations smb21_operations = { + .compare_fids = smb2_compare_fids, .setup_request = smb2_setup_request, .setup_async_request = smb2_setup_async_request, .check_receive = smb2_check_receive, @@ -598,6 +606,10 @@ struct smb_version_operations smb21_operations = { struct smb_version_values smb21_values = { .version_string = SMB21_VERSION_STRING, + .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, diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h index 4b31825..d12d868 100644 --- a/fs/cifs/smb2pdu.h +++ b/fs/cifs/smb2pdu.h @@ -526,6 +526,11 @@ struct smb2_write_rsp { __u8 Buffer[1]; } __packed; +#define SMB2_LOCKFLAG_SHARED_LOCK 0x0001 +#define SMB2_LOCKFLAG_EXCLUSIVE_LOCK 0x0002 +#define SMB2_LOCKFLAG_UNLOCK 0x0004 +#define SMB2_LOCKFLAG_FAIL_IMMEDIATELY 0x0010 + struct smb2_echo_req { struct smb2_hdr hdr; __le16 StructureSize; /* Must be 4 */