Return-Path: Received: from mail-it0-f68.google.com ([209.85.214.68]:35951 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932298AbcGFWbA (ORCPT ); Wed, 6 Jul 2016 18:31:00 -0400 Received: by mail-it0-f68.google.com with SMTP id h190so901109ith.3 for ; Wed, 06 Jul 2016 15:31:00 -0700 (PDT) From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH v4 24/28] NFS: Getattr doesn't require data sync semantics Date: Wed, 6 Jul 2016 18:30:01 -0400 Message-Id: <1467844205-76852-25-git-send-email-trond.myklebust@primarydata.com> In-Reply-To: <1467844205-76852-24-git-send-email-trond.myklebust@primarydata.com> References: <1467844205-76852-1-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-2-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-3-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-4-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-5-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-6-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-7-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-8-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-9-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-10-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-11-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-12-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-13-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-14-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-15-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-16-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-17-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-18-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-19-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-20-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-21-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-22-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-23-git-send-email-trond.myklebust@primarydata.com> <1467844205-76852-24-git-send-email-trond.myklebust@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org List-ID: When retrieving stat() information, NFS unfortunately does require us to sync writes to disk in order to ensure that mtime and ctime are up to date. However we shouldn't have to ensure that those writes are persisted. Relaxing that requirement does mean that we may see an mtime/ctime change if the server reboots and forces us to replay all writes. The exception to this rule are pNFS clients that are required to send layoutcommit, however that is dealt with by the call to pnfs_sync_inode() in _nfs_revalidate_inode(). Signed-off-by: Trond Myklebust --- fs/nfs/inode.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 7688436b19ba..35fda08dc4f6 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -661,9 +661,7 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) trace_nfs_getattr_enter(inode); /* Flush out writes to the server in order to update c/mtime. */ if (S_ISREG(inode->i_mode)) { - inode_lock(inode); - err = nfs_sync_inode(inode); - inode_unlock(inode); + err = filemap_write_and_wait(inode->i_mapping); if (err) goto out; } -- 2.7.4