From patchwork Sun Nov 28 08:12: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: 361882 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 oAS8BWvn023110 for ; Sun, 28 Nov 2010 08:14:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751782Ab0K1IO5 (ORCPT ); Sun, 28 Nov 2010 03:14:57 -0500 Received: from mail-ew0-f46.google.com ([209.85.215.46]:65049 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751708Ab0K1IO5 (ORCPT ); Sun, 28 Nov 2010 03:14:57 -0500 Received: by mail-ew0-f46.google.com with SMTP id 5so1493865ewy.19 for ; Sun, 28 Nov 2010 00:14:56 -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=q8/C/VTLl2/+gEaXpwxW7dNdkHe5yojDn7iTJoFyHJY=; b=kgNCVHsdPDIBVR/GnHfRoMCY6uZ4jZBg+aJoQt+u8DH9FClxBDuTKGWly8IZDI29rJ //gkWDsHs18eM3UKgBLKcwnW4Mokf8VBNUZnQSm3K2dcPlI6EXnm2osC001oJ8ZU/326 EF9lsqSnoi8R9WSyssaSy3voQ1RBcc0tFo9VY= 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=cMcrIUPsedfYmBA5s5PwQ4G3atBO4/uzn11PmBuW09ggtRn9ejglHETqGVb+ScHfgy Qw2kyGRQ6PQoLT04RE2s5Ns5gj4/47ccyNyCvkXuWxF2QLeMFjWGmY+QuUdWa7kJ+iBw YtUVFzpcMzROopWNhhYG259c3TvAIe72GFwwM= Received: by 10.213.16.72 with SMTP id n8mr8002228eba.38.1290932096200; Sun, 28 Nov 2010 00:14:56 -0800 (PST) Received: from localhost.localdomain ([95.84.39.194]) by mx.google.com with ESMTPS id b52sm3724422eei.19.2010.11.28.00.14.55 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 28 Nov 2010 00:14:55 -0800 (PST) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH 4/6] CIFS: Make cifs_fsync work with strict cache mode (try #2) Date: Sun, 28 Nov 2010 11:12:50 +0300 Message-Id: <1290931972-2770-5-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:58 +0000 (UTC) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index f853bf0..22d0421 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -1595,20 +1595,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)) + 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;