From patchwork Sun Nov 28 08:12:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 361902 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 oAS8BWvp023110 for ; Sun, 28 Nov 2010 08:14:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751792Ab0K1IO7 (ORCPT ); Sun, 28 Nov 2010 03:14:59 -0500 Received: from mail-ey0-f174.google.com ([209.85.215.174]:58953 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751750Ab0K1IO6 (ORCPT ); Sun, 28 Nov 2010 03:14:58 -0500 Received: by mail-ey0-f174.google.com with SMTP id 27so1481871eye.19 for ; Sun, 28 Nov 2010 00:14:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :message-id:x-mailer:in-reply-to:references; bh=v4YLI4iysmwbx54wBGP1EtsQm/Lx94sbFnujWm5y5JU=; b=rXzoPxZu4VxO5eAJx3pSyDiZRrdbFtdmKivq80x3n1wAocjMIrO+itMQwFHbviHXaH dpQnUqeYRNQIsT8ajteSkTekp9eF1SWQSzpTJFQhKA0eBC6/+kqh/H5B9n1Gylz+Wz8H V0pY/hCJFxDlYCS8o3MwuDvajizsmZ7bBzZ0k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; b=bSa3v0Hs/zrVpfXXOlaonPa4A+n2l+Myv+qNnxZ75WcA9NF8qN8+cOk4VHlVm51F3b 5nkGae3RO0Ok+G7lk35oCgLFvS/qYUdF9gyuQjOx51dMKnLSqdL6fFRTdvttJwPuwhjh Flx1/PZCiJYoZyywbpHvBTf1/Zcn6NQMYuxNc= Received: by 10.14.119.195 with SMTP id n43mr3097326eeh.0.1290932098303; Sun, 28 Nov 2010 00:14:58 -0800 (PST) Received: from localhost.localdomain ([95.84.39.194]) by mx.google.com with ESMTPS id b52sm3724422eei.19.2010.11.28.00.14.57 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 28 Nov 2010 00:14:57 -0800 (PST) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH 6/6] CIFS: Add strictcache mount option (try #2) Date: Sun, 28 Nov 2010 11:12:52 +0300 Message-Id: <1290931972-2770-7-git-send-email-piastryyy@gmail.com> X-Mailer: git-send-email 1.7.3.2 In-Reply-To: <1290931972-2770-1-git-send-email-piastryyy@gmail.com> References: <1290931972-2770-1-git-send-email-piastryyy@gmail.com> 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]); Sun, 28 Nov 2010 08:14:59 +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/connect.c b/fs/cifs/connect.c index 251a17c..97286c7 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; @@ -1347,6 +1348,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 " "supported. Instead set " @@ -2597,6 +2600,8 @@ static void setup_cifs_sb(struct smb_vol *pvolume_info, if (pvolume_info->multiuser) cifs_sb->mnt_cifs_flags |= (CIFS_MOUNT_MULTIUSER | CIFS_MOUNT_NO_PERM); + if (pvolume_info->strict_io) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_STRICT_IO; if (pvolume_info->direct_io) { cFYI(1, "mounting share using direct i/o"); cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO;