summaryrefslogtreecommitdiff
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2016-12-04 16:02:43 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2016-12-04 16:50:09 -0500
commit10727772b93cc80c859b2e45bb32976d79b21990 (patch)
treed77e08786a7816a6972082eccd76bb037f4996b1 /fs/nfs/inode.c
parent230bc962a6ffef8b15ac1fd2664ae9d4b56a64a6 (diff)
NFS: Fix incorrect mapping revalidation when holding a delegation
We should only care about checking the attributes if the page cache is marked as dubious (using NFS_INO_REVAL_PAGECACHE) and the NFS_INO_REVAL_FORCED flag is set. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 75f5a9cb2e66..df4d7ec348ed 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1114,9 +1114,15 @@ static int nfs_invalidate_mapping(struct inode *inode, struct address_space *map
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)
+ unsigned long cache_validity = NFS_I(inode)->cache_validity;
+
+ if (NFS_PROTO(inode)->have_delegation(inode, FMODE_READ)) {
+ const unsigned long force_reval =
+ NFS_INO_REVAL_PAGECACHE|NFS_INO_REVAL_FORCED;
+ return (cache_validity & force_reval) == force_reval;
+ }
+
+ return (cache_validity & NFS_INO_REVAL_PAGECACHE)
|| nfs_attribute_timeout(inode)
|| NFS_STALE(inode);
}