]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - managemon.c
FIX: Mdmon crashes after changing RAID level from 1 to 0
[thirdparty/mdadm.git] / managemon.c
index d020f82d35d2c630a5ac9ce38b5116c0117bf05f..9e0a34d758509b0d00b1a9f6634fab97c974d2e2 100644 (file)
@@ -461,7 +461,7 @@ static void manage_member(struct mdstat_ent *mdstat,
        if (mdstat->level) {
                int level = map_name(pers, mdstat->level);
                if (level == 0 || level == LEVEL_LINEAR) {
-                       a->container = NULL;
+                       a->to_remove = 1;
                        wakeup_monitor();
                        return;
                }
@@ -739,7 +739,7 @@ void manage(struct mdstat_ent *mdstat, struct supertype *container)
                /* Looks like a member of this container */
                for (a = container->arrays; a; a = a->next) {
                        if (mdstat->devnum == a->devnum) {
-                               if (a->container)
+                               if (a->container && a->to_remove == 0)
                                        manage_member(mdstat, a);
                                break;
                        }