diff mbox series

[2/2] NFSv4: Just don't cache negative dentries on case insensitive servers

Message ID 20210626160956.323472-3-trond.myklebust@hammerspace.com (mailing list archive)
State New, archived
Headers show
Series Embryonic support for case insensitive filesystems | expand

Commit Message

Trond Myklebust June 26, 2021, 4:09 p.m. UTC
From: Trond Myklebust <trond.myklebust@hammerspace.com>

If the directory contents change, we cannot rely on the negative dentry
being cacheable.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfs/dir.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 1a6d2867fba4..eda0d816cbd1 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1438,6 +1438,9 @@  int nfs_neg_need_reval(struct inode *dir, struct dentry *dentry,
 		return 0;
 	if (NFS_SERVER(dir)->flags & NFS_MOUNT_LOOKUP_CACHE_NONEG)
 		return 1;
+	/* Case insensitive server? Revalidate negative dentries */
+	if (nfs_server_capable(dir, NFS_CAP_CASE_INSENSITIVE))
+		return 1;
 	return !nfs_check_verifier(dir, dentry, flags & LOOKUP_RCU);
 }