Skip to content

Commit 38512aa

Browse files
committed
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>
1 parent 5edb564 commit 38512aa

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

fs/nfs/inode.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1729,12 +1729,15 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
17291729
if (inode->i_version != fattr->change_attr) {
17301730
dprintk("NFS: change_attr change on server for file %s/%ld\n",
17311731
inode->i_sb->s_id, inode->i_ino);
1732-
invalid |= NFS_INO_INVALID_ATTR
1733-
| NFS_INO_INVALID_DATA
1734-
| NFS_INO_INVALID_ACCESS
1735-
| NFS_INO_INVALID_ACL;
1736-
if (S_ISDIR(inode->i_mode))
1737-
nfs_force_lookup_revalidate(inode);
1732+
/* Could it be a race with writeback? */
1733+
if (nfsi->nrequests == 0) {
1734+
invalid |= NFS_INO_INVALID_ATTR
1735+
| NFS_INO_INVALID_DATA
1736+
| NFS_INO_INVALID_ACCESS
1737+
| NFS_INO_INVALID_ACL;
1738+
if (S_ISDIR(inode->i_mode))
1739+
nfs_force_lookup_revalidate(inode);
1740+
}
17381741
inode->i_version = fattr->change_attr;
17391742
}
17401743
} else {

0 commit comments

Comments
 (0)