summaryrefslogtreecommitdiffstats
path: root/Assemble.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2005-09-12 05:23:11 +0000
committerNeil Brown <neilb@suse.de>2005-09-12 05:23:11 +0000
commit308e1801baa05edbcfda6e8054fdf90727581c62 (patch)
tree5793bfc567206cc898a1fb9cf5812275038fffcc /Assemble.c
parent265e0f17317e6d23864263c04ae581b35f946b5e (diff)
downloadmdadm-308e1801baa05edbcfda6e8054fdf90727581c62.tar.gz
mdadm-308e1801baa05edbcfda6e8054fdf90727581c62.tar.xz
mdadm-308e1801baa05edbcfda6e8054fdf90727581c62.zip
Fix assembling of array with spares when verion-1 superblock is used.
As spared don't have a position in the raid array with verion-1 superblocks, we need to handle them a bit differently. Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'Assemble.c')
-rw-r--r--Assemble.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Assemble.c b/Assemble.c
index c522dab..ae06f57 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -119,6 +119,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
struct mdinfo info;
struct mddev_ident_s ident2;
char *avail;
+ int nextspare = 0;
vers = md_get_version(mdfd);
if (vers <= 0) {
@@ -320,6 +321,11 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
i = devcnt;
else
i = devices[devcnt].raid_disk;
+ if (i+1 == 0) {
+ if (nextspare < info.array.raid_disks)
+ nextspare = info.array.raid_disks;
+ i = nextspare++;
+ }
if (i < 10000) {
if (i >= bestcnt) {
unsigned int newbestcnt = i+10;