summaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2021-06-26 11:07:59 -0400
committerTrond Myklebust <trond.myklebust@hammerspace.com>2021-06-26 12:13:40 -0400
commita9601ac5e9160a3f96348ebc5d0751397a501701 (patch)
tree452728367fb467170a43fc71c62be8f0b6903bef /fs/nfs
parent20cf7d4ea4ad7d9830b01ff7444f6ac64a727a23 (diff)
downloadlinux-stable-a9601ac5e9160a3f96348ebc5d0751397a501701.tar.gz
linux-stable-a9601ac5e9160a3f96348ebc5d0751397a501701.tar.bz2
linux-stable-a9601ac5e9160a3f96348ebc5d0751397a501701.zip
NFS: Avoid duplicate resets of attribute cache timeouts
We know that the attributes changed on the server if and only if the change attribute is different. Otherwise, we're just refreshing our cache with values that were already known to be stale. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/inode.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 327f9ae4dd3f..2824acfe4ff9 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -2055,13 +2055,13 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
| NFS_INO_INVALID_OTHER;
if (S_ISDIR(inode->i_mode))
nfs_force_lookup_revalidate(inode);
+ attr_changed = true;
dprintk("NFS: change_attr change on server for file %s/%ld\n",
inode->i_sb->s_id,
inode->i_ino);
} else if (!have_delegation)
nfsi->cache_validity |= NFS_INO_DATA_INVAL_DEFER;
inode_set_iversion_raw(inode, fattr->change_attr);
- attr_changed = true;
}
} else {
nfsi->cache_validity |=
@@ -2094,7 +2094,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
i_size_write(inode, new_isize);
if (!have_writers)
invalid |= NFS_INO_INVALID_DATA;
- attr_changed = true;
}
dprintk("NFS: isize change on server for file %s/%ld "
"(%Ld to %Ld)\n",
@@ -2126,7 +2125,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
inode->i_mode = newmode;
invalid |= NFS_INO_INVALID_ACCESS
| NFS_INO_INVALID_ACL;
- attr_changed = true;
}
} else if (fattr_supported & NFS_ATTR_FATTR_MODE)
nfsi->cache_validity |=
@@ -2137,7 +2135,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
invalid |= NFS_INO_INVALID_ACCESS
| NFS_INO_INVALID_ACL;
inode->i_uid = fattr->uid;
- attr_changed = true;
}
} else if (fattr_supported & NFS_ATTR_FATTR_OWNER)
nfsi->cache_validity |=
@@ -2148,7 +2145,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
invalid |= NFS_INO_INVALID_ACCESS
| NFS_INO_INVALID_ACL;
inode->i_gid = fattr->gid;
- attr_changed = true;
}
} else if (fattr_supported & NFS_ATTR_FATTR_GROUP)
nfsi->cache_validity |=
@@ -2159,7 +2155,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
if (S_ISDIR(inode->i_mode))
invalid |= NFS_INO_INVALID_DATA;
set_nlink(inode, fattr->nlink);
- attr_changed = true;
}
} else if (fattr_supported & NFS_ATTR_FATTR_NLINK)
nfsi->cache_validity |=