From patchwork Sun Nov 28 08:12:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 361892 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 oAS8BWvo023110 for ; Sun, 28 Nov 2010 08:14:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751797Ab0K1IO6 (ORCPT ); Sun, 28 Nov 2010 03:14:58 -0500 Received: from mail-ew0-f46.google.com ([209.85.215.46]:60540 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751708Ab0K1IO6 (ORCPT ); Sun, 28 Nov 2010 03:14:58 -0500 Received: by ewy5 with SMTP id 5so1493883ewy.19 for ; Sun, 28 Nov 2010 00:14:57 -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=vbDlIN3z8FRZbbwXVqQNJ8P9W2G53HR6fGGF9e22kGA=; b=OCc+bRl0vCPOvvYC7iWvOlvsO7MqLqspXjE0jp9BF8s02J/U8211pCCT5A0i0zDdk+ ghjjzLuR8Tq9W1Bky5T90t/9xnMRDfYQkmjh3ZPYVUSDcyNxczc7Wx1xrhBn68lfBxA6 OVLc23yPN9DR1fTURsZXF0iQw37pK41osWO/U= 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=LB4N+PKI+vhBl9XzGBWKe5SASAn3pPb+shcAHDcxyw38sa4EZu6pc+yGZg01P2Regr yL2N/pvIf0JwnsTa6tp/1uNPW7DWvWA19ZoJxxh6Yed3VpJLZ9yxmQnGy1KLxaIyXQgj z4VK5o3Gcci0P05Fixtc6DU4NfSRVY1+5b4Gc= Received: by 10.213.28.5 with SMTP id k5mr8080913ebc.41.1290932097265; Sun, 28 Nov 2010 00:14:57 -0800 (PST) Received: from localhost.localdomain ([95.84.39.194]) by mx.google.com with ESMTPS id b52sm3724422eei.19.2010.11.28.00.14.56 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 28 Nov 2010 00:14:56 -0800 (PST) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH 5/6] CIFS: Make cifs_file_map work with strict cache mode (try #2) Date: Sun, 28 Nov 2010 11:12:51 +0300 Message-Id: <1290931972-2770-6-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/file.c b/fs/cifs/file.c index 22d0421..d9dcc98 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -1812,14 +1812,24 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size, int cifs_file_mmap(struct file *file, struct vm_area_struct *vma) { int rc, xid; + struct inode *inode = file->f_path.dentry->d_inode; + struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); xid = GetXid(); - rc = cifs_revalidate_file(file); - if (rc) { - cFYI(1, "Validation prior to mmap failed, error=%d", rc); - FreeXid(xid); - return rc; + + if (!CIFS_I(inode)->clientCanCacheRead && + (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO)) + invalidate_remote_inode(inode); + else { + rc = cifs_revalidate_file(file); + if (rc) { + cFYI(1, "Validation prior to mmap failed, error=%d", + rc); + FreeXid(xid); + return rc; + } } + rc = generic_file_mmap(file, vma); FreeXid(xid); return rc;