summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Ledford <dledford@redhat.com>2010-04-08 16:56:02 -0400
committerDoug Ledford <dledford@redhat.com>2010-04-13 15:05:36 -0400
commite8bf7042ed064590abf44b61ad8d99b1592c0af4 (patch)
tree4531c37c88288f8549ff14b575835d95484d2c98
parent4eea172155fba6b2e57582ed647a0a98890f1670 (diff)
downloadmdadm-e8bf7042ed064590abf44b61ad8d99b1592c0af4.tar.gz
mdadm-e8bf7042ed064590abf44b61ad8d99b1592c0af4.tar.xz
mdadm-e8bf7042ed064590abf44b61ad8d99b1592c0af4.zip
Make Incremental container assembly behave like native array assembly
Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--Assemble.c6
-rw-r--r--Incremental.c34
-rw-r--r--super-intel.c17
3 files changed, 43 insertions, 14 deletions
diff --git a/Assemble.c b/Assemble.c
index 1504f1f..d059155 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -1327,8 +1327,10 @@ int assemble_container_content(struct supertype *st, int mdfd,
content->text_version,
content->uuid, chosen_name);
- if (runstop > 0 ||
- (working + preexist) >= content->array.working_disks) {
+ if ((runstop > 0 &&
+ (working + preexist) >= content->array.working_disks) ||
+ (runstop == 0 &&
+ (working + preexist) == content->array.raid_disks)) {
int err;
switch(content->array.level) {
diff --git a/Incremental.c b/Incremental.c
index d32a8e5..9d77d4d 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -424,20 +424,21 @@ int Incremental(char *devname, int verbose, int runstop,
sysfs_uevent(&info, "change");
if (verbose >= 0)
fprintf(stderr, Name
- ": container %s now has %d devices\n",
- chosen_name, info.array.working_disks);
+ ": container %s now has %d out of %d devices\n",
+ chosen_name, info.array.working_disks,
+ info.array.raid_disks);
wait_for(chosen_name, mdfd);
close(mdfd);
- if (runstop < 0)
- return 0; /* don't try to assemble */
- rv = Incremental(chosen_name, verbose, runstop,
- NULL, homehost, require_homehost, autof);
- if (rv == 1)
- /* Don't fail the whole -I if a subarray didn't
- * have enough devices to start yet
+ if (runstop > 0 ||
+ info.array.working_disks == info.array.raid_disks)
+ /* The return value of our container assembly doesn't
+ * depend on whether or not subarrays assembled
+ * properly, so no need to preserve the return value
+ * here.
*/
- rv = 0;
- return rv;
+ Incremental(chosen_name, verbose, runstop, NULL,
+ homehost, require_homehost, autof);
+ return 0;
}
avail = NULL;
active_disks = count_active(st, mdfd, &avail, &info);
@@ -666,6 +667,17 @@ int IncrementalScan(int verbose)
if (mdfd < 0)
continue;
+ if (strcmp("imsm",me->metadata) == 0) {
+ /*
+ * Just do a blind incremental assembly on the
+ * container. If there's anything to be started,
+ * we will, if it's already started, we'll silently
+ * exit, if there's a problem, incremental will
+ * catch it.
+ */
+ Incremental(me->path, verbose, 1, NULL, "<any>", 0, 1);
+ continue;
+ }
if (ioctl(mdfd, GET_ARRAY_INFO, &array) == 0 ||
errno != ENODEV) {
close(mdfd);
diff --git a/super-intel.c b/super-intel.c
index 999b970..7bcfcdb 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -1536,12 +1536,27 @@ 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;
+ */
info->array.level = LEVEL_CONTAINER;
info->array.layout = 0;
info->array.md_minor = -1;