summaryrefslogtreecommitdiff
path: root/Incremental.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2013-06-17 16:55:31 +1000
committerNeilBrown <neilb@suse.de>2013-06-17 16:55:31 +1000
commitf80057aec5d314798251e318555cb8ac92e4c06f (patch)
treea608c1049fce2ca0719c46847ea00afa4b44f7dc /Incremental.c
parente2f408a4c03115452fdf467b75a8e1e5eee8cb6e (diff)
Assemble/Incr: Don't include spares with too-high event count.
Some failure scenarios can leave a spare with a higher event count than an in-sync device. Assembling an array like this will confuse the kernel. So detect spares with event counts higher than the best non-spare event count and exclude them from the array. Reported-by: Alexander Lyakas <alex.bolshoy@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Incremental.c')
-rw-r--r--Incremental.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Incremental.c b/Incremental.c
index f9c0feb9..ce89702f 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -760,6 +760,14 @@ static int count_active(struct supertype *st, struct mdinfo *sra,
if (avail[i])
cnt++;
}
+ /* Also need to reject any spare device with an event count that
+ * is too high
+ */
+ for (d = sra->devs; d; d = d->next) {
+ if (!(d->disk.state & (1<<MD_DISK_SYNC)) &&
+ d->events > max_events)
+ d->disk.state |= (1 << MD_DISK_REMOVED);
+ }
free(best);
free(devmap);
return cnt + replcnt;