From patchwork Mon Sep 10 12:19:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 1431991 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 1D17D40220 for ; Mon, 10 Sep 2012 12:19:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757686Ab2IJMTt (ORCPT ); Mon, 10 Sep 2012 08:19:49 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:41373 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757672Ab2IJMTt (ORCPT ); Mon, 10 Sep 2012 08:19:49 -0400 Received: by lbbgj3 with SMTP id gj3so1125431lbb.19 for ; Mon, 10 Sep 2012 05:19:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=2BW8V49CS33Xj4Lq0UnDMo4GyB7lpNiSUhkJ4s7AcfE=; b=HljRRi6pwjwoitGXU1xqrwUe3k0Lb2p9bKlrdlVc44vxq8cqxseyq0yrNHwihN2QyG QpHufN6ZAptQalKzsljgqeeaIWEUvjmL7enx2QqPmPrPH9amXMDrmaXTbHZnjyVRZprv iNwgbj32PgS3StgXZqdMOQ6804L3yIMMkUqiJauqTuRWhLwjGdtOh1ODr+NqGIfhfWJl a8WOIMkf2mDIhGCL0JqpTvhx3OROjpD7GOzvzo7bFyN4zaz4w+hE7tcNgGxXh4ygSaFh VXFBCa0JudrNTvUap3n/TgmZAMnpHELgesdBgA7Rh+Pi8P5IoN57oIps9Sc7Xz2zAwWo zSAA== Received: by 10.152.148.195 with SMTP id tu3mr12292953lab.16.1347279587763; Mon, 10 Sep 2012 05:19:47 -0700 (PDT) Received: from localhost.localdomain ([178.45.128.11]) by mx.google.com with ESMTPS id r8sm3514851lba.15.2012.09.10.05.19.46 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 10 Sep 2012 05:19:46 -0700 (PDT) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Cc: Pavel Shilovsky Subject: [PATCH v3 3/7] CIFS: Handle SMB2 lock flags Date: Mon, 10 Sep 2012 16:19:31 +0400 Message-Id: <1347279575-6071-4-git-send-email-pshilovsky@etersoft.ru> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1347279575-6071-1-git-send-email-pshilovsky@etersoft.ru> References: <1347279575-6071-1-git-send-email-pshilovsky@etersoft.ru> 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 3c8e99e..d2d132e 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 */