diff options
Diffstat (limited to 'super-intel.c')
-rw-r--r-- | super-intel.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/super-intel.c b/super-intel.c index 7bcfcdb..07ca28e 100644 --- a/super-intel.c +++ b/super-intel.c @@ -1536,27 +1536,30 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info) if (super->current_vol >= 0) { getinfo_super_imsm_volume(st, info); return; - } else { - struct mdinfo vol_info; - - super->current_vol = 0; - getinfo_super_imsm_volume(st, &vol_info); - super->current_vol = -1; - info->array.raid_disks = vol_info.array.raid_disks; } /* Set raid_disks to zero so that Assemble will always pull in valid * spares * * Note: my testing with assemble shows that it still works even - * when we set the raid_disks to a proper setting. However, without - * this it is impossible to tell when a container has the right - * number of disks to start cleanly without violating layering - * boundaries. So, not violating layering boundaries trumps spare - * disk issues. Doug Ledford - * - info->array.raid_disks = 0; + * if raid_disks is set to match our actual number of disks. + * However, it's impossible for Incremental assembly to know when + * we have enough devices to safely start the devices if we + * don't set this to something sane. The need to have Incremental + * act sanely trumps spare issues, so set this to the proper value + * (if possible, when creating arrays or when there are no defined + * subarrays in the container it is impossible to set this to a + * correct value so don't try in those cases). Doug Ledford */ + info->array.raid_disks = 0; + if (super->anchor->num_raid_devs) { + struct mdinfo vol_info; + + super->current_vol = 0; + getinfo_super_imsm_volume(st, &vol_info); + super->current_vol = -1; + info->array.raid_disks = vol_info.array.raid_disks; + } info->array.level = LEVEL_CONTAINER; info->array.layout = 0; info->array.md_minor = -1; |