All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: Joe Bryant <tenminjoe@yahoo.com>
Cc: linux-raid@vger.kernel.org
Subject: Re: Spare drive won't spin down
Date: Fri, 7 May 2010 19:47:04 +1000	[thread overview]
Message-ID: <20100507194704.3ffcf17e@notabene.brown> (raw)
In-Reply-To: <717013.48748.qm@web31703.mail.mud.yahoo.com>

On Fri, 7 May 2010 00:40:40 -0700 (PDT)
Joe Bryant <tenminjoe@yahoo.com> wrote:

> > I'll see about fixing that.
> >
> > Recreate the array with "--metadata 1.0" or "--metadata 1.2" and it should work better.
> 
> That's great, thanks very much.
> 

It turns out it is a bit more subtle than that, though that approach may work
for you.
If you make an odd number of changes to the metadata, it will switch from
doing what you want, to not.
e.g. if /dev/foo is your spare device, then

  mdadm /dev/md0 -f /dev/foo
  mdadm /dev/md0 -r /dev/foo
  mdadm /dev/md0 -a /dev/foo

will switch between working and not working.  v0.90 metadata starts out not
working.  v1.x start out working.

Alternately the following patch will fix it properly.

Thanks,
NeilBrown


From 12aee54f4fee61cdf4e594e501834737fd6b9605 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Fri, 7 May 2010 19:44:26 +1000
Subject: [PATCH] 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

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 66ef15c..4996f27 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2217,12 +2217,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 */
+			}
 		}
 	}
 

  reply	other threads:[~2010-05-07  9:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-06 17:49 Spare drive won't spin down Joe Bryant
2010-05-07  5:07 ` Michael Evans
2010-05-07  7:39   ` Joe Bryant
2010-05-07  6:20 ` Neil Brown
2010-05-07  7:40   ` Joe Bryant
2010-05-07  9:47     ` Neil Brown [this message]
2010-05-07 10:05       ` Joe Bryant
2010-05-10 16:59       ` Bill Davidsen
2010-05-11 20:53         ` Neil Brown
2010-05-17 18:11           ` Doug Ledford
2010-05-18  0:23             ` Neil Brown
2010-05-18  0:38               ` Michael Evans
2010-05-18  0:50                 ` Neil Brown
2010-05-18  0:20           ` Neil Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100507194704.3ffcf17e@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=tenminjoe@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.