Re: [PATCH v5 01/12] md/raid5: fix raid5_run() to return error when log_init() fails

Xiao Ni <[email protected]>
Newsgroups gmane.linux.raid
Message-ID <CALTww28xvhEFyHUnNVLS9YVHLQRAfmDcU2zEpb94JWoS_buPkA@mail.gmail.com>
On Thu, Jan 15, 2026 at 1:17 AM Yu Kuai <[email protected]> wrote:
>
> Since commit f63f17350e53 ("md/raid5: use the atomic queue limit
> update APIs"), the abort path in raid5_run() returns 'ret' instead of
> -EIO. However, if log_init() fails, 'ret' is still 0 from the previous
> successful call, causing raid5_run() to return success despite the
> failure.
>
> Fix this by capturing the return value from log_init().
>
> Fixes: f63f17350e53 ("md/raid5: use the atomic queue limit update APIs")
> Reported-by: Dan Carpenter <[email protected]>
> Closes: https://lore.kernel.org/r/[email protected]/
> Signed-off-by: Yu Kuai <[email protected]>
> ---
>  drivers/md/raid5.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index e57ce3295292..39bec4d199a1 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -8055,7 +8055,8 @@ static int raid5_run(struct mddev *mddev)
>                         goto abort;
>         }
>
> -       if (log_init(conf, journal_dev, raid5_has_ppl(conf)))
> +       ret = log_init(conf, journal_dev, raid5_has_ppl(conf));
> +       if (ret)
>                 goto abort;
>
>         return 0;
> --
> 2.51.0
>
>

Reviewed-by: Xiao Ni <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.