diff options
author | NeilBrown <neilb@suse.de> | 2012-10-04 16:34:21 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-10-04 16:34:21 +1000 |
commit | 5e88ab2e2f87c4009529c19746841db136c8e1b9 (patch) | |
tree | fdeb31cf99be3c5a4f4b3e77e5db90780b4c75af | |
parent | 19ceb16dafb7df98ff90298008d4488dc93b370a (diff) |
New RESHAPE_NO_BACKUP flag to track when backup action is needed.
Some arrays (raid10) never need a backup file, so during assembly
we can avoid the whole Grow_continue check in that case.
Achieve this using a flag set by the metadata handler.
Also get "mdadm -I" to fail if a backup process would be
needed. It currently does fail as the kernel rejects things,
but it is nicer to have this explicit.
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | Assemble.c | 4 | ||||
-rw-r--r-- | Incremental.c | 11 | ||||
-rw-r--r-- | mdadm.h | 1 | ||||
-rw-r--r-- | super1.c | 2 |
4 files changed, 17 insertions, 1 deletions
@@ -1192,7 +1192,8 @@ int Assemble(struct supertype *st, char *mddev, * The code of doing this lives in Grow.c */ #ifndef MDASSEMBLE - if (content->reshape_active) { + if (content->reshape_active && + !(content->reshape_active & RESHAPE_NO_BACKUP)) { int err = 0; int *fdlist = xmalloc(sizeof(int)* bestcnt); if (c->verbose > 0) @@ -1368,6 +1369,7 @@ int Assemble(struct supertype *st, char *mddev, int rv; #ifndef MDASSEMBLE if (content->reshape_active && + !(content->reshape_active & RESHAPE_NO_BACKUP) && content->delta_disks <= 0) { rv = sysfs_set_str(content, NULL, "array_state", "readonly"); diff --git a/Incremental.c b/Incremental.c index 8e101d70..1615c4df 100644 --- a/Incremental.c +++ b/Incremental.c @@ -494,6 +494,14 @@ int Incremental(char *devname, struct context *c, if (c->runstop > 0 || active_disks >= info.array.working_disks) { struct mdinfo *dsk; /* Let's try to start it */ + + if (info.reshape_active && !(info.reshape_active & RESHAPE_NO_BACKUP)) { + fprintf(stderr, Name + ": %s: This array is being reshaped and cannot be started\n" + " by --incremental. Please use --assemble\n", + chosen_name); + goto out; + } if (match && match->bitmap_file) { int bmfd = open(match->bitmap_file, O_RDWR); if (bmfd < 0) { @@ -1285,6 +1293,9 @@ int IncrementalScan(int verbose) me->path, strerror(errno)); } } + /* FIXME check for reshape_active and consider not + * starting array. + */ sra = sysfs_read(mdfd, 0, 0); if (sra) { if (sysfs_set_str(sra, NULL, @@ -198,6 +198,7 @@ struct mdinfo { #define NO_RESHAPE 0 #define VOLUME_RESHAPE 1 #define CONTAINER_RESHAPE 2 +#define RESHAPE_NO_BACKUP 16 /* Mask 'or'ed in */ int reshape_active; unsigned long long reshape_progress; int recovery_blocked; /* for external metadata it @@ -766,6 +766,8 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map) if (sb->feature_map & __le32_to_cpu(MD_FEATURE_RESHAPE_ACTIVE)) { info->reshape_active = 1; + if (info->array.level == 10) + info->reshape_active |= RESHAPE_NO_BACKUP; info->reshape_progress = __le64_to_cpu(sb->reshape_position); info->new_level = __le32_to_cpu(sb->new_level); info->delta_disks = __le32_to_cpu(sb->delta_disks); |