mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Menzel <pmenzel@molgen.mpg.de>
To: Li Nan <linan666@huaweicloud.com>
Cc: song@kernel.org, yukuai3@huawei.com, 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
Subject: Re: [PATCH v3 1/2] md: prevent adding disks with larger logical_block_size to active arrays
Date: Mon, 25 Aug 2025 10:10:26 +0200	[thread overview]
Message-ID: <76d66b0b-afaa-4835-9d55-9e61be83ce01@molgen.mpg.de> (raw)
In-Reply-To: <20250825075924.2696723-2-linan666@huaweicloud.com>

Dear Li,


Thank you for your patch.

Am 25.08.25 um 09:59 schrieb 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.

Do you have a reproducer to test this?

> 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(+)
> 
> 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);


Kind regards,

Paul

  reply	other threads:[~2025-08-25  8:11 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 [this message]
2025-08-25  8:43     ` Li Nan
2025-08-27  9:29   ` Yu Kuai
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=76d66b0b-afaa-4835-9d55-9e61be83ce01@molgen.mpg.de \
    --to=pmenzel@molgen.mpg.de \
    --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

all inboxes | Powered by JetHome®