summaryrefslogtreecommitdiffstats
path: root/fs/nfs/file.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2016-12-04 18:08:40 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2016-12-04 18:08:40 -0500
commit9310b224f2ecc8bb075b86d753a2f359e3e1ac85 (patch)
tree9f7ab346783d43d70a6a148f3b46499ac20de054 /fs/nfs/file.c
parent10727772b93cc80c859b2e45bb32976d79b21990 (diff)
downloadlinux-9310b224f2ecc8bb075b86d753a2f359e3e1ac85.tar.bz2
NFS: Fix incorrect size 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/file.c')
-rw-r--r--fs/nfs/file.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 9ea85ae23c32..64c11f399b3d 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -102,8 +102,11 @@ static int nfs_revalidate_file_size(struct inode *inode, struct file *filp)
{
struct nfs_server *server = NFS_SERVER(inode);
struct nfs_inode *nfsi = NFS_I(inode);
+ const unsigned long force_reval = NFS_INO_REVAL_PAGECACHE|NFS_INO_REVAL_FORCED;
+ unsigned long cache_validity = nfsi->cache_validity;
- if (nfs_have_delegated_attributes(inode))
+ if (NFS_PROTO(inode)->have_delegation(inode, FMODE_READ) &&
+ (cache_validity & force_reval) != force_reval)
goto out_noreval;
if (filp->f_flags & O_DIRECT)