From: Neil Brown <neilb@cse.unsw.edu.au>

On Monday May 26, akpm@digeo.com wrote:
> 
> The code looks fishy.  We fall through the loop having inspected all the
> disks and then use the one which happened to be zeroeth in the array.
> 

Very fished.  This should fix it.  Thanks.



 drivers/md/raid5.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/md/raid5.c~raid5-use-right-dev-fix drivers/md/raid5.c
--- 25/drivers/md/raid5.c~raid5-use-right-dev-fix	2003-05-26 23:29:23.000000000 -0700
+++ 25-akpm/drivers/md/raid5.c	2003-05-26 23:29:23.000000000 -0700
@@ -940,7 +940,7 @@ static void handle_stripe(struct stripe_
 			/* and fail all 'written' */
 			bi = sh->dev[i].written;
 			sh->dev[i].written = NULL;
-			while (bi && bi->bi_sector < dev->sector + STRIPE_SECTORS) {
+			while (bi && bi->bi_sector < sh->dev[i].sector + STRIPE_SECTORS) {
 				struct bio *bi2 = bi->bi_next;
 				clear_bit(BIO_UPTODATE, &bi->bi_flags);
 				if (--bi->bi_phys_segments == 0) {

_