lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e0a95041-f0b2-49e3-be7a-6a7f2c2c5851@linux.alibaba.com>
Date: Tue, 15 Jul 2025 10:40:47 +0800
From: Gao Xiang <hsiangkao@...ux.alibaba.com>
To: linux-erofs@...ts.ozlabs.org
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] erofs: unify meta buffers in z_erofs_fill_inode()



On 2025/7/14 17:09, Gao Xiang wrote:
> There is no need to keep additional local metabufs since we already
> have one in `struct erofs_map_blocks`.
> 
> This was actually a leftover when applying meta buffers to zmap
> operations, see commit 09c543798c3c ("erofs: use meta buffers for
> zmap operations").
> 
> Signed-off-by: Gao Xiang <hsiangkao@...ux.alibaba.com>
> ---
>   fs/erofs/zmap.c | 24 ++++++++----------------
>   1 file changed, 8 insertions(+), 16 deletions(-)
> 
> diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
> index ff1d0751fc61..9afc8a68bacb 100644
> --- a/fs/erofs/zmap.c
> +++ b/fs/erofs/zmap.c
> @@ -620,13 +620,12 @@ static int z_erofs_map_blocks_ext(struct inode *inode,
>   	return 0;
>   }
>   
> -static int z_erofs_fill_inode_lazy(struct inode *inode)
> +static int z_erofs_fill_inode(struct inode *inode, struct erofs_map_blocks *map)
>   {
>   	struct erofs_inode *const vi = EROFS_I(inode);
>   	struct super_block *const sb = inode->i_sb;
>   	int err, headnr;
>   	erofs_off_t pos;
> -	struct erofs_buf buf = __EROFS_BUF_INITIALIZER;
>   	struct z_erofs_map_header *h;
>   
>   	if (test_bit(EROFS_I_Z_INITED_BIT, &vi->flags)) {
> @@ -646,7 +645,7 @@ static int z_erofs_fill_inode_lazy(struct inode *inode)
>   		goto out_unlock;
>   
>   	pos = ALIGN(erofs_iloc(inode) + vi->inode_isize + vi->xattr_isize, 8);
> -	h = erofs_read_metabuf(&buf, sb, pos);
> +	h = erofs_read_metabuf(&map->buf, sb, pos);
>   	if (IS_ERR(h)) {
>   		err = PTR_ERR(h);
>   		goto out_unlock;
> @@ -684,7 +683,7 @@ static int z_erofs_fill_inode_lazy(struct inode *inode)
>   		erofs_err(sb, "unknown HEAD%u format %u for nid %llu, please upgrade kernel",
>   			  headnr + 1, vi->z_algorithmtype[headnr], vi->nid);
>   		err = -EOPNOTSUPP;
> -		goto out_put_metabuf;
> +		goto out_unlock;
>   	}
>   
>   	if (!erofs_sb_has_big_pcluster(EROFS_SB(sb)) &&
> @@ -693,7 +692,7 @@ static int z_erofs_fill_inode_lazy(struct inode *inode)
>   		erofs_err(sb, "per-inode big pcluster without sb feature for nid %llu",
>   			  vi->nid);
>   		err = -EFSCORRUPTED;
> -		goto out_put_metabuf;
> +		goto out_unlock;
>   	}
>   	if (vi->datalayout == EROFS_INODE_COMPRESSED_COMPACT &&
>   	    !(vi->z_advise & Z_EROFS_ADVISE_BIG_PCLUSTER_1) ^
> @@ -701,27 +700,20 @@ static int z_erofs_fill_inode_lazy(struct inode *inode)
>   		erofs_err(sb, "big pcluster head1/2 of compact indexes should be consistent for nid %llu",
>   			  vi->nid);
>   		err = -EFSCORRUPTED;
> -		goto out_put_metabuf;
> +		goto out_unlock;
>   	}
>   
>   	if (vi->z_idata_size ||
>   	    (vi->z_advise & Z_EROFS_ADVISE_FRAGMENT_PCLUSTER)) {
> -		struct erofs_map_blocks map = {
> -			.buf = __EROFS_BUF_INITIALIZER
> -		};
> -
> -		err = z_erofs_map_blocks_fo(inode, &map,
> +		err = z_erofs_map_blocks_fo(inode, map,
>   					    EROFS_GET_BLOCKS_FINDTAIL);
> -		erofs_put_metabuf(&map.buf);
>   		if (err < 0)
> -			goto out_put_metabuf;
> +			goto out_unlock;

Note that it has a regression, so need to discard this part.

Thanks,
Gao Xiang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ