linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: Mike Accetta <maccetta@laurelnetworks.com>
Cc: linux-raid@vger.kernel.org
Subject: Re: detecting read errors after RAID1 check operation
Date: Fri, 17 Aug 2007 12:09:10 +1000	[thread overview]
Message-ID: <18117.838.460416.573228@notabene.brown> (raw)
In-Reply-To: message from Mike Accetta on Wednesday August 15

On Wednesday August 15, maccetta@laurelnetworks.com wrote:
> Neil Brown writes:
> > On Wednesday August 15, maccetta@laurelnetworks.com wrote:
> > > 
> > > There are already files like /sys/block/md_d0/md/dev-sdb/errors in /sys
> > > which would be very convenient to consult but according to the kernel
> > > driver implementation the error counts reported there are apparently
> > > for corrected errors and not relevant for read errors during a "check"
> > > operation.
> > > 
> > 
> > When 'check' hits a read error, an attempt is made to 'correct' it by
> > over-writing with correct data.  This will either increase the
> > 'errors' count or fail the drive completely.
> > 
> > What 'check' doesn't do (and 'repair' does) it react when it find that
> > successful reads of all drives (in a raid1) do not match.
> > 
> > So just use the 'errors' number - it is exactly what you want.
> 
> This happens in our old friend sync_request_write()?  I'm dealing with

Yes, that would be the place.

> simulated errors and will dig further to make sure that is not perturbing
> the results but I don't see any 'errors' effect.  This is with our
> patched 2.6.20 raid1.c.  The logic doesn't seem to be any different in
> 2.6.22 from what I can tell, though.
> 
> This fragment
> 
> 	if (j < 0 || test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) {
> 		sbio->bi_end_io = NULL;
> 		rdev_dec_pending(conf->mirrors[i].rdev, mddev);
> 	} else {
> 		/* fixup the bio for reuse */
> 		...
> 	}
> 
> looks suspicously like any correction attempt for 'check' is being
> short-circuited to me, regardless of whether or not there was a read
> error.  Actually, even if the rewrite was not being short-circuited,
> I still don't see the path that would update 'corrected_errors' in this
> case.  There are only two raid1.c sites that touch 'corrected_errors', one
> is in fix_read_errors() and the other is later in sync_request_write().
> With my limited understanding of how this all works, neither of these
> paths would seem to apply here.

hmmm.... yes....
I guess I was thinking of the RAID5 code rather than the RAID1 code.
It doesn't do the right thing does it?
Maybe this patch is what we need.  I think it is right.

Thanks,
NeilBrown


Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./drivers/md/raid1.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff .prev/drivers/md/raid1.c ./drivers/md/raid1.c
--- .prev/drivers/md/raid1.c	2007-08-16 10:29:58.000000000 +1000
+++ ./drivers/md/raid1.c	2007-08-17 12:07:35.000000000 +1000
@@ -1260,7 +1260,8 @@ static void sync_request_write(mddev_t *
 					j = 0;
 				if (j >= 0)
 					mddev->resync_mismatches += r1_bio->sectors;
-				if (j < 0 || test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) {
+				if (j < 0 || (test_bit(MD_RECOVERY_CHECK, &mddev->recovery)
+					      && text_bit(BIO_UPTODATE, &sbio->bi_flags))) {
 					sbio->bi_end_io = NULL;
 					rdev_dec_pending(conf->mirrors[i].rdev, mddev);
 				} else {

  reply	other threads:[~2007-08-17  2:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-15 22:03 detecting read errors after RAID1 check operation Mike Accetta
2007-08-15 22:55 ` Neil Brown
2007-08-16  3:27   ` Mike Accetta
2007-08-17  2:09     ` Neil Brown [this message]
2007-08-17 21:31       ` Mike Accetta
2007-08-25 14:27         ` Mike Snitzer

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=18117.838.460416.573228@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=maccetta@laurelnetworks.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).