Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

md: prevent adding disks with larger logical_block_size to active arrays

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.

Link: https://lore.kernel.org/linux-raid/20250918115759.334067-2-linan666@huaweicloud.com/
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>
Signed-off-by: Yu Kuai <yukuai@fnnas.com>

authored by

Li Nan and committed by
Yu Kuai
6c6b66f6 a811db39

+7
+7
drivers/md/md.c
··· 6067 6067 if (mddev_is_dm(mddev)) 6068 6068 return 0; 6069 6069 6070 + if (queue_logical_block_size(rdev->bdev->bd_disk->queue) > 6071 + queue_logical_block_size(mddev->gendisk->queue)) { 6072 + pr_err("%s: incompatible logical_block_size, can not add\n", 6073 + mdname(mddev)); 6074 + return -EINVAL; 6075 + } 6076 + 6070 6077 lim = queue_limits_start_update(mddev->gendisk->queue); 6071 6078 queue_limits_stack_bdev(&lim, rdev->bdev, rdev->data_offset, 6072 6079 mddev->gendisk->disk_name);