Re: [BUG / PATCH] raid1: set BIO_UPTODATE after read error
From: Neil Brown <hidden>
Date: 2004-09-13 05:32:21
On Friday September 10, paul.clements@steeleye.com wrote:
Neil, unless you've already done so, I believe there is a little fix needed in the raid1 read reschedule code. As the code currently works, a read that is retried will continue to fail and cause raid1 to go into an infinite retry loop:
Thanks. I must have noticed this when writing the raid10 module because it gets it right. Obviously I didn't "back-port" it to raid1. A few other fields need to be reset for safety. NeilBrown ====================================================== Make sure bio is re-initialised properly before a raid1 re-read. Various bio fields might have been changed by a failed read request. We must reset them. Signed-off-by: Neil Brown <redacted> ### Diffstat output ./drivers/md/raid1.c | 5 +++++ 1 files changed, 5 insertions(+) diff ./drivers/md/raid1.c~current~ ./drivers/md/raid1.c
--- ./drivers/md/raid1.c~current~ 2004-09-13 15:27:05.000000000 +1000
+++ ./drivers/md/raid1.c 2004-09-13 15:27:40.000000000 +1000@@ -952,6 +952,11 @@ static void raid1d(mddev_t *mddev) (unsigned long long)r1_bio->sector); bio->bi_bdev = rdev->bdev; bio->bi_sector = r1_bio->sector + rdev->data_offset; + bio->bi_next = NULL; + bio->bi_flags &= (1<<BIO_CLONED); + bio->bi_flags |= 1 << BIO_UPTODATE; + bio->bi_idx = 0; + bio->bi_size = r1_bio->sectors << 9; bio->bi_rw = READ; unplug = 1; generic_make_request(bio);