summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Ledford <dledford@redhat.com>2010-05-26 00:24:30 -0400
committerDoug Ledford <dledford@redhat.com>2010-05-26 00:24:30 -0400
commitebe9b25e2a0b17088e9caddf44d7421be5678d67 (patch)
tree760f6b8d57e962575f2fcc9c3ed17579d2d7b310
parent0688fd7f66c51510cc32a09bc8b66f9fbed8cf34 (diff)
downloadmdadm-auto-spare.tar.gz
mdadm-auto-spare.tar.xz
mdadm-auto-spare.zip
[imsm] make container array_disk count work with array creationauto-spare
The previous method of setting the array_disk variable for a container would segfault if there were no valid subarrays in the container yet, which is always true when first using mdadm to create a container. This made it impossible to create containers using mdadm. So now we verify that at least one subarray exists before we get the disk count out of the subarray info. If no subarray exists, then we don't care about the disk count anyway as there is nothing to be started. Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--super-intel.c31
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;