Re: [PATCH v6 07/10] tmpfs: Add casefold lookup support

From: Gabriel Krisman Bertazi
Date: Tue Oct 15 2024 - 14:36:59 EST


André Almeida <andrealmeid@xxxxxxxxxx> writes:


> @@ -4663,10 +4756,24 @@ static int shmem_fill_super(struct super_block *sb, struct fs_context *fc)
> sb->s_export_op = &shmem_export_ops;
> sb->s_flags |= SB_NOSEC | SB_I_VERSION;
>
> - sb->s_d_op = &simple_dentry_operations;
> + if (!ctx->encoding && ctx->strict_encoding) {
> + pr_err("tmpfs: strict_encoding option without encoding is forbidden\n");
> + error = -EINVAL;
> + goto failed;
> + }
> +
> +#if IS_ENABLED(CONFIG_UNICODE)
> + if (ctx->encoding) {
> + sb->s_encoding = ctx->encoding;
> + sb->s_d_op = &shmem_ci_dentry_ops;
> + if (ctx->strict_encoding)
> + sb->s_encoding_flags = SB_ENC_STRICT_MODE_FL;
> + }
> +#endif

Actually...

The previous patch moved the dentry ops configuration for the !casefolded case to this
place, only for thsi patch to remove it. Drop patch 6, instead?

> +
> #else
> sb->s_flags |= SB_NOUSER;
> -#endif
> +#endif /* CONFIG_TMPFS */
> sbinfo->max_blocks = ctx->blocks;
> sbinfo->max_inodes = ctx->inodes;
> sbinfo->free_ispace = sbinfo->max_inodes * BOGO_INODE_SIZE;
> @@ -4940,6 +5047,8 @@ int shmem_init_fs_context(struct fs_context *fc)
> ctx->uid = current_fsuid();
> ctx->gid = current_fsgid();
>
> + ctx->encoding = NULL;
> +
> fc->fs_private = ctx;
> fc->ops = &shmem_fs_context_ops;
> return 0;

--
Gabriel Krisman Bertazi