public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: Neil Brown <neilb@suse.de>, Chris Wright <chrisw@sous-sol.org>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: [2.6.20.16 review 14/28] md: Fix bug in error handling during raid1 repair.
Date: Sat, 11 Aug 2007 21:48:06 +0200	[thread overview]
Message-ID: <20070811184842.%N@1wt.eu> (raw)
In-Reply-To: 20070811184752.%N@1wt.eu

[-- Attachment #1: 0014-md-Fix-bug-in-error-handling-during-raid1-repair.patch --]
[-- Type: text/plain, Size: 1798 bytes --]

If raid1/repair (which reads all block and fixes any differences
it finds) hits a read error, it doesn't reset the bio for writing
before writing correct data back, so the read error isn't fixed,
and the device probably gets a zero-length write which it might
complain about.

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/md/raid1.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 97ee870..b20c6e9 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1235,17 +1235,24 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
 			}
 		r1_bio->read_disk = primary;
 		for (i=0; i<mddev->raid_disks; i++)
-			if (r1_bio->bios[i]->bi_end_io == end_sync_read &&
-			    test_bit(BIO_UPTODATE, &r1_bio->bios[i]->bi_flags)) {
+			if (r1_bio->bios[i]->bi_end_io == end_sync_read) {
 				int j;
 				int vcnt = r1_bio->sectors >> (PAGE_SHIFT- 9);
 				struct bio *pbio = r1_bio->bios[primary];
 				struct bio *sbio = r1_bio->bios[i];
-				for (j = vcnt; j-- ; )
-					if (memcmp(page_address(pbio->bi_io_vec[j].bv_page),
-						   page_address(sbio->bi_io_vec[j].bv_page),
-						   PAGE_SIZE))
-						break;
+
+				if (test_bit(BIO_UPTODATE, &sbio->bi_flags)) {
+					for (j = vcnt; j-- ; ) {
+						struct page *p, *s;
+						p = pbio->bi_io_vec[j].bv_page;
+						s = sbio->bi_io_vec[j].bv_page;
+						if (memcmp(page_address(p),
+							   page_address(s),
+							   PAGE_SIZE))
+							break;
+					}
+				} else
+					j = 0;
 				if (j >= 0)
 					mddev->resync_mismatches += r1_bio->sectors;
 				if (j < 0 || test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) {
-- 
1.5.2.4

-- 

  parent reply	other threads:[~2007-08-11 19:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-11 18:47 [2.6.20.16 review 00/28] 2.6.20.16 -stable review Willy Tarreau
2007-08-11 19:47 ` [2.6.20.16 review 01/28] i386: Fix K8/core2 oprofile on multiple CPUs Willy Tarreau
2007-08-11 19:47 ` [2.6.20.16 review 02/28] md: Avoid overflow in raid0 calculation with large components Willy Tarreau
2007-08-11 19:47 ` [2.6.20.16 review 03/28] md: Dont write more than is required of the last page of a bitmap Willy Tarreau
2007-08-11 19:47 ` [2.6.20.16 review 04/28] make freezeable workqueues singlethread Willy Tarreau
2007-08-11 19:47 ` [2.6.20.16 review 05/28] Char: cyclades, fix deadlock Willy Tarreau
2007-08-11 19:47 ` [2.6.20.16 review 06/28] e1000: disable polling before registering netdevice Willy Tarreau
2007-08-11 19:48 ` [2.6.20.16 review 08/28] x86_64: allocate sparsemem memmap above 4G Willy Tarreau
2007-08-12 10:18   ` Andi Kleen
2007-08-12 11:52     ` Willy Tarreau
2007-08-11 19:48 ` [2.6.20.16 review 09/28] sparsemem: fix oops in x86_64 show_mem Willy Tarreau
2007-08-11 19:48 ` [2.6.20.16 review 10/28] rt-mutex: Fix stale return value Willy Tarreau
2007-08-11 19:48 ` [2.6.20.16 review 11/28] rt-mutex: Fix chain walk early wakeup bug Willy Tarreau
2007-08-11 19:48 ` [2.6.20.16 review 13/28] md: Fix two raid10 bugs Willy Tarreau
2007-08-11 19:48 ` Willy Tarreau [this message]
2007-08-11 19:48 ` [2.6.20.16 review 15/28] dm crypt: disable barriers Willy Tarreau
2007-08-11 19:48 ` [2.6.20.16 review 16/28] dm crypt: fix call to clone_init Willy Tarreau
2007-08-11 19:48 ` [2.6.20.16 review 17/28] dm crypt: fix avoid cloned bio ref after free Willy Tarreau
2007-08-11 19:48 ` [2.6.20.16 review 19/28] sched: fix next_interval determination in idle_balance() Willy Tarreau
2007-08-11 19:48 ` [2.6.20.16 review 21/28] audit: fix oops removing watch if audit disabled Willy Tarreau
2007-08-11 19:48 ` [2.6.20.16 review 22/28] POWERPC: Fix subtle FP state corruption bug in signal return on SMP Willy Tarreau
2007-08-11 19:48 ` [2.6.20.16 review 23/28] mm: kill validate_anon_vma to avoid mapcount BUG Willy Tarreau
2007-08-11 19:48 ` [2.6.20.16 review 24/28] saa7134: fix thread shutdown handling Willy Tarreau
2007-08-11 19:48 ` [2.6.20.16 review 25/28] serial: clear proper MPSC interrupt cause bits Willy Tarreau
2007-08-11 19:48 ` [2.6.20.16 review 26/28] i386: fix infinite loop with singlestep int80 syscalls Willy Tarreau
2007-08-11 19:48 ` [2.6.20.16 review 27/28] NTP: remove clock_was_set() call to prevent deadlock Willy Tarreau
2007-08-12 11:15   ` Jason Uhlenkott
2007-08-12 11:47     ` Willy Tarreau
2007-08-11 19:48 ` [2.6.20.16 review 28/28] sky2: workaround for lost IRQ Willy Tarreau

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=20070811184842.%N@1wt.eu \
    --to=w@1wt.eu \
    --cc=chrisw@sous-sol.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=stable@kernel.org \
    /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