ext4: Configure dentry operations at dentry-creation time
authorGabriel Krisman Bertazi <krisman@suse.de>
Wed, 21 Feb 2024 17:14:09 +0000 (12:14 -0500)
committerGabriel Krisman Bertazi <krisman@suse.de>
Tue, 27 Feb 2024 21:55:34 +0000 (16:55 -0500)
This was already the case for case-insensitive before commit
bb9cd9106b22 ("fscrypt: Have filesystems handle their d_ops"), but it
was changed to set at lookup-time to facilitate the integration with
fscrypt.  But it's a problem because dentries that don't get created
through ->lookup() won't have any visibility of the operations.

Since fscrypt now also supports configuring dentry operations at
creation-time, do it for any encrypted and/or casefold volume,
simplifying the implementation across these features.

Acked-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20240221171412.10710-8-krisman@suse.de
Signed-off-by: Gabriel Krisman Bertazi <krisman@suse.de>
fs/ext4/namei.c
fs/ext4/super.c

index 05b647e6bc19547a117214b17226d97420887ce6..5e4f65c14dfb9e2d508f259fd2bb7013b7da38a8 100644 (file)
@@ -1762,7 +1762,6 @@ static struct buffer_head *ext4_lookup_entry(struct inode *dir,
        struct buffer_head *bh;
 
        err = ext4_fname_prepare_lookup(dir, dentry, &fname);
-       generic_set_encrypted_ci_d_ops(dentry);
        if (err == -ENOENT)
                return NULL;
        if (err)
index dcba0f85dfe245ab83598d5a451783b02044be52..215b4614eb1583916ae3b37e528694651937e25b 100644 (file)
@@ -5484,6 +5484,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
                goto failed_mount4;
        }
 
+       generic_set_sb_d_ops(sb);
        sb->s_root = d_make_root(root);
        if (!sb->s_root) {
                ext4_msg(sb, KERN_ERR, "get root dentry failed");