summaryrefslogtreecommitdiffstats
path: root/fs/nfs/file.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2016-12-09 00:18:38 +0100
committerTrond Myklebust <trond.myklebust@primarydata.com>2016-12-19 23:29:35 +0100
commit61540bf6bb40ddfa3e766de91cedca2e1afd24eb (patch)
tree36d2a5f7ad7086cb0cdde12bdd6907676db080f0 /fs/nfs/file.c
parentNFS: Don't revalidate the file on close if we hold a delegation (diff)
downloadlinux-61540bf6bb40ddfa3e766de91cedca2e1afd24eb.tar.xz
linux-61540bf6bb40ddfa3e766de91cedca2e1afd24eb.zip
NFS: Clean up cache validity checking
Consolidate the open-coded checking of NFS_I(inode)->cache_validity into a couple of helper functions. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/file.c')
-rw-r--r--fs/nfs/file.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 64c11f399b3d..599a602cb2fd 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -101,21 +101,11 @@ EXPORT_SYMBOL_GPL(nfs_file_release);
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_PROTO(inode)->have_delegation(inode, FMODE_READ) &&
- (cache_validity & force_reval) != force_reval)
- goto out_noreval;
if (filp->f_flags & O_DIRECT)
goto force_reval;
- if (nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE)
- goto force_reval;
- if (nfs_attribute_timeout(inode))
+ if (nfs_check_cache_invalid(inode, NFS_INO_REVAL_PAGECACHE))
goto force_reval;
-out_noreval:
return 0;
force_reval:
return __nfs_revalidate_inode(server, inode);