aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
authorHou Tao <houtao1@huawei.com>2017-04-28 06:35:19 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2017-05-05 13:01:32 -0400
commit59b86d85a7a30ba56289cdac83cd66a7dd2adebf (patch)
treea0cbecb6dc4b59e6323fe5236caa37610f1e8223 /fs/nfs/inode.c
parent5c737cb29977896eb0f373d3adbcdea73b815808 (diff)
NFS: always treat the invocation of nfs_getattr as cache hit when noac is on
When using 'ls -l' to display a large directory, if noac option is used, in function nfs_getattr() nfs_need_revalidate_inode() will always be true for NFSv3 and the nfs_entry cache of the directory will be flushed. The flush will lead to a fully reread of the directory entries from server. To prevent the unnecessary RPCs, we need to check whether or not the noac option is used, and always report the invocation of nfs_getattr() as cache hit instead cache miss when it's on. Signed-off-by: Hou Tao <houtao1@huawei.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index f489a5a71bd5..1de93ba78dc9 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -734,7 +734,10 @@ int nfs_getattr(const struct path *path, struct kstat *stat,
734 if (need_atime || nfs_need_revalidate_inode(inode)) { 734 if (need_atime || nfs_need_revalidate_inode(inode)) {
735 struct nfs_server *server = NFS_SERVER(inode); 735 struct nfs_server *server = NFS_SERVER(inode);
736 736
737 nfs_readdirplus_parent_cache_miss(path->dentry); 737 if (!(server->flags & NFS_MOUNT_NOAC))
738 nfs_readdirplus_parent_cache_miss(path->dentry);
739 else
740 nfs_readdirplus_parent_cache_hit(path->dentry);
738 err = __nfs_revalidate_inode(server, inode); 741 err = __nfs_revalidate_inode(server, inode);
739 } else 742 } else
740 nfs_readdirplus_parent_cache_hit(path->dentry); 743 nfs_readdirplus_parent_cache_hit(path->dentry);