fscrypt: export fscrypt_d_revalidate()
Eric Biggers
maintainerPATCH 1/1 fscrypt: export fscrypt_d_revalidate()
From: Eric Biggers <[email protected]>
Dentries that represent no-key names must have a dentry_operations that includes fscrypt_d_revalidate(). Currently, this is handled by fscrypt_prepare_lookup() installing fscrypt_d_ops.
However, ceph support for encryption
(https://lore.kernel.org/r/[email protected])
can't use fscrypt_d_ops, since ceph already has its own dentry_operations.
Similarly, ext4 and f2fs support for directories that are both encrypted and casefolded
(https://lore.kernel.org/r/[email protected])
can't use fscrypt_d_ops either, since casefolding requires some dentry operations too.
To satisfy both users, we need to move the responsibility of installing the dentry_operations to filesystems.
In preparation for this, export fscrypt_d_revalidate() and give it a !CONFIG_FS_ENCRYPTION stub.
---
Compared to the versions of this patch from Jeff and Daniel, I've improved the commit message and added a !CONFIG_FS_ENCRYPTION stub, which was missing. I'm planning to apply this for 5.10 in preparation for both the ceph patchset and the encrypt+casefold patchset.
fs/crypto/fname.c | 3 ++- include/linux/fscrypt.h | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
fs/crypto/fname.c +2 -1
@@ -530,7 +530,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;
@@ -569,6 +569,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,
include/linux/fscrypt.h +7 -0
@@ -197,6 +197,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);
@@ -454,6 +455,12 @@ static inline u64 fscrypt_fname_siphash(const struct inode *dir,return 0 ; } +static inline int fscrypt_d_revalidate (struct dentry *dentry, +unsigned int flags) +{ +return 1 ; +} +/* bio.c */ static inline void fscrypt_decrypt_bio (struct bio *bio) {
Signature · 1 line
2.28.0
Quoted 72 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Dentries that represent no-key names must have a
dentry_operationsthat includesfscrypt_d_revalidate(). Currently, this is handled byfscrypt_prepare_lookup()installingfscrypt_d_ops.However, ceph support for encryption
(https://lore.kernel.org/r/[email protected])
can't usefscrypt_d_ops, since ceph already has its owndentry_operations.Similarly, ext4 and f2fs support for directories that are both encrypted and casefolded
(https://lore.kernel.org/r/[email protected])
can't usefscrypt_d_opseither, since casefolding requires some dentry operations too.To satisfy both users, we need to move the responsibility of installing the
dentry_operationsto filesystems.In preparation for this, export
fscrypt_d_revalidate()and give it a !CONFIG_FS_ENCRYPTION stub.Signed-off-by Eric Biggers <[email protected]>---
Compared to the versions of this patch from Jeff and Daniel, I've improved the commit message and added a !CONFIG_FS_ENCRYPTION stub, which was missing. I'm planning to apply this for 5.10 in preparation for both the ceph patchset and the encrypt+casefold patchset.
fs/crypto/fname.c | 3 ++- include/linux/fscrypt.h | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)fs/crypto/fname.c +2
-1@@ -530,7 +530,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;@@ -569,6 +569,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,include/linux/fscrypt.h +1
-0@@ -197,6 +197,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);@@ -454,6 +455,12 @@ static inline u64 fscrypt_fname_siphash(const struct inode *dir,return 0 ; }
include/linux/fscrypt.h static inline u64 fscrypt_fname_siphash(const struct inode *dir, · line 466
Quoted 10 lines
include/linux/fscrypt.h +6
-0+static inline int fscrypt_d_revalidate (struct dentry *dentry, +unsigned int flags) +{ +return 1 ; +} +/* bio.c */ static inline void fscrypt_decrypt_bio (struct bio *bio) {
Quoted 32 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Dentries that represent no-key names must have a
dentry_operationsthat includesfscrypt_d_revalidate(). Currently, this is handled byfscrypt_prepare_lookup()installingfscrypt_d_ops.However, ceph support for encryption
(https://lore.kernel.org/r/[email protected])
can't usefscrypt_d_ops, since ceph already has its owndentry_operations.Similarly, ext4 and f2fs support for directories that are both encrypted and casefolded
(https://lore.kernel.org/r/[email protected])
can't usefscrypt_d_opseither, since casefolding requires some dentry operations too.To satisfy both users, we need to move the responsibility of installing the
dentry_operationsto filesystems.In preparation for this, export
fscrypt_d_revalidate()and give it a !CONFIG_FS_ENCRYPTION stub.Signed-off-by Eric Biggers <[email protected]>---
Compared to the versions of this patch from Jeff and Daniel, I've improved the commit message and added a !CONFIG_FS_ENCRYPTION stub, which was missing. I'm planning to apply this for 5.10 in preparation for both the ceph patchset and the encrypt+casefold patchset.
Quoted 3 lines
fs/crypto/fname.c | 3 ++- include/linux/fscrypt.h | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
Applied to fscrypt.git#master for 5.10.
- Eric
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel