aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/dir.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2022-02-22 16:23:12 -0500
committerTrond Myklebust <trond.myklebust@hammerspace.com>2022-03-02 08:43:38 -0500
commit6c34f05b754622f473b546fd19ad3a89bd65bd89 (patch)
treeb5d586c64425cfa4cf366d938026244ff6525148 /fs/nfs/dir.c
parentNFS: Adjust the amount of readahead performed by NFS readdir (diff)
downloadlinux-dev-6c34f05b754622f473b546fd19ad3a89bd65bd89.tar.xz
linux-dev-6c34f05b754622f473b546fd19ad3a89bd65bd89.zip
NFS: If the cookie verifier changes, we must invalidate the page cache
Ensure that if the cookie verifier changes when we use the zero-valued cookie, then we invalidate any cached pages. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'fs/nfs/dir.c')
-rw-r--r--fs/nfs/dir.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 520dc3ec4aef..9998d7d17367 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -990,9 +990,14 @@ static int find_and_lock_cache_page(struct nfs_readdir_descriptor *desc)
/*
* Set the cookie verifier if the page cache was empty
*/
- if (desc->page_index == 0)
+ if (desc->last_cookie == 0 &&
+ memcmp(nfsi->cookieverf, verf, sizeof(nfsi->cookieverf))) {
memcpy(nfsi->cookieverf, verf,
sizeof(nfsi->cookieverf));
+ invalidate_inode_pages2_range(desc->file->f_mapping,
+ desc->page_index_max + 1,
+ -1);
+ }
}
res = nfs_readdir_search_array(desc);
if (res == 0)