diff mbox series

[RFC,12/14] ceph: make d_revalidate call fscrypt revalidator for encrypted dentries

Message ID 20200821182813.52570-13-jlayton@kernel.org (mailing list archive)
State New, archived
Headers show
Series ceph+fscrypt: together at last (contexts and filenames) | expand

Commit Message

Jeff Layton Aug. 21, 2020, 6:28 p.m. UTC
If we have an encrypted dentry, then we need to test whether a new key
might have been established or removed. Do that before we test anything
else about the dentry.

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

Patch

diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 2e7f2bfa2c12..d2104c115868 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -1701,6 +1701,12 @@  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);
 
+	if (IS_ENCRYPTED(dir)) {
+		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 */