From patchwork Fri Aug 31 09:41:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 1392341 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 E19573FDF6 for ; Fri, 31 Aug 2012 09:41:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752075Ab2HaJlp (ORCPT ); Fri, 31 Aug 2012 05:41:45 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:40987 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751780Ab2HaJlo (ORCPT ); Fri, 31 Aug 2012 05:41:44 -0400 Received: by mail-lb0-f174.google.com with SMTP id gj3so1089918lbb.19 for ; Fri, 31 Aug 2012 02:41:44 -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=01Z0o2hJOkAJ6UTfs93O1tmsV8DcuoJH+ufXPjAJjZo=; b=Y1wrYkh5vsDBtAKU5997Qo819IRdJh3QeIx1ccxaDZdduJ3jcnkLJnfoyTT6ul7ksf OCEnQtVLV5KDCb4jxDMrBdMEg9MNk31t8JHLZcpQE1SGtnNL6O0J31ua4Sj08phk/rM5 IGnNbMJz+m5y3Qr/7L88TPSI8BAyRuNXSjZpdtJ+6uHeJ3qcdG4bOTNQfrbqJkBC8/BS SgAiYemUZvxtCVU0blX9FiqXI90piuuXMHoNnipcLpLTiYIU3+WsEgbIMR7jjFYlBWbs RLMC+6vFNQZOa1CXjFdCKeUTxf2NlfKNLk4BfSGQ0d5OQWHTr8xh0Mmm5dlhhpLayBVR pWRg== Received: by 10.112.85.97 with SMTP id g1mr592971lbz.101.1346406103934; Fri, 31 Aug 2012 02:41:43 -0700 (PDT) Received: from localhost.localdomain ([95.84.16.136]) by mx.google.com with ESMTPS id lv13sm4283257lab.8.2012.08.31.02.41.42 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 31 Aug 2012 02:41:43 -0700 (PDT) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Cc: Pavel Shilovsky Subject: [PATCH v2 3/7] CIFS: Handle SMB2 lock flags Date: Fri, 31 Aug 2012 13:41:24 +0400 Message-Id: <1346406088-4537-4-git-send-email-pshilovsky@etersoft.ru> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1346406088-4537-1-git-send-email-pshilovsky@etersoft.ru> References: <1346406088-4537-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 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 */