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>
This commit is contained in:
Trond Myklebust 2016-06-07 21:44:08 -04:00
parent 5edb56491d
commit 38512aa98a

View File

@ -1729,12 +1729,15 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
if (inode->i_version != fattr->change_attr) { if (inode->i_version != fattr->change_attr) {
dprintk("NFS: change_attr change on server for file %s/%ld\n", dprintk("NFS: change_attr change on server for file %s/%ld\n",
inode->i_sb->s_id, inode->i_ino); inode->i_sb->s_id, inode->i_ino);
invalid |= NFS_INO_INVALID_ATTR /* Could it be a race with writeback? */
| NFS_INO_INVALID_DATA if (nfsi->nrequests == 0) {
| NFS_INO_INVALID_ACCESS invalid |= NFS_INO_INVALID_ATTR
| NFS_INO_INVALID_ACL; | NFS_INO_INVALID_DATA
if (S_ISDIR(inode->i_mode)) | NFS_INO_INVALID_ACCESS
nfs_force_lookup_revalidate(inode); | NFS_INO_INVALID_ACL;
if (S_ISDIR(inode->i_mode))
nfs_force_lookup_revalidate(inode);
}
inode->i_version = fattr->change_attr; inode->i_version = fattr->change_attr;
} }
} else { } else {