summaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2016-06-07 21:44:08 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2016-06-13 12:36:02 -0400
commit38512aa98a3feb6acd7da8f0ed5dade5b592b426 (patch)
treee1fa449965d1f93dcf019881a240805520c573f2 /fs/nfs/inode.c
parent5edb56491d4812c42175980759da53388e5d86f5 (diff)
downloadlinux-38512aa98a3feb6acd7da8f0ed5dade5b592b426.tar.gz
linux-38512aa98a3feb6acd7da8f0ed5dade5b592b426.tar.bz2
linux-38512aa98a3feb6acd7da8f0ed5dade5b592b426.zip
NFS: Don't flush caches for a getattr that races with writeback
If there were outstanding writes then chalk up the unexpected change attribute on the server to them. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 52e7d6869e3b..60051e62d3f1 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1729,12 +1729,15 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
if (inode->i_version != fattr->change_attr) {
dprintk("NFS: change_attr change on server for file %s/%ld\n",
inode->i_sb->s_id, inode->i_ino);
- invalid |= NFS_INO_INVALID_ATTR
- | NFS_INO_INVALID_DATA
- | NFS_INO_INVALID_ACCESS
- | NFS_INO_INVALID_ACL;
- if (S_ISDIR(inode->i_mode))
- nfs_force_lookup_revalidate(inode);
+ /* Could it be a race with writeback? */
+ if (nfsi->nrequests == 0) {
+ invalid |= NFS_INO_INVALID_ATTR
+ | NFS_INO_INVALID_DATA
+ | NFS_INO_INVALID_ACCESS
+ | NFS_INO_INVALID_ACL;
+ if (S_ISDIR(inode->i_mode))
+ nfs_force_lookup_revalidate(inode);
+ }
inode->i_version = fattr->change_attr;
}
} else {