[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231213234031.1081-3-krisman@suse.de>
Date: Wed, 13 Dec 2023 18:40:25 -0500
From: Gabriel Krisman Bertazi <krisman@...e.de>
To: viro@...iv.linux.org.uk,
ebiggers@...nel.org,
jaegeuk@...nel.org,
tytso@....edu
Cc: linux-f2fs-devel@...ts.sourceforge.net,
linux-ext4@...r.kernel.org,
linux-fsdevel@...r.kernel.org,
Gabriel Krisman Bertazi <krisman@...e.de>
Subject: [PATCH 2/8] fscrypt: Drop d_revalidate if key is available
fscrypt dentries are always valid once the key is available. Since the
key cannot be removed without evicting the dentry, we don't need to keep
retrying to revalidate it.
Signed-off-by: Gabriel Krisman Bertazi <krisman@...e.de>
---
fs/crypto/fname.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/fs/crypto/fname.c b/fs/crypto/fname.c
index 7b3fc189593a..0457ba2d7d76 100644
--- a/fs/crypto/fname.c
+++ b/fs/crypto/fname.c
@@ -591,8 +591,15 @@ int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags)
* reverting to no-key names without evicting the directory's inode
* -- which implies eviction of the dentries in the directory.
*/
- if (!(dentry->d_flags & DCACHE_NOKEY_NAME))
+ if (!(dentry->d_flags & DCACHE_NOKEY_NAME)) {
+ /*
+ * If fscrypt is the only feature requiring
+ * revalidation for this dentry, we can just disable it.
+ */
+ if (dentry->d_op->d_revalidate == &fscrypt_d_revalidate)
+ d_set_always_valid(dentry);
return 1;
+ }
/*
* No-key name; valid if the directory's key is still unavailable.
--
2.43.0
Powered by blists - more mailing lists