From patchwork Fri Nov 5 08:29:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 303912 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 oA58WlC6011372 for ; Fri, 5 Nov 2010 08:32:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753387Ab0KEIcu (ORCPT ); Fri, 5 Nov 2010 04:32:50 -0400 Received: from mail-ey0-f174.google.com ([209.85.215.174]:36692 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752407Ab0KEIcu (ORCPT ); Fri, 5 Nov 2010 04:32:50 -0400 Received: by mail-ey0-f174.google.com with SMTP id 27so1565120eye.19 for ; Fri, 05 Nov 2010 01:32:49 -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=0h/pB9kqkGZN8UAaFZFRadBMTX1uVbz0qD7qws2X6aM=; b=ftZgVh40Vr4+9d2Dbm80FAKpbOS8XRHX6g3wld/3guyiqz7VoVoJazFtAVuvI1R6zD B62qY6umEUquqJaMAHELXS6rjE+x2V3XIGzOZCT/Unx4W2XOD04pcLvm3n09eFfYkHVa xUtx5G5+qRq5nBHkkJo95lSb+DrVKnzD7a5mM= 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=peI2VGU7LMjS7wiHFy9sXUPIbiBR/qqkE0SOCQhBikEaZnqzwCzU7hDOaNweZTnPXg dHCn2d/83B4U+LopGUWhV0M6ge/Lfbh9KdawJiFdbZu/GA9hFB071j0pxqwFUMrHPKoL RWuv76xc+mZ6kUAfAB1VsvqZcbHLsABI50Fiw= Received: by 10.14.45.78 with SMTP id o54mr587386eeb.41.1288945969704; Fri, 05 Nov 2010 01:32:49 -0700 (PDT) Received: from localhost.localdomain ([95.84.33.166]) by mx.google.com with ESMTPS id q58sm801154eeh.15.2010.11.05.01.32.48 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 05 Nov 2010 01:32:49 -0700 (PDT) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH 4/6] CIFS: Make cifs_fsync work with strict cache mode Date: Fri, 5 Nov 2010 11:29:35 +0300 Message-Id: <1288945777-9197-5-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:51 +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;