diff options
author | Dan Williams <dan.j.williams@intel.com> | 2008-10-28 10:55:31 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2008-10-28 10:55:31 -0700 |
commit | 78d30f94c48020f4efcefe8332095e58a99f1e17 (patch) | |
tree | 84665a567ed9bdc7334346b29d81b5a488c73769 /super-intel.c | |
parent | a575e2a7cd4533c0cfc8de08daddec9854e0df71 (diff) | |
download | mdadm-78d30f94c48020f4efcefe8332095e58a99f1e17.tar.gz mdadm-78d30f94c48020f4efcefe8332095e58a99f1e17.tar.xz mdadm-78d30f94c48020f4efcefe8332095e58a99f1e17.zip |
imsm: copy raid device info when associating spares
If a spare is included in the list of examined disks we need to copy in at
least enough information to get the uuid of the populated container.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'super-intel.c')
-rw-r--r-- | super-intel.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/super-intel.c b/super-intel.c index babb098..68ecbe4 100644 --- a/super-intel.c +++ b/super-intel.c @@ -938,6 +938,24 @@ static int compare_super_imsm(struct supertype *st, struct supertype *tst) */ if (first->anchor->num_raid_devs == 0 && sec->anchor->num_raid_devs > 0) { + int i; + + /* we need to copy raid device info from sec if an allocation + * fails here we don't associate the spare + */ + for (i = 0; i < sec->anchor->num_raid_devs; i++) { + first->dev_tbl[i] = malloc(sizeof(struct imsm_dev)); + if (!first->dev_tbl) { + while (--i >= 0) { + free(first->dev_tbl[i]); + first->dev_tbl[i] = NULL; + } + fprintf(stderr, "imsm: failed to associate spare\n"); + return 3; + } + *first->dev_tbl[i] = *sec->dev_tbl[i]; + } + first->anchor->num_raid_devs = sec->anchor->num_raid_devs; first->anchor->family_num = sec->anchor->family_num; } |