aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-05-07 05:44:26 -0400
committerNeilBrown <neilb@suse.de>2010-05-18 01:28:00 -0400
commit75a73a29e520a6ce982b0da6dd8b7560ae3faa90 (patch)
tree1bcb14b69e2ae7673bf29be6b3f27aee6e896070 /drivers/md
parentaf3a2cd6b8a479345786e7fe5e199ad2f6240e56 (diff)
md: restore ability of spare drives to spin down.
Some time ago we stopped the clean/active metadata updates from being written to a 'spare' device in most cases so that it could spin down and say spun down. Device failure/removal etc are still recorded on spares. However commit 51d5668cb2e3fd1827a55 broke this 50% of the time, depending on whether the event count is even or odd. The change log entry said: This means that the alignment between 'odd/even' and 'clean/dirty' might take a little longer to attain, how ever the code makes no attempt to create that alignment, so it could take arbitrarily long. So when we find that clean/dirty is not aligned with odd/even, force a second metadata-update immediately. There are already cases where a second metadata-update is needed immediately (e.g. when a device fails during the metadata update). We just piggy-back on that. Reported-by: Joe Bryant <tenminjoe@yahoo.com> Signed-off-by: NeilBrown <neilb@suse.de> Cc: stable@kernel.org
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index b8a0fcfb1de1..fec4abcb9bb4 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2150,12 +2150,18 @@ repeat:
2150 if (!mddev->in_sync || mddev->recovery_cp != MaxSector) { /* not clean */ 2150 if (!mddev->in_sync || mddev->recovery_cp != MaxSector) { /* not clean */
2151 /* .. if the array isn't clean, an 'even' event must also go 2151 /* .. if the array isn't clean, an 'even' event must also go
2152 * to spares. */ 2152 * to spares. */
2153 if ((mddev->events&1)==0) 2153 if ((mddev->events&1)==0) {
2154 nospares = 0; 2154 nospares = 0;
2155 sync_req = 2; /* force a second update to get the
2156 * even/odd in sync */
2157 }
2155 } else { 2158 } else {
2156 /* otherwise an 'odd' event must go to spares */ 2159 /* otherwise an 'odd' event must go to spares */
2157 if ((mddev->events&1)) 2160 if ((mddev->events&1)) {
2158 nospares = 0; 2161 nospares = 0;
2162 sync_req = 2; /* force a second update to get the
2163 * even/odd in sync */
2164 }
2159 } 2165 }
2160 } 2166 }
2161 2167