From: Wang Jinchao <wangjinchao600@gmail.com>
To: Yu Kuai <yukuai1@huaweicloud.com>, Song Liu <song@kernel.org>
Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org,
"yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH v2] md/raid1: Fix stack memory use after return in raid1_reshape
Date: Thu, 12 Jun 2025 19:46:31 +0800 [thread overview]
Message-ID: <726fe46d-afd5-4247-86a0-14d7f0eeb3b3@gmail.com> (raw)
In-Reply-To: <8a876d8f-b8d1-46c0-d969-cbabb544eb03@huaweicloud.com>
On 2025/6/12 19:23, Yu Kuai wrote:
> Hi,
>
> 在 2025/06/12 17:55, Wang Jinchao 写道:
>> Now that we have the same information, I prefer patch-v1 before
>> refactoring raid1_reshape,
>> because it’s really simple (only one line) and clearer to show the
>> backup and restore logic.
>> Another reason is that v2 freezes the RAID longer than v1.
>> Would you like me to provide a v3 patch combining the v2 explanation
>> with the v1 diff?
>> Thanks for your reviewing.
>
> I don't have preference here, feel free to do this.
>
> BTW, I feel raid1_reshape can be better coding with following:
>
> - covert r1bio_pool to use mempool_create_kmalloc_pool(use create
> instead of init to get rid of the werid assigment);
mempool_create_kmalloc_pool also calls init_waitqueue_head(&pool->wait)
internally, just like mempool_init.
So the issue only exists if newpool is allocated on the stack.
> - no need to reallocate pool_info;
> - convert raid1_info to use krealloc;
I think reallocating pool_info is only for backup and restore, similar
to newpool.
>
> Welcome if you are willing to, otherwise I'll find myself sometime.
I'm a newcomer to RAID and can't quite catch up with it right now.
Maybe I can refactor it later, and I look forward to your guidance.
>
> Thanks,
> Kuai
>
next prev parent reply other threads:[~2025-06-12 11:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-11 8:55 [PATCH v2] md/raid1: Fix stack memory use after return in raid1_reshape Wang Jinchao
2025-06-12 7:31 ` Yu Kuai
2025-06-12 7:45 ` Wang Jinchao
2025-06-12 9:17 ` Yu Kuai
2025-06-12 9:55 ` Wang Jinchao
2025-06-12 11:23 ` Yu Kuai
2025-06-12 11:46 ` Wang Jinchao [this message]
2025-06-12 11:58 ` Yu Kuai
2025-06-12 12:21 ` Wang Jinchao
2025-06-13 9:15 ` Yu Kuai
2025-06-13 11:53 ` Wang Jinchao
2025-06-16 10:11 ` Wang Jinchao
2025-06-16 11:32 ` Yu Kuai
2025-06-18 11:47 ` Wang Jinchao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=726fe46d-afd5-4247-86a0-14d7f0eeb3b3@gmail.com \
--to=wangjinchao600@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=song@kernel.org \
--cc=yukuai1@huaweicloud.com \
--cc=yukuai3@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).