]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Fix: Sometimes mdmon throws core dump during reshape
authorAdam Kwolek <adam.kwolek@intel.com>
Tue, 7 Feb 2012 14:03:35 +0000 (15:03 +0100)
committerNeilBrown <neilb@suse.de>
Thu, 9 Feb 2012 01:20:52 +0000 (12:20 +1100)
Problem was found during reshaping 2 volumes /raid0 and raid5/ in container.
Sometimes mdmon throws core dump due to NULL pointer exception.

Problem occurs in scenario:
- managemon: is about spare activation (degraded raid4 volume == raid0 under takeover)
- managemon: detect level change and signals monitor (manage_member() calls replace_array())
- monitor: detects transition raid4/5->raid0 and sets a->container to NULL
           to indicate array deactivation
- managemon : continues his work and tries to activate spare (a->check_degraded is set).
              NULL pointer is passed to metadata handler activate_spare()
              Core dump is generated.

To resolve this situation managemon (after monitor kick) checks again
a->container pointer to learn if current array is not to be deactivated.

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

index cde0d8be9169092c4331837a7868ed9cb2a881be..6c21ecbd229ade70bd16c210c21af527e28571a0 100644 (file)
@@ -486,6 +486,12 @@ static void manage_member(struct mdstat_ent *mdstat,
                }
        }
 
+       /* we are after monitor kick,
+        * so container field can be cleared - check it again
+        */
+       if (a->container == NULL)
+               return;
+
        /* We don't check the array while any update is pending, as it
         * might container a change (such as a spare assignment) which
         * could affect our decisions.