Re: [RFC 1/2] gfs2: replace sd_aspace with sd_inode

From: Tetsuo Handa
Date: Tue Apr 08 2025 - 02:56:12 EST


On 2025/04/08 3:21, Andreas Gruenbacher wrote:
> @@ -1156,6 +1146,18 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc)
> sb->s_flags |= SB_NOSEC;
> sb->s_magic = GFS2_MAGIC;
> sb->s_op = &gfs2_super_ops;
> +
> + /* Set up an address space for metadata writes */
> + sdp->sd_inode = new_inode(sb);
> + if (!sdp->sd_inode)
> + goto fail_free;
> + sdp->sd_inode->i_ino = GFS2_BAD_INO;
> + sdp->sd_inode->i_size = OFFSET_MAX;
> +
> + mapping = gfs2_aspace(sdp);
> + mapping->a_ops = &gfs2_rgrp_aops;
> + mapping_set_gfp_mask(mapping, GFP_NOFS);
> +
> sb->s_d_op = &gfs2_dops;
> sb->s_export_op = &gfs2_export_ops;
> sb->s_qcop = &gfs2_quotactl_ops;

This will be an inode leak when hitting e.g.

error = init_names(sdp, silent);
if (error)
goto fail_free;

path, for what free_sbd() in

fail_free:
free_sbd(sdp);
sb->s_fs_info = NULL;
return error;

path does is nothing but free_percpu() and kfree().