[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220523200844.fal3pmp7epid3rvv@riteshh-domain>
Date: Tue, 24 May 2022 01:38:44 +0530
From: Ritesh Harjani <ritesh.list@...il.com>
To: Baokun Li <libaokun1@...wei.com>
Cc: linux-ext4@...r.kernel.org, tytso@....edu,
adilger.kernel@...ger.ca, jack@...e.cz,
linux-kernel@...r.kernel.org, yi.zhang@...wei.com,
yebin10@...wei.com, yukuai3@...wei.com
Subject: Re: [PATCH 2/2] ext4: correct the judgment of BUG in
ext4_mb_normalize_request
On 22/05/21 09:42PM, Baokun Li wrote:
> When either of the "start + size <= ac->ac_o_ex.fe_logical" or
> "start > ac->ac_o_ex.fe_logical" conditions is met, it indicates
> that the fe_logical is not in the allocated range.
Sounds about right to me based on the logic in ext4_mb_use_inode_pa().
We try to allocate/preallocate such that ac->ac_o_ex.fe_logical should fall
within the preallocated range. So if our start or start + size doesn't include
fe_logical then it is a bug in the ext4_mb_normalize_request() logic.
But should we be so harsh to hit a bug_on() or make it warn_on()?
Also did you run any fs tests with this change. Since it looks like this
logic existed since mballoc was introduced.
> In this case, it should be bug_ON.
>
> Fixes: dfe076c106f6 ("ext4: get rid of code duplication")
No, there is no issue with this patch. It correctly just removes the duplicate
logic.
> Signed-off-by: Baokun Li <libaokun1@...wei.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 32410b79b664..d0fb57970648 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -4190,7 +4190,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
> }
> rcu_read_unlock();
>
> - if (start + size <= ac->ac_o_ex.fe_logical &&
> + if (start + size <= ac->ac_o_ex.fe_logical ||
> start > ac->ac_o_ex.fe_logical) {
> ext4_msg(ac->ac_sb, KERN_ERR,
> "start %lu, size %lu, fe_logical %lu",
> --
> 2.31.1
>
Powered by blists - more mailing lists