From patchwork Mon Sep 27 18:31:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 213092 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8RIVlA4030992 for ; Mon, 27 Sep 2010 18:31:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760043Ab0I0SbR (ORCPT ); Mon, 27 Sep 2010 14:31:17 -0400 Received: from mail-qy0-f181.google.com ([209.85.216.181]:36716 "EHLO mail-qy0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760040Ab0I0SbM (ORCPT ); Mon, 27 Sep 2010 14:31:12 -0400 Received: by qyk33 with SMTP id 33so8178099qyk.19 for ; Mon, 27 Sep 2010 11:31:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=HIaqiE/N7yUt87IringguazosmU+VgfRwUz6oyi/AOA=; b=Gg4BHy8Mg6pZJUmCnnmT2u4jMv8epQk2pbo+eeHktgBBWjCLW4v17v4AEuNOQiqv/G PLZTvSCM//EUrI4hlI1gPOovtsPDlI3msLpeZPsYSMxv94lMBnnbqcjWG0wz/LlNQah0 yd3SKVfZd7r/hka0rsHNWbBNe+NP38HT6atG8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=f2CkugQ2Bzsf8I4RNln+3YcT6X4R4SM/bAFXO1w7S1USUEpImMixLvTOLW3vnwBc1O D7J9Q1+p/Tko3Ja7pyq7ZM+e4pfzO/iILP9mFrB37dnJZ3VnsksOQKrjZk1RuWGyB/V2 5I6Q9AXYMcF+V7LSr+D9y0Ty3sZBVr4RZLnzo= MIME-Version: 1.0 Received: by 10.224.65.148 with SMTP id j20mr5771812qai.257.1285612271679; Mon, 27 Sep 2010 11:31:11 -0700 (PDT) Received: by 10.229.40.138 with HTTP; Mon, 27 Sep 2010 11:31:11 -0700 (PDT) Date: Mon, 27 Sep 2010 22:31:11 +0400 Message-ID: Subject: [PATCH 1/3] CIFS: Add strictcache mount option From: Pavel Shilovsky To: 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-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 27 Sep 2010 18:31:48 +0000 (UTC) diff --git a/fs/cifs/README b/fs/cifs/README index ee68d10..8fb6192 100644 --- a/fs/cifs/README +++ b/fs/cifs/README @@ -443,6 +443,11 @@ A partial list of the supported mount options follows: if oplock (caching token) is granted and held. Note that direct allows write operations larger than page size to be sent to the server. + strictcache Use for switching on strict cache mode. In this mode the + client read from the cache all the time it has Oplock Level II, + otherwise - read from the server. All written data are stored + in the cache, but if the client doesn't have Exclusive Oplock, + it writes the data to the server. acl Allow setfacl and getfacl to manage posix ACLs if server supports them. (default) noacl Do not allow setfacl and getfacl calls on this mount diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h index ba0afd3..a3d1889 100644 --- a/fs/cifs/cifs_fs_sb.h +++ b/fs/cifs/cifs_fs_sb.h @@ -37,6 +37,7 @@ #define CIFS_MOUNT_NOSSYNC 0x4000 /* don't do slow SMBflush on every sync*/ #define CIFS_MOUNT_FSCACHE 0x8000 /* local caching enabled */ #define CIFS_MOUNT_MF_SYMLINKS 0x10000 /* Minshall+French Symlinks enabled */ +#define CIFS_MOUNT_STRICT_IO 0x20000 /* strict cache behavior */ struct cifs_sb_info { struct cifsTconInfo *ptcon; /* primary mount */ diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index f6a3091..fffd174 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -84,6 +84,7 @@ struct smb_vol { bool no_xattr:1; /* set if xattr (EA) support should be disabled*/ bool server_ino:1; /* use inode numbers from server ie UniqueId */ bool direct_io:1; + bool strict_io:1; /* strict cache behavior */ bool remap:1; /* set to remap seven reserved chars in filenames */ bool posix_paths:1; /* unset to not ask for posix pathnames. */ bool no_linux_ext:1; @@ -1336,6 +1337,8 @@ cifs_parse_mount_options(char *options, const char *devname, vol->direct_io = 1; } else if (strnicmp(data, "forcedirectio", 13) == 0) { vol->direct_io = 1; + } else if (strnicmp(data, "strictcache", 11) == 0) { + vol->strict_io = 1; } else if (strnicmp(data, "noac", 4) == 0) { printk(KERN_WARNING "CIFS: Mount option noac not "