* [patch 07/26] md: Fix two raid10 bugs.
[not found] ` <20070731043047.GA3975@kroah.com>
@ 2007-07-31 4:31 ` Greg KH
2007-07-31 4:32 ` [patch 08/26] md: Fix bug in error handling during raid1 repair Greg KH
1 sibling, 0 replies; 2+ messages in thread
From: Greg KH @ 2007-07-31 4:31 UTC (permalink / raw)
To: linux-kernel, stable, Andrew Morton
Cc: Justin Forbes, Zwane Mwaikambo, Theodore Ts'o, Randy Dunlap,
Dave Jones, Chuck Wolber, Chris Wedgwood, Michael Krufky,
Chuck Ebbert, Domenico Andreoli, torvalds, alan, linux-raid,
neilb, Chris Wright, Greg Kroah-Hartman
[-- Attachment #1: md-fix-two-raid10-bugs.patch --]
[-- Type: text/plain, Size: 1406 bytes --]
-stable review patch. If anyone has any objections, please let us know.
------------------
1/ When resyncing a degraded raid10 which has more than 2 copies of each block,
garbage can get synced on top of good data.
2/ We round the wrong way in part of the device size calculation, which
can cause confusion.
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/raid10.c | 6 ++++++
1 file changed, 6 insertions(+)
diff .prev/drivers/md/raid10.c ./drivers/md/raid10.c
--- linux-2.6.21.6.orig/drivers/md/raid10.c
+++ linux-2.6.21.6/drivers/md/raid10.c
@@ -1867,6 +1867,7 @@ static sector_t sync_request(mddev_t *md
int d = r10_bio->devs[i].devnum;
bio = r10_bio->devs[i].bio;
bio->bi_end_io = NULL;
+ clear_bit(BIO_UPTODATE, &bio->bi_flags);
if (conf->mirrors[d].rdev == NULL ||
test_bit(Faulty, &conf->mirrors[d].rdev->flags))
continue;
@@ -2037,6 +2038,11 @@ static int run(mddev_t *mddev)
/* 'size' is now the number of chunks in the array */
/* calculate "used chunks per device" in 'stride' */
stride = size * conf->copies;
+
+ /* We need to round up when dividing by raid_disks to
+ * get the stride size.
+ */
+ stride += conf->raid_disks - 1;
sector_div(stride, conf->raid_disks);
mddev->size = stride << (conf->chunk_shift-1);
--
^ permalink raw reply [flat|nested] 2+ messages in thread
* [patch 08/26] md: Fix bug in error handling during raid1 repair.
[not found] ` <20070731043047.GA3975@kroah.com>
2007-07-31 4:31 ` [patch 07/26] md: Fix two raid10 bugs Greg KH
@ 2007-07-31 4:32 ` Greg KH
1 sibling, 0 replies; 2+ messages in thread
From: Greg KH @ 2007-07-31 4:32 UTC (permalink / raw)
To: linux-kernel, stable, Andrew Morton
Cc: Justin Forbes, Zwane Mwaikambo, Theodore Ts'o, Randy Dunlap,
Dave Jones, Chuck Wolber, Chris Wedgwood, Michael Krufky,
Chuck Ebbert, Domenico Andreoli, torvalds, alan, linux-raid,
neilb, Chris Wright, Greg Kroah-Hartman
[-- Attachment #1: md-fix-bug-in-error-handling-during-raid1-repair.patch --]
[-- Type: text/plain, Size: 1906 bytes --]
-stable review patch. If anyone has any objections, please let us know.
------------------
From: Mike Accetta <maccetta@laurelnetworks.com>
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 file changed, 14 insertions(+), 7 deletions(-)
diff .prev/drivers/md/raid1.c ./drivers/md/raid1.c
--- linux-2.6.21.6.orig/drivers/md/raid1.c
+++ linux-2.6.21.6/drivers/md/raid1.c
@@ -1240,17 +1240,24 @@ static void sync_request_write(mddev_t *
}
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)) {
--
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-07-31 4:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20070731042108.546594256@blue.kroah.org>
[not found] ` <20070731043047.GA3975@kroah.com>
2007-07-31 4:31 ` [patch 07/26] md: Fix two raid10 bugs Greg KH
2007-07-31 4:32 ` [patch 08/26] md: Fix bug in error handling during raid1 repair Greg KH
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).