From patchwork Wed Nov 10 15:41:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 314552 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 oAAFgYqa031219 for ; Wed, 10 Nov 2010 15:42:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756732Ab0KJPml (ORCPT ); Wed, 10 Nov 2010 10:42:41 -0500 Received: from mail-ew0-f46.google.com ([209.85.215.46]:34474 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756722Ab0KJPmk (ORCPT ); Wed, 10 Nov 2010 10:42:40 -0500 Received: by mail-ew0-f46.google.com with SMTP id 7so367214ewy.19 for ; Wed, 10 Nov 2010 07:42:39 -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=aJObUhINvyC/Gg7n8wM/ZsZ7zHNrsWMoYhRH0eY9rsc=; b=ZR9V3d/gfwQkCKp/lv1VFRhVbkToi14IB5xdVeIRWiKGufBU8gNqqIHOCc+y4YWAD+ OiZMHiQqItv4vNdE2IUi8r/c+rTBKI0H4dn9s1xtdXSSqfc34MMzHY6igUCHwJQT9lOG NZQIe+oJGQvGMKgPfHezSXE3sRP3UX6dErVQs= 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=R6cbzAIZgzx2d/h7jTfnfiyEJuLJQ+6jh2XMlhIGCjasoaEbBmQ6vw+ZHI6CSwfzJC MGshrqliNTQbr+BwUPeh/gHDuMQKEGzK2c87xy0xHAl63FOfsmTfgDOYev+Sucp0OXXr xrf2g5zoKHcBlkm2lJTHuTipkTTGOX0uZcz5k= Received: by 10.14.48.74 with SMTP id u50mr6072647eeb.49.1289403759856; Wed, 10 Nov 2010 07:42:39 -0800 (PST) Received: from localhost.localdomain ([79.126.90.150]) by mx.google.com with ESMTPS id w20sm815303eeh.0.2010.11.10.07.42.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 10 Nov 2010 07:42:39 -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 Date: Wed, 10 Nov 2010 18:41:50 +0300 Message-Id: <1289403711-12965-6-git-send-email-piastryyy@gmail.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1289403711-12965-1-git-send-email-piastryyy@gmail.com> References: <1289403711-12965-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]); Wed, 10 Nov 2010 15:42:41 +0000 (UTC) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 63fb551..ef8d647 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -1828,14 +1828,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;