From 89ced23b58cfd4529ade47488ee37a5ffce7cd8e Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 23 Mar 2011 11:07:27 +1100 Subject: 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 Signed-off-by: NeilBrown --- Assemble.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Assemble.c b/Assemble.c index ea3a648..83bdbfa 100644 --- a/Assemble.c +++ b/Assemble.c @@ -905,6 +905,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", @@ -996,6 +998,9 @@ int Assemble(struct supertype *st, char *mddev, close(mdfd); return 1; } + if (verbose >= 0) + fprintf(stderr, Name ": Marking array %s as 'clean'\n", + mddev); close(fd); } -- cgit v1.2.1