diff mbox series

[RFC,v3,03/16] fscrypt: export fscrypt_d_revalidate

Message ID 20200914191707.380444-4-jlayton@kernel.org (mailing list archive)
State New, archived
Headers show
Series ceph+fscrypt: context, filename and symlink support | expand

Commit Message

Jeff Layton Sept. 14, 2020, 7:16 p.m. UTC
ceph already has its own d_revalidate op so we can't rely on fscrypt
using that directly. Export this symbol so filesystems can call it
from their own d_revalidate op.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/crypto/fname.c       | 3 ++-
 include/linux/fscrypt.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Eric Biggers Sept. 15, 2020, 12:04 a.m. UTC | #1
On Mon, Sep 14, 2020 at 03:16:54PM -0400, Jeff Layton wrote:
> ceph already has its own d_revalidate op so we can't rely on fscrypt
> using that directly. Export this symbol so filesystems can call it
> from their own d_revalidate op.

IMO, a slightly clearer explanation would be:

	Since ceph already uses its own dentry_operations, it can't use
	fscrypt_d_ops.  Instead, export fscrypt_d_revalidate() so that
	ceph_d_revalidate() can call it.

Also, it turns out that ext4 and f2fs will need this too.  You could add
to the commit message:

	This change is also needed by ext4 and f2fs to add support for
	directories that are both encrypted and casefolded, since similarly the
	current "fscrypt_d_ops" approach is too inflexible for that.  See
	https://lore.kernel.org/r/20200307023611.204708-6-drosen@google.com and
	https://lore.kernel.org/r/20200307023611.204708-8-drosen@google.com.

FYI, I might take this patch for 5.10 to get it out of the way, since
now two patchsets are depending on it.

- Eric
diff mbox series

Patch

diff --git a/fs/crypto/fname.c b/fs/crypto/fname.c
index a1cb6c2c50c4..0d41eb4a5493 100644
--- a/fs/crypto/fname.c
+++ b/fs/crypto/fname.c
@@ -578,7 +578,7 @@  EXPORT_SYMBOL_GPL(fscrypt_fname_siphash);
  * Validate dentries in encrypted directories to make sure we aren't potentially
  * caching stale dentries after a key has been added.
  */
-static int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags)
+int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags)
 {
 	struct dentry *dir;
 	int err;
@@ -617,6 +617,7 @@  static int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags)
 
 	return valid;
 }
+EXPORT_SYMBOL_GPL(fscrypt_d_revalidate);
 
 const struct dentry_operations fscrypt_d_ops = {
 	.d_revalidate = fscrypt_d_revalidate,
diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h
index 95dddba3ed00..b547e1aabb00 100644
--- a/include/linux/fscrypt.h
+++ b/include/linux/fscrypt.h
@@ -204,6 +204,7 @@  int fscrypt_fname_disk_to_usr(const struct inode *inode,
 bool fscrypt_match_name(const struct fscrypt_name *fname,
 			const u8 *de_name, u32 de_name_len);
 u64 fscrypt_fname_siphash(const struct inode *dir, const struct qstr *name);
+int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags);
 
 /* bio.c */
 void fscrypt_decrypt_bio(struct bio *bio);