int j = best[i];
if (j >= 0 &&
!devices[j].uptodate &&
+ devices[j].i.recovery_start == MaxSector &&
devices[j].i.events == current_events) {
chosen_drive = j;
goto add_another;
i--;
if (fdlist[i]>=0) close(fdlist[i]);
}
+ free(fdlist);
if (err) {
fprintf(stderr, Name ": Failed to restore critical section for reshape, sorry.\n");
if (backup_file == NULL)
sparecnt--;
} else if (verbose > 0)
fprintf(stderr, Name ": added %s "
- "to %s as %d\n",
+ "to %s as %d%s\n",
devices[j].devname, mddev,
- devices[j].i.disk.raid_disk);
+ devices[j].i.disk.raid_disk,
+ devices[j].uptodate?"":
+ " (possibly out of date)");
} else if (verbose > 0 && i < content->array.raid_disks)
fprintf(stderr, Name ": no uptodate device for "
"slot %d of %s\n",
int expansion = 0;
struct map_ent *map = NULL;
int old_raid_disks;
+ int start_reshape;
sysfs_init(content, mdfd, 0);
return 1;
}
- if (st->ss->external && content->recovery_blocked)
+ /* There are two types of reshape: container wide or sub-array specific
+ * Check if metadata requests blocking container wide reshapes
+ */
+ start_reshape = (content->reshape_active &&
+ !((content->reshape_active == CONTAINER_RESHAPE) &&
+ (content->array.state & (1<<MD_SB_BLOCK_CONTAINER_RESHAPE))));
+
+ /* Block subarray here if it is under reshape now
+ * Do not allow for any changes in this array
+ */
+ if (st->ss->external && content->recovery_blocked && start_reshape)
block_subarray(content);
if (sra)
(working + preexist + expansion) >=
content->array.working_disks) {
int err;
- int start_reshape;
- /* There are two types of reshape: container wide or sub-array specific
- * Check if metadata requests blocking container wide reshapes
- */
- start_reshape = (content->reshape_active &&
- !((content->reshape_active == CONTAINER_RESHAPE) &&
- (content->array.state & (1<<MD_SB_BLOCK_CONTAINER_RESHAPE))));
if (start_reshape) {
int spare = content->array.raid_disks + expansion;
if (restore_backup(st, content,
}
if (!err)
sysfs_set_safemode(content, content->safe_mode_delay);
+
+ /* Block subarray here if it is not reshaped now
+ * It has be blocked a little later to allow mdmon to switch in
+ * in to R/W state
+ */
+ if (st->ss->external && content->recovery_blocked &&
+ !start_reshape)
+ block_subarray(content);
+
if (verbose >= 0) {
if (err)
fprintf(stderr, Name