Commit 1cd9cb05 authored by Trond Myklebust's avatar Trond Myklebust

NFS: Only look at the change attribute cache state in nfs_check_verifier

When looking at whether or not our dcache is valid, we really don't care
about the general state of the directory attribute cache. Instead, we
we only care about the state of the change attribute.

This fixes a performance issue when the client is responsible for
changing the directory contents; a number of NFSv4 operations will
atomically update the directory change attribute, but may not return
all the other attributes.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 9310b224
...@@ -1030,8 +1030,6 @@ EXPORT_SYMBOL_GPL(nfs_force_lookup_revalidate); ...@@ -1030,8 +1030,6 @@ EXPORT_SYMBOL_GPL(nfs_force_lookup_revalidate);
static int nfs_check_verifier(struct inode *dir, struct dentry *dentry, static int nfs_check_verifier(struct inode *dir, struct dentry *dentry,
int rcu_walk) int rcu_walk)
{ {
int ret;
if (IS_ROOT(dentry)) if (IS_ROOT(dentry))
return 1; return 1;
if (NFS_SERVER(dir)->flags & NFS_MOUNT_LOOKUP_CACHE_NONE) if (NFS_SERVER(dir)->flags & NFS_MOUNT_LOOKUP_CACHE_NONE)
...@@ -1039,12 +1037,12 @@ static int nfs_check_verifier(struct inode *dir, struct dentry *dentry, ...@@ -1039,12 +1037,12 @@ static int nfs_check_verifier(struct inode *dir, struct dentry *dentry,
if (!nfs_verify_change_attribute(dir, dentry->d_time)) if (!nfs_verify_change_attribute(dir, dentry->d_time))
return 0; return 0;
/* Revalidate nfsi->cache_change_attribute before we declare a match */ /* Revalidate nfsi->cache_change_attribute before we declare a match */
if (rcu_walk) if (nfs_mapping_need_revalidate_inode(dir)) {
ret = nfs_revalidate_inode_rcu(NFS_SERVER(dir), dir); if (rcu_walk)
else return 0;
ret = nfs_revalidate_inode(NFS_SERVER(dir), dir); if (__nfs_revalidate_inode(NFS_SERVER(dir), dir) < 0)
if (ret < 0) return 0;
return 0; }
if (!nfs_verify_change_attribute(dir, dentry->d_time)) if (!nfs_verify_change_attribute(dir, dentry->d_time))
return 0; return 0;
return 1; return 1;
......
...@@ -1112,7 +1112,7 @@ static int nfs_invalidate_mapping(struct inode *inode, struct address_space *map ...@@ -1112,7 +1112,7 @@ static int nfs_invalidate_mapping(struct inode *inode, struct address_space *map
return 0; return 0;
} }
static bool nfs_mapping_need_revalidate_inode(struct inode *inode) bool nfs_mapping_need_revalidate_inode(struct inode *inode)
{ {
unsigned long cache_validity = NFS_I(inode)->cache_validity; unsigned long cache_validity = NFS_I(inode)->cache_validity;
......
...@@ -345,6 +345,7 @@ extern int nfs_attribute_cache_expired(struct inode *inode); ...@@ -345,6 +345,7 @@ extern int nfs_attribute_cache_expired(struct inode *inode);
extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode);
extern int nfs_revalidate_inode_rcu(struct nfs_server *server, struct inode *inode); extern int nfs_revalidate_inode_rcu(struct nfs_server *server, struct inode *inode);
extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
extern bool nfs_mapping_need_revalidate_inode(struct inode *inode);
extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
extern int nfs_revalidate_mapping_rcu(struct inode *inode); extern int nfs_revalidate_mapping_rcu(struct inode *inode);
extern int nfs_setattr(struct dentry *, struct iattr *); extern int nfs_setattr(struct dentry *, struct iattr *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment