aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2016-12-16 16:55:55 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2016-12-19 17:29:27 -0500
commite603a4c1b5c2b9d24139eeb1769c5ac600318c07 (patch)
tree9f06d8b234feaa0b3e27c5eab125325d611c65b3
parent2549f307b5997bf5dd91071428e8090d9faa8b1b (diff)
NFSv4: Update the attribute cache info in update_changeattr
If we successfully updated the change attribute, we should timestamp the cache. While we do know that the other attributes are not completely up to date, we have the NFS_INO_INVALID_ATTR flag that let us know that, so it is valid to say that the cache has not timed out. We can also clear NFS_INO_REVAL_PAGECACHE, since our change attribute is now known to be valid. Conversely, if the change attribute did not match, we should make sure to also revalidate the access and ACL caches. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r--fs/nfs/nfs4proc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index d33242c8d95d..39dfba9265f9 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1089,8 +1089,15 @@ static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo)
1089 1089
1090 spin_lock(&dir->i_lock); 1090 spin_lock(&dir->i_lock);
1091 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA; 1091 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA;
1092 if (!cinfo->atomic || cinfo->before != dir->i_version) 1092 if (cinfo->atomic && cinfo->before == dir->i_version) {
1093 nfsi->cache_validity &= ~NFS_INO_REVAL_PAGECACHE;
1094 nfsi->attrtimeo_timestamp = jiffies;
1095 } else {
1093 nfs_force_lookup_revalidate(dir); 1096 nfs_force_lookup_revalidate(dir);
1097 if (cinfo->before != dir->i_version)
1098 nfsi->cache_validity |= NFS_INO_INVALID_ACCESS |
1099 NFS_INO_INVALID_ACL;
1100 }
1094 dir->i_version = cinfo->after; 1101 dir->i_version = cinfo->after;
1095 nfsi->attr_gencount = nfs_inc_attr_generation_counter(); 1102 nfsi->attr_gencount = nfs_inc_attr_generation_counter();
1096 nfs_fscache_invalidate(dir); 1103 nfs_fscache_invalidate(dir);