Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 10727772 authored by Trond Myklebust's avatar Trond Myklebust
Browse files

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: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 230bc962
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -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)
static bool nfs_mapping_need_revalidate_inode(struct inode *inode)
{
{
	if (nfs_have_delegated_attributes(inode))
	unsigned long cache_validity = NFS_I(inode)->cache_validity;
		return false;

	return (NFS_I(inode)->cache_validity & NFS_INO_REVAL_PAGECACHE)
	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_attribute_timeout(inode)
		|| NFS_STALE(inode);
		|| NFS_STALE(inode);
}
}