]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Detect level change
authorAdam Kwolek <adam.kwolek@intel.com>
Thu, 6 Jan 2011 08:17:29 +0000 (19:17 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 6 Jan 2011 08:17:29 +0000 (19:17 +1100)
For level migration support it is necessary to allow mdmon to react for level changes.
It has to have ability to change configuration of active array,
and for array level change to raid0 finish array monitoring.

Signed-off-by: Maciej Trela <maciej.trela@intel.com>
Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
managemon.c
monitor.c

index 9cb8049971f4168828d3da202176f168a7705c74..269d06ed58d8bfd2ac7183f8b5e564d6fd2f4ea4 100644 (file)
@@ -448,6 +448,18 @@ static void manage_member(struct mdstat_ent *mdstat,
        else
                frozen = 1; /* can't read metadata_version assume the worst */
 
+       if (mdstat->level) {
+               int level = map_name(pers, mdstat->level);
+               if (a->info.array.level != level && level >= 0) {
+                       struct active_array *newa = duplicate_aa(a);
+                       if (newa) {
+                               newa->info.array.level = level;
+                               replace_array(a->container, a, newa);
+                               a = newa;
+                       }
+               }
+       }
+
        if (a->check_degraded && !frozen) {
                struct metadata_update *updates = NULL;
                struct mdinfo *newdev = NULL;
index 3962d9e90ed0279ba3cca39c6a409ba3adbf4cd2..4efe5da7bf4cc7d28403bbb9fb5ff753ef3533a6 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -506,7 +506,7 @@ static int wait_and_act(struct supertype *container, int nowait)
                /* once an array has been deactivated we want to
                 * ask the manager to discard it.
                 */
-               if (!a->container) {
+               if (!a->container || (a->info.array.level == 0)) {
                        if (discard_this) {
                                ap = &(*ap)->next;
                                continue;