diff options
-rw-r--r-- | fs/nfs/inode.c | 13 |
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 | |||
870 | return 0; | 870 | return 0; |
871 | } | 871 | } |
872 | 872 | ||
873 | static bool nfs_mapping_need_revalidate_inode(struct inode *inode) | ||
874 | { | ||
875 | if (nfs_have_delegated_attributes(inode)) | ||
876 | return false; | ||
877 | return (NFS_I(inode)->cache_validity & NFS_INO_REVAL_PAGECACHE) | ||
878 | || nfs_attribute_timeout(inode) | ||
879 | || NFS_STALE(inode); | ||
880 | } | ||
881 | |||
873 | /** | 882 | /** |
874 | * nfs_revalidate_mapping - Revalidate the pagecache | 883 | * nfs_revalidate_mapping - Revalidate the pagecache |
875 | * @inode - pointer to host inode | 884 | * @inode - pointer to host inode |
@@ -880,9 +889,7 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) | |||
880 | struct nfs_inode *nfsi = NFS_I(inode); | 889 | struct nfs_inode *nfsi = NFS_I(inode); |
881 | int ret = 0; | 890 | int ret = 0; |
882 | 891 | ||
883 | if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE) | 892 | if (nfs_mapping_need_revalidate_inode(inode)) { |
884 | || nfs_attribute_cache_expired(inode) | ||
885 | || NFS_STALE(inode)) { | ||
886 | ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode); | 893 | ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode); |
887 | if (ret < 0) | 894 | if (ret < 0) |
888 | goto out; | 895 | goto out; |