]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super0.c
Manage: be more careful about --add attempts.
[thirdparty/mdadm.git] / super0.c
index ae3e8855193f9d6183776f346779b6d29ba5ef5c..e855541369e797db7a420c2000bdf27c65a71229 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -402,8 +402,9 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
                         char *devname, int verbose,
                         int uuid_set, char *homehost)
 {
-       /* NOTE: for 'assemble' and 'force' we need to return non-zero if any change was made.
-        * For others, the return value is ignored.
+       /* NOTE: for 'assemble' and 'force' we need to return non-zero
+        * if any change was made.  For others, the return value is
+        * ignored.
         */
        int rv = 0;
        mdp_super_t *sb = st->sb;
@@ -491,6 +492,20 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
                        sb->disks[d].state = info->disk.state | wonly;
                        rv = 1;
                }
+               if (info->reshape_active &&
+                   sb->minor_version > 90 && (sb->reshape_position+1) != 0 &&
+                   info->delta_disks >= 0 &&
+                   info->reshape_progress < sb->reshape_position) {
+                       sb->reshape_position = info->reshape_progress;
+                       rv = 1;
+               }
+               if (info->reshape_active &&
+                   sb->minor_version > 90 && (sb->reshape_position+1) != 0 &&
+                   info->delta_disks < 0 &&
+                   info->reshape_progress > sb->reshape_position) {
+                       sb->reshape_position = info->reshape_progress;
+                       rv = 1;
+               }
        }
        if (strcmp(update, "linear-grow-new") == 0) {
                memset(&sb->disks[info->disk.number], 0, sizeof(sb->disks[0]));
@@ -542,6 +557,8 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
                        bm = (struct bitmap_super_s*)(sb+1);
                        uuid_from_super0(st, (int*)bm->uuid);
                }
+       } else if (strcmp(update, "no-bitmap") == 0) {
+               sb->state &= ~(1<<MD_SB_BITMAP_PRESENT);
        }
        if (strcmp(update, "_reshape_progress")==0)
                sb->reshape_position = info->reshape_progress;