From patchwork Fri Nov 5 08:29:36 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 303922 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 oA58WlC7011372 for ; Fri, 5 Nov 2010 08:32:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752278Ab0KEIcv (ORCPT ); Fri, 5 Nov 2010 04:32:51 -0400 Received: from mail-ey0-f174.google.com ([209.85.215.174]:39509 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753373Ab0KEIcv (ORCPT ); Fri, 5 Nov 2010 04:32:51 -0400 Received: by mail-ey0-f174.google.com with SMTP id 27so1565129eye.19 for ; Fri, 05 Nov 2010 01:32:50 -0700 (PDT) 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=46jnrBVIKSDh377/FNEyK4efXL72HqapB6bpwoEuwqg=; b=dB0gc8OY+0se1fPueMr7QsRlfMKsvNlniETi67rHxvmvS28PoDyy19+IJDE5m2InOs mP5nQe+4JMdAeoTLPpDeZTUkIgYUDuEEfzOV+Wwl1r/fn5JrXE3phfVISEAnLYcpVm/j K8xybjDCTSG16SEENdggYZdpyo4soVj7/YJpg= 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=vOIxJCAAG6Qla7gFe6sVc46dEq6Gz5WmmOzRY0ehLINwF9t27u6u0U5xhQ0d3FF+mz Eps4QCY80IGlnvrl7cnYL4hmNUlSlCaC7lz/775t56idFoF6HzqU0soQieOrDkCulEyn yG69eBf2zOTn0npqZtzCyt1x9pFjA1SSGtfoc= Received: by 10.213.113.207 with SMTP id b15mr1437592ebq.85.1288945970787; Fri, 05 Nov 2010 01:32:50 -0700 (PDT) Received: from localhost.localdomain ([95.84.33.166]) by mx.google.com with ESMTPS id q58sm801154eeh.15.2010.11.05.01.32.49 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 05 Nov 2010 01:32:50 -0700 (PDT) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH 5/6] CIFS: Make cifs_file_map work with strict cache mode Date: Fri, 5 Nov 2010 11:29:36 +0300 Message-Id: <1288945777-9197-6-git-send-email-piastryyy@gmail.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1288945777-9197-1-git-send-email-piastryyy@gmail.com> References: <1288945777-9197-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]); Fri, 05 Nov 2010 08:32:52 +0000 (UTC) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index e8ca2d6..81eb840 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -1820,14 +1820,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) == 0)) + 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;