From: NeilBrown Date: Fri, 7 May 2010 09:44:26 +0000 (+1000) Subject: md: restore ability of spare drives to spin down. X-Git-Tag: v2.6.35-rc1~440^2~4 X-Git-Url: http://ftp.safe.ca/?a=commitdiff_plain;h=75a73a29e520a6ce982b0da6dd8b7560ae3faa90;p=safe%2Fjmp%2Flinux-2.6 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 Signed-off-by: NeilBrown Cc: stable@kernel.org --- diff --git a/drivers/md/md.c b/drivers/md/md.c index b8a0fcf..fec4abc 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -2150,12 +2150,18 @@ repeat: if (!mddev->in_sync || mddev->recovery_cp != MaxSector) { /* not clean */ /* .. if the array isn't clean, an 'even' event must also go * to spares. */ - if ((mddev->events&1)==0) + if ((mddev->events&1)==0) { nospares = 0; + sync_req = 2; /* force a second update to get the + * even/odd in sync */ + } } else { /* otherwise an 'odd' event must go to spares */ - if ((mddev->events&1)) + if ((mddev->events&1)) { nospares = 0; + sync_req = 2; /* force a second update to get the + * even/odd in sync */ + } } }