Dan Williams: imsm: fix spare promotion
Martin F. Krafft
madduck at alioth.debian.org
Tue Oct 27 19:21:47 UTC 2009
Module: mdadm
Branch: upstream
Commit: 709743c554c78b4bbc4483a3ba6845909d4db6ba
URL: http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=709743c554c78b4bbc4483a3ba6845909d4db6ba
Author: Dan Williams <dan.j.williams at intel.com>
Date: Tue Sep 15 11:34:20 2009 -0700
imsm: fix spare promotion
1/ Fix an off by one error when detecting whether the device allocation
loop succeeded or not
2/ Update ->num_raid_devs before copying to avoid a segmentation fault
Signed-off-by: Dan Williams <dan.j.williams at intel.com>
---
super-intel.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/super-intel.c b/super-intel.c
index 782519e..4e2b75f 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -1499,18 +1499,17 @@ static int compare_super_imsm(struct supertype *st, struct supertype *tst)
dv->next = first->devlist;
first->devlist = dv;
}
- if (i <= sec->anchor->num_raid_devs) {
+ if (i < sec->anchor->num_raid_devs) {
/* allocation failure */
free_devlist(first);
fprintf(stderr, "imsm: failed to associate spare\n");
return 3;
}
- for (i = 0; i < sec->anchor->num_raid_devs; i++)
- imsm_copy_dev(get_imsm_dev(first, i), get_imsm_dev(sec, i));
-
first->anchor->num_raid_devs = sec->anchor->num_raid_devs;
first->anchor->orig_family_num = sec->anchor->orig_family_num;
first->anchor->family_num = sec->anchor->family_num;
+ for (i = 0; i < sec->anchor->num_raid_devs; i++)
+ imsm_copy_dev(get_imsm_dev(first, i), get_imsm_dev(sec, i));
}
return 0;
More information about the pkg-mdadm-commits
mailing list