On 9/15/22 8:42 PM, Jia Zhu wrote:

>  static int erofs_init_fs_context(struct fs_context *fc)
>  {
> -     struct erofs_fs_context *ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
> +     struct erofs_fs_context *ctx;
> +

We'd better add a simple comment here:

+       /* pseudo mount for anon inodes */
> +     if (fc->sb_flags & SB_KERNMOUNT) {
> +             fc->ops = &erofs_anon_context_ops;
> +             return 0;
> +     }

which will be more friendly to those not familiar with the background.

>  
> +     ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
>       if (!ctx)
>               return -ENOMEM;
>       ctx->devs = kzalloc(sizeof(struct erofs_dev_context), GFP_KERNEL);
> @@ -874,6 +896,11 @@ static void erofs_kill_sb(struct super_block *sb)
>  
>       WARN_ON(sb->s_magic != EROFS_SUPER_MAGIC);
>  
> +     if (sb->s_flags & SB_KERNMOUNT) {
> +             kill_litter_super(sb);

I think kill_anon_super() is enough. At least in our case, there's only
one root dentry inside the anon super and thus d_genocide() is actually
a noop.


Otherwise LGTM.
Reviewed-by: Jingbo Xu <[email protected]>


-- 
Thanks,
Jingbo

Reply via email to