aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Layton <jlayton@kernel.org>2024-03-05 13:40:16 -0500
committerJeff Layton <jlayton@kernel.org>2024-04-23 07:24:31 -0400
commitc1eff20ca5feea54180dd7afe440d16f8b84dd9f (patch)
treea9e5b9bed4c0540d9b28962e25f72ac8c8f739d5
parent6dd3ba258f514fea819f5699c2c18917d4768d1c (diff)
downloadlinux-c1eff20ca5feea54180dd7afe440d16f8b84dd9f.tar.gz
nfs: skip dentry revalidation when parent dir has a delegation
If the parent has a valid delegation, then test whether the dentry->d_time matches the current change attr on the directory. If it does, then we can declare the dentry valid with no further checks. Signed-off-by: Jeff Layton <jlayton@kernel.org>
-rw-r--r--fs/nfs/dir.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index ac505671efbdb7..061648c731167b 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -2189,6 +2189,15 @@ no_open:
EXPORT_SYMBOL_GPL(nfs_atomic_open);
static int
+nfs_lookup_revalidate_delegated_parent(struct inode *dir, struct dentry *dentry,
+ struct inode *inode)
+{
+ return nfs_lookup_revalidate_done(dir, dentry, inode,
+ nfs_verify_change_attribute(dir, dentry->d_time) ?
+ 1 : 0);
+}
+
+static int
nfs4_do_lookup_revalidate(struct inode *dir, struct dentry *dentry,
unsigned int flags)
{
@@ -2212,6 +2221,9 @@ nfs4_do_lookup_revalidate(struct inode *dir, struct dentry *dentry,
if (nfs_verifier_is_delegated(dentry))
return nfs_lookup_revalidate_delegated(dir, dentry, inode);
+ if (nfs_have_delegated_attributes(dir))
+ return nfs_lookup_revalidate_delegated_parent(dir, dentry, inode);
+
/* NFS only supports OPEN on regular files */
if (!S_ISREG(inode->i_mode))
goto full_reval;