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: <Y+nhCUVbH0IA2FwV@li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com>
Date:   Mon, 13 Feb 2023 12:34:41 +0530
From:   Ojaswin Mujoo <ojaswin@...ux.ibm.com>
To:     Kemeng Shi <shikemeng@...weicloud.com>
Cc:     tytso@....edu, adilger.kernel@...ger.ca, jack@...e.cz,
        linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 05/21] ext4: correct calculation of s_mb_preallocated

On Fri, Feb 10, 2023 at 03:48:09AM +0800, Kemeng Shi wrote:
> We will add pa_free to s_mb_preallocated when new ext4_prealloc_space is
> created. In ext4_mb_new_inode_pa, we will call ext4_mb_use_inode_pa
> before adding pa_free to s_mb_preallocated. However, ext4_mb_use_inode_pa
> will consume pa_free for block allocation which triggerred the creation
> of ext4_prealloc_space. Add pa_free to s_mb_preallocated before
> ext4_mb_use_inode_pa to correct calculation of s_mb_preallocated.
> There is no such problem in ext4_mb_new_group_pa as pa_free of group pa
> is consumed in ext4_mb_release_context instead of ext4_mb_use_group_pa.
> 
> Signed-off-by: Kemeng Shi <shikemeng@...weicloud.com>
> ---
>  fs/ext4/mballoc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index f24f80ecf318..2bffc93778d5 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -4670,8 +4670,8 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac)
>  		 pa->pa_len, pa->pa_lstart);
>  	trace_ext4_mb_new_inode_pa(ac, pa);
>  
> -	ext4_mb_use_inode_pa(ac, pa);
>  	atomic_add(pa->pa_free, &sbi->s_mb_preallocated);
> +	ext4_mb_use_inode_pa(ac, pa);
>  
>  	ei = EXT4_I(ac->ac_inode);
>  	grp = ext4_get_group_info(sb, ac->ac_b_ex.fe_group);
> -- 
> 2.30.0
> 
My understanding is that s_mb_preallocated is for all the blocks we ever preallocated and
so we need to add 'original' pa_len instead of (pa_len - best_len).

Hence, the patch looks correct to me. Feel free to add:

Reviewed-by: Ojaswin Mujoo <ojaswin@...ux.ibm.com> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ