From: Yu Kuai <yukuai1@huaweicloud.com>
To: linan666@huaweicloud.com, song@kernel.org
Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org,
martin.petersen@oracle.com, bvanassche@acm.org,
hch@infradead.org, filipe.c.maia@gmail.com, yangerkun@huawei.com,
yi.zhang@huawei.com, "yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH v3 1/2] md: prevent adding disks with larger logical_block_size to active arrays
Date: Wed, 27 Aug 2025 17:29:02 +0800 [thread overview]
Message-ID: <e1834dd0-ea69-09cf-82b7-0587ba3f3c3a@huaweicloud.com> (raw)
In-Reply-To: <20250825075924.2696723-2-linan666@huaweicloud.com>
Hi,
在 2025/08/25 15:59, linan666@huaweicloud.com 写道:
> From: Li Nan <linan122@huawei.com>
>
> When adding a disk to a md array, avoid updating the array's
> logical_block_size to match the new disk. This prevents accidental
> partition table loss that renders the array unusable.
>
> The later patch will introduce a way to configure the array's
> logical_block_size.
>
> Signed-off-by: Li Nan <linan122@huawei.com>
> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
> ---
> drivers/md/md.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
Can you add a fix tag, as data loss is really serious.
Otherwise, feel free to add:
Reviewed-by: Yu Kuai <yukuai3@huawei.com>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index cea8fc96abd3..206434591b97 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -6064,6 +6064,13 @@ int mddev_stack_new_rdev(struct mddev *mddev, struct md_rdev *rdev)
> if (mddev_is_dm(mddev))
> return 0;
>
> + if (queue_logical_block_size(rdev->bdev->bd_disk->queue) >
> + queue_logical_block_size(mddev->gendisk->queue)) {
> + pr_err("%s: incompatible logical_block_size, can not add\n",
> + mdname(mddev));
> + return -EINVAL;
> + }
> +
> lim = queue_limits_start_update(mddev->gendisk->queue);
> queue_limits_stack_bdev(&lim, rdev->bdev, rdev->data_offset,
> mddev->gendisk->disk_name);
>
next prev parent reply other threads:[~2025-08-27 9:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-25 7:59 [PATCH v3 0/2] make logical_block_size configurable linan666
2025-08-25 7:59 ` [PATCH v3 1/2] md: prevent adding disks with larger logical_block_size to active arrays linan666
2025-08-25 8:10 ` Paul Menzel
2025-08-25 8:43 ` Li Nan
2025-08-27 9:29 ` Yu Kuai [this message]
2025-08-25 7:59 ` [PATCH v3 2/2] md: allow configuring logical_block_size linan666
2025-08-25 19:51 ` Martin K. Petersen
2025-08-27 9:39 ` Yu Kuai
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=e1834dd0-ea69-09cf-82b7-0587ba3f3c3a@huaweicloud.com \
--to=yukuai1@huaweicloud.com \
--cc=bvanassche@acm.org \
--cc=filipe.c.maia@gmail.com \
--cc=hch@infradead.org \
--cc=linan666@huaweicloud.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=song@kernel.org \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.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).