diff options
author | NeilBrown <neilb@suse.de> | 2011-03-22 04:52:37 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-03-22 04:52:37 +0100 |
commit | 4e2c1a9a32c8e4c85bc699ff425a75bd5c594f8e (patch) | |
tree | c4f4808ab3fd781150fc15cc5306a442797789bf /managemon.c | |
parent | Grow: increase raid_disks before adding specific spares. (diff) | |
download | mdadm-4e2c1a9a32c8e4c85bc699ff425a75bd5c594f8e.tar.xz mdadm-4e2c1a9a32c8e4c85bc699ff425a75bd5c594f8e.zip |
mdmon: allow manage_member to cope with ->container becoming NULL.
As monitor() can set ->container to NULL, we need to be careful
about dereferencing it.
So take a copy in manage_member, return if it is NULL, and only
use the copy.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'managemon.c')
-rw-r--r-- | managemon.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/managemon.c b/managemon.c index d6c57f78..a2816ceb 100644 --- a/managemon.c +++ b/managemon.c @@ -436,6 +436,11 @@ static void manage_member(struct mdstat_ent *mdstat, */ char buf[64]; int frozen; + struct supertype *container = a->container; + + if (container == NULL) + /* Raced with something */ + return; // FIXME a->info.array.raid_disks = mdstat->raid_disks; @@ -459,7 +464,7 @@ static void manage_member(struct mdstat_ent *mdstat, struct active_array *newa = duplicate_aa(a); if (newa) { newa->info.array.level = level; - replace_array(a->container, a, newa); + replace_array(container, a, newa); a = newa; } } @@ -481,7 +486,7 @@ static void manage_member(struct mdstat_ent *mdstat, /* The array may not be degraded, this is just a good time * to check. */ - newdev = a->container->ss->activate_spare(a, &updates); + newdev = container->ss->activate_spare(a, &updates); if (!newdev) return; @@ -506,7 +511,7 @@ static void manage_member(struct mdstat_ent *mdstat, } queue_metadata_update(updates); updates = NULL; - replace_array(a->container, a, newa); + replace_array(container, a, newa); sysfs_set_str(&a->info, NULL, "sync_action", "recover"); out: while (newdev) { @@ -560,7 +565,7 @@ static void manage_member(struct mdstat_ent *mdstat, out2: sysfs_free(info); if (newa) - replace_array(a->container, a, newa); + replace_array(container, a, newa); } } |