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.
The issue was introduced before Linux 2.6.12-rc2.
Fixes: d2e45eace8 ("[PATCH] Fix raid "bio too big" failures")
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 a77c59527d4c..40f56183c744 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);
--
2.39.2
On Thu, Sep 11, 2025 at 3:41 PM <linan666@huaweicloud.com> wrote:
>
> 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.
>
> The issue was introduced before Linux 2.6.12-rc2.
>
> Fixes: d2e45eace8 ("[PATCH] Fix raid "bio too big" failures")
Hi Li Nan
I can't find the commit in
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git show d2e45eace8
fatal: ambiguous argument 'd2e45eace8': unknown revision or path not
in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Regards
Xiao
> 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 a77c59527d4c..40f56183c744 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);
> --
> 2.39.2
>
在 2025/9/12 11:18, Xiao Ni 写道:
> On Thu, Sep 11, 2025 at 3:41 PM <linan666@huaweicloud.com> wrote:
>>
>> 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.
>>
>> The issue was introduced before Linux 2.6.12-rc2.
>>
>> Fixes: d2e45eace8 ("[PATCH] Fix raid "bio too big" failures")
>
> Hi Li Nan
>
> I can't find the commit in
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>
> git show d2e45eace8
> fatal: ambiguous argument 'd2e45eace8': unknown revision or path not
> in the working tree.
> Use '--' to separate paths from revisions, like this:
> 'git <command> [<revision>...] -- [<file>...]'
>
> Regards
> Xiao
Thank you for your reply.
As mentioned in the commit message, the issue was introduced before Linux
2.6.12-rc2, and needs to be get it in the history repository.
https://kernel.googlesource.com/pub/scm/linux/kernel/git/tglx/history.git
--
Thanks,
Nan
© 2016 - 2026 Red Hat, Inc.