]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
NFS: Fix incorrect size revalidation when holding a delegation
authorTrond Myklebust <trond.myklebust@primarydata.com>
Sun, 4 Dec 2016 23:08:40 +0000 (18:08 -0500)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Sun, 4 Dec 2016 23:08:40 +0000 (18:08 -0500)
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>
fs/nfs/file.c

index 9ea85ae23c320b2dcb7409c97c3da3fa93a4fc12..64c11f399b3d4edfb0b9416550e5391277cf5a3e 100644 (file)
@@ -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)