[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c328bc72-0143-d11c-2345-72d307920428@huaweicloud.com>
Date: Thu, 12 Jun 2025 19:58:25 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: Wang Jinchao <wangjinchao600@...il.com>, Yu Kuai
<yukuai1@...weicloud.com>, Song Liu <song@...nel.org>
Cc: linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
"yukuai (C)" <yukuai3@...wei.com>
Subject: Re: [PATCH v2] md/raid1: Fix stack memory use after return in
raid1_reshape
Hi,
在 2025/06/12 19:46, Wang Jinchao 写道:
> 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.
Please notice that creat will allocate memory for mempool, the list is
no longer a stack value, the field bio_pool inside conf should also
covert to a pointer.
> 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.
You can just change the old value directly, after everything is ready,
with the first mempool change, pool_info is not needed for bio_pool.
>>
>> 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.
>>
No hurry, take you time :)
Thanks,
Kuai
Powered by blists - more mailing lists