mdadm/Assembe-fix-bug-in-force_array-it-wasn-t-forcing-pro.patch
Neil Brown 78f6e472f9 - DDF-handle-fake-RAIDs-with-changing-subarray-UUIDs.patch
- DDF-compare_super_ddf-fix-sequence-number-check.patch
- Monitor-don-t-set-arrays-dirty-after-transition-to-r.patch
- DDF-add_to_super_ddf-be-careful-with-workspace_lba.patch
- Monitor-write-meta-data-in-readonly-state-sometimes.patch
- Assembe-fix-bug-in-force_array-it-wasn-t-forcing-pro.patch
  Various bugfixes from upstream - several to improve
  DDF support, one which fixes a nasty bug in "--assemble --force".

- DDF-brief_examine_subarrays_ddf-print-array-name.patch
  DDF-factor-out-array-name-generation.patch
  Include name in "-Db" output for DDF
  FATE#316007

OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=96
2013-11-11 00:47:33 +00:00

56 lines
1.7 KiB
Diff

From f81a2b56c4b437f66aaf5582a9c6b7f5ab2103c4 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Tue, 22 Oct 2013 09:55:04 +1100
Subject: [PATCH] Assembe: fix bug in force_array - it wasn't forcing properly.
Since 'best' was expanded to hold replacement devices, we might
need to go up to raid_disks*2 to find devices to force.
Also fix another place when considering replacement drives would
be wrong (the 'chosen' device should never be a replacement).
Reported-by: John Yates <jyates65@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---
Assemble.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/Assemble.c b/Assemble.c
index 86b4c894b260..4d5ceeac8674 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -803,7 +803,9 @@ static int force_array(struct mdinfo *content,
int chosen_drive = -1;
int i;
- for (i = 0; i < content->array.raid_disks && i < bestcnt; i++) {
+ for (i = 0;
+ i < content->array.raid_disks * 2 && i < bestcnt;
+ i += 2) {
int j = best[i];
if (j>=0 &&
!devices[j].uptodate &&
@@ -863,7 +865,9 @@ static int force_array(struct mdinfo *content,
/* If there are any other drives of the same vintage,
* add them in as well. We can't lose and we might gain
*/
- for (i = 0; i < content->array.raid_disks && i < bestcnt ; i++) {
+ for (i = 0;
+ i < content->array.raid_disks * 2 && i < bestcnt ;
+ i += 2) {
int j = best[i];
if (j >= 0 &&
!devices[j].uptodate &&
@@ -1528,7 +1532,7 @@ try_again:
*/
chosen_drive = -1;
st->ss->free_super(st);
- for (i=0; chosen_drive < 0 && i<bestcnt; i++) {
+ for (i=0; chosen_drive < 0 && i<bestcnt; i+=2) {
int j = best[i];
int fd;
--
1.8.3.1.487.g3e7a5b4