[RFC PATCH v3 13/16] ceph: make d_revalidate call fscrypt revalidator for encrypted dentries

Jeff Layton
2020-09-14T19:19:20Z

If we have a dentry which represents a no-key name, then we need to test
whether the parent directory's encryption key has since been added. Do
that before we test anything else about the dentry.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/ceph/dir.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index b1e04d7d4b68..b6e5d751024d 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -1689,6 +1689,10 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
dout("d_revalidate %p '%pd' inode %p offset 0x%llx\n", dentry,
dentry, inode, ceph_dentry(dentry)->offset);

+ valid = fscrypt_d_revalidate(dentry, flags);
+ if (valid <= 0)
+ return valid;
+
mdsc = ceph_sb_to_client(dir->i_sb)->mdsc;

/* always trust cached snapped dentries, snapdir dentry */
--
2.26.2