summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-03-23 11:07:27 +1100
committerNeilBrown <neilb@suse.de>2011-03-23 12:10:31 +1100
commita28232b83f0f78898220c403600f6c2b1e51bdde (patch)
treedf4de21503f90634829322ba0a7f49c279f48c70
parentea2bc72b0049f7d02156bae8f21736ddd93e731e (diff)
downloadmdadm-a28232b83f0f78898220c403600f6c2b1e51bdde.tar.gz
Assemble: improve efficacy of -Af in assembling degraded dirty arrays.
If a degraded dirty array has some superblocks which are clean and others that are dirty, and the dirty ones are newer by precisely '1' in the event count, then the current code to force the array to be clean will not work. We need to make sure to find a superblock with most recent event count and force that one to be 'clean'. Reported-by: A J Wyborny <ajwyborny@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--Assemble.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Assemble.c b/Assemble.c
index ee0346a..268e248 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -1062,6 +1062,8 @@ int Assemble(struct supertype *st, char *mddev,
continue;
if (!devices[j].uptodate)
continue;
+ if (devices[j].i.events < devices[most_recent].i.events)
+ continue;
chosen_drive = j;
if ((fd=dev_open(devices[j].devname, O_RDONLY|O_EXCL))< 0) {
fprintf(stderr, Name ": Cannot open %s: %s\n",
@@ -1158,6 +1160,9 @@ int Assemble(struct supertype *st, char *mddev,
free(devices);
return 1;
}
+ if (verbose >= 0)
+ fprintf(stderr, Name ": Marking array %s as 'clean'\n",
+ mddev);
close(fd);
}