diff mbox series

[v3,8/8] NFS: Revalidate the directory pagecache on every nfs_readdir()

Message ID f5f8213a46c4dd30ec202af1b75bb702db99acf5.1645623510.git.bcodding@redhat.com (mailing list archive)
State New, archived
Headers show
Series [v3,1/8] NFS: save the directory's change attribute on pagecache pages | expand

Commit Message

Benjamin Coddington Feb. 23, 2022, 1:40 p.m. UTC
Since there's no longer a significant performance penalty for dropping the
pagecache, and because we want to ensure that the directory's change
attribute is accurate before validating pagecache pages, revalidate the
directory's mapping on every call to nfs_readdir().

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 fs/nfs/dir.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index a570f14633ab..565ff26e1b52 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1271,11 +1271,9 @@  static int nfs_readdir(struct file *file, struct dir_context *ctx)
 	 * to either find the entry with the appropriate number or
 	 * revalidate the cookie.
 	 */
-	if (ctx->pos == 0 || nfs_attribute_cache_expired(inode)) {
-		res = nfs_revalidate_mapping(inode, file->f_mapping);
-		if (res < 0)
-			goto out;
-	}
+	res = nfs_revalidate_mapping(inode, file->f_mapping);
+	if (res < 0)
+		goto out;
 
 	res = -ENOMEM;
 	desc = kzalloc(sizeof(*desc), GFP_KERNEL);