summaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
authorTrond Myklebust2012-04-29 17:23:50 +0200
committerTrond Myklebust2012-05-01 21:42:40 +0200
commitb4b1eadf7c5f00636500ad47f68edc0666e63ea5 (patch)
tree2ae583a6b89597655ebbf63fb3d00364061b48ad /fs/nfs/inode.c
parentNFSv4: Retrieve attributes _before_ calling delegreturn (diff)
downloadkernel-qcow2-linux-b4b1eadf7c5f00636500ad47f68edc0666e63ea5.tar.gz
kernel-qcow2-linux-b4b1eadf7c5f00636500ad47f68edc0666e63ea5.tar.xz
kernel-qcow2-linux-b4b1eadf7c5f00636500ad47f68edc0666e63ea5.zip
NFS: Don't force page cache revalidations when holding a delegation
If we're holding a delegation, then we already know that our page cache is valid. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 59a12c6a8df6..fed27c0d1a4d 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -870,6 +870,15 @@ static int nfs_invalidate_mapping(struct inode *inode, struct address_space *map
return 0;
}
+static bool nfs_mapping_need_revalidate_inode(struct inode *inode)
+{
+ if (nfs_have_delegated_attributes(inode))
+ return false;
+ return (NFS_I(inode)->cache_validity & NFS_INO_REVAL_PAGECACHE)
+ || nfs_attribute_timeout(inode)
+ || NFS_STALE(inode);
+}
+
/**
* nfs_revalidate_mapping - Revalidate the pagecache
* @inode - pointer to host inode
@@ -880,9 +889,7 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)
struct nfs_inode *nfsi = NFS_I(inode);
int ret = 0;
- if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE)
- || nfs_attribute_cache_expired(inode)
- || NFS_STALE(inode)) {
+ if (nfs_mapping_need_revalidate_inode(inode)) {
ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode);
if (ret < 0)
goto out;