]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
New RESHAPE_NO_BACKUP flag to track when backup action is needed.
authorNeilBrown <neilb@suse.de>
Sun, 20 May 2012 23:42:27 +0000 (09:42 +1000)
committerNeilBrown <neilb@suse.de>
Sun, 20 May 2012 23:42:27 +0000 (09:42 +1000)
Some arrays (raid10) never need a backup file, so during assembly
we can avoid the whole Grow_continue check in the 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>
Assemble.c
Incremental.c
mdadm.h
super1.c

index 227d66fc68d9e7a227f6a9099efa4efbdfbfb486..abbec47c410e3e7c0ff63f217d9f714e686c9db7 100644 (file)
@@ -1202,7 +1202,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 = malloc(sizeof(int)* bestcnt);
                if (verbose > 0)
@@ -1378,6 +1379,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");
index e3639f2e83e1664e8d37111aed2012de46c83996..2c4717c9d7dbd4e229faec2f47c4d10253ccb271 100644 (file)
@@ -513,6 +513,14 @@ int Incremental(char *devname, int verbose, int runstop,
        if (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) {
@@ -1317,6 +1325,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,
diff --git a/mdadm.h b/mdadm.h
index a70a0054002f1f41fba5bdd65a84378f23f9e715..abe7c3c1060b6244c607c8a8c3ea3d7db9a7e8cc 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -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
index 94b6c7f84aad4eba527c4384717db4c786b1ffda..572bd6cf80f59a8eda722be81b09bc934e5d3e45 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -721,6 +721,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);