Commit 233fca36 authored by NeilBrown's avatar NeilBrown

md: Relax checks on ->max_disks when external metadata handling is used.

When metadata is being managed by user-space, md doesn't know
what the maximum number of devices allowed in an array is
so ->max_disks is 0.  In this case we should allow any (+ve)
number of disks.
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent b7103107
...@@ -2801,8 +2801,9 @@ static void analyze_sbs(mddev_t * mddev) ...@@ -2801,8 +2801,9 @@ static void analyze_sbs(mddev_t * mddev)
i = 0; i = 0;
rdev_for_each(rdev, tmp, mddev) { rdev_for_each(rdev, tmp, mddev) {
if (rdev->desc_nr >= mddev->max_disks || if (mddev->max_disks &&
i > mddev->max_disks) { (rdev->desc_nr >= mddev->max_disks ||
i > mddev->max_disks)) {
printk(KERN_WARNING printk(KERN_WARNING
"md: %s: %s: only %d devices permitted\n", "md: %s: %s: only %d devices permitted\n",
mdname(mddev), bdevname(rdev->bdev, b), mdname(mddev), bdevname(rdev->bdev, b),
...@@ -5406,7 +5407,7 @@ static int update_raid_disks(mddev_t *mddev, int raid_disks) ...@@ -5406,7 +5407,7 @@ static int update_raid_disks(mddev_t *mddev, int raid_disks)
if (mddev->pers->check_reshape == NULL) if (mddev->pers->check_reshape == NULL)
return -EINVAL; return -EINVAL;
if (raid_disks <= 0 || if (raid_disks <= 0 ||
raid_disks >= mddev->max_disks) (mddev->max_disks && raid_disks >= mddev->max_disks))
return -EINVAL; return -EINVAL;
if (mddev->sync_thread || mddev->reshape_position != MaxSector) if (mddev->sync_thread || mddev->reshape_position != MaxSector)
return -EBUSY; return -EBUSY;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment