From patchwork Sun Nov 14 06:13:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 323062 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 oAE6E8vU022380 for ; Sun, 14 Nov 2010 06:14:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752707Ab0KNGOG (ORCPT ); Sun, 14 Nov 2010 01:14:06 -0500 Received: from mail-ey0-f174.google.com ([209.85.215.174]:45022 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751670Ab0KNGOG (ORCPT ); Sun, 14 Nov 2010 01:14:06 -0500 Received: by eye27 with SMTP id 27so2538098eye.19 for ; Sat, 13 Nov 2010 22:14:04 -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=03dpVZgQPVgfi/rHkLHuuoqAWnatUNPxddMmzjAnrzI=; b=jgi37L4DvkzMhcfHi8iHETRM7qy30N+YokcGJnsmPlePNsE2ojldRYjOQRR3Hzulau 389MAeNiuLUh2+RuQnQmgonoibl0jMdDS0lqCeX8y/Qu+dGK05gk3tUJihIcZsXPT8+X WQIJIqFYFY7Eb5RJGvoP5C5E2ifx/QdPH1kRQ= 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=OP5/31NCe31XbnwmegMzPq6kP6cHimy5YVNJULp6mqOFI1ypE8lnz9eJ4SSykPBomm pwj/19fXWMmSPxR5Q24geCAAZ9AGTSZYOmv72SEYjKgsk89RYN3lfEbJ27JKdoPcN0gi xlvhOJUpwFKCdpeTBpqZN4S85KHv9BNv9gjdQ= Received: by 10.14.127.2 with SMTP id c2mr2806014eei.3.1289715243647; Sat, 13 Nov 2010 22:14:03 -0800 (PST) Received: from localhost.localdomain (PPPoE-78-29-64-195.san.ru [78.29.64.195]) by mx.google.com with ESMTPS id b52sm5153357eei.1.2010.11.13.22.14.02 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 13 Nov 2010 22:14:02 -0800 (PST) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH 4/6] CIFS: Make cifs_fsync work with strict cache mode Date: Sun, 14 Nov 2010 09:13:44 +0300 Message-Id: <1289715224-2517-1-git-send-email-piastryyy@gmail.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1289403711-12965-5-git-send-email-piastryyy@gmail.com> References: <1289403711-12965-5-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, 14 Nov 2010 06:14:08 +0000 (UTC) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 85824c0..e8ca2d6 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -1603,20 +1603,20 @@ int cifs_fsync(struct file *file, int datasync) struct cifsTconInfo *tcon; struct cifsFileInfo *smbfile = file->private_data; struct inode *inode = file->f_path.dentry->d_inode; + struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); xid = GetXid(); cFYI(1, "Sync file - name: %s datasync: 0x%x", file->f_path.dentry->d_name.name, datasync); - rc = filemap_write_and_wait(inode->i_mapping); - if (rc == 0) { - struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); + if (!CIFS_I(inode)->clientCanCacheRead && + ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) == 0)) + invalidate_remote_inode(inode); - tcon = tlink_tcon(smbfile->tlink); - if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) - rc = CIFSSMBFlush(xid, tcon, smbfile->netfid); - } + tcon = tlink_tcon(smbfile->tlink); + if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) + rc = CIFSSMBFlush(xid, tcon, smbfile->netfid); FreeXid(xid); return rc;