From: "yu kuai" <yukuai@fygo.io>
To: <sashiko-reviews@lists.linux.dev>,
"Chen Cheng" <chencheng@fnnas.com>, "yu kuai" <yukuai@fygo.io>
Cc: <linux-raid@vger.kernel.org>
Subject: Re: [PATCH v2] md/raid5: reject raid4/5 arrays with too few disks
Date: Mon, 7 Sep 2026 14:35:33 +0800 [thread overview]
Message-ID: <35ada20d-3d39-4db5-802e-f478d052cf3f@fygo.io> (raw)
In-Reply-To: <20260905110026.5C0571F00A3D@smtp.kernel.org>
Hi,
在 2026/9/5 19:00, sashiko-bot@kernel.org 写道:
>> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
>> index b91545ce090de..4d8bb0cf26055 100644
>> --- a/drivers/md/raid5.c
>> +++ b/drivers/md/raid5.c
>> @@ -7657,9 +7657,12 @@ static struct r5conf *setup_conf(struct mddev *mddev)
>> mdname(mddev), mddev->new_layout);
>> return ERR_PTR(-EIO);
>> }
>> - if (mddev->new_level == 6 && mddev->raid_disks < 4) {
>> - pr_warn("md/raid:%s: not enough configured devices (%d, minimum 4)\n",
>> - mdname(mddev), mddev->raid_disks);
>> + if ((mddev->new_level == 4 && mddev->raid_disks < 2) ||
>> + (mddev->new_level == 5 && mddev->raid_disks < 3) ||
> [Severity: High]
> Does this unintentionally break 2-disk RAID5 arrays?
>
> The md driver supports and intentionally creates 2-disk RAID5 arrays during a
> RAID1-to-RAID5 reshape. For example, in drivers/md/raid5.c
> raid5_takeover_raid1() creates a 2-disk RAID5:
>
> mddev->new_level = 5;
> mddev->new_layout = ALGORITHM_LEFT_SYMMETRIC;
> mddev->new_chunk_sectors = chunksect;
>
> ret = setup_conf(mddev);
>
> By unconditionally rejecting mddev->new_level == 5 && mddev->raid_disks < 3
> here, doesn't this cause valid reshape operations and assembly of legitimate
> 2-disk RAID5 arrays to fail with -EINVAL?
This make sense, 2 disks raid1 reshape to raid5 should not be broken.
--
Thanks,
Kuai
prev parent reply other threads:[~2026-09-07 6:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-05 10:43 [PATCH v2] md/raid5: reject raid4/5 arrays with too few disks Chen Cheng
2026-09-05 11:00 ` sashiko-bot
2026-09-07 6:35 ` yu kuai [this message]
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=35ada20d-3d39-4db5-802e-f478d052cf3f@fygo.io \
--to=yukuai@fygo.io \
--cc=chencheng@fnnas.com \
--cc=linux-raid@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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