[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] [PATCH] clear seg valid when resetting bi_idx



In __end_that_request_first if the bio is partially completed blk_recalc_rq_segments will reset the segment values. If the bio is later remapped and resent becuase of an error, we restore bi_idx but the segment values are left to the partially completed state causing many fun problems when blk_rq_map_sg is called in SCSI.

The attached patch clears the BIO_SEG_VALID bit, so the segment values are recalculated when it is resent. It was built and tested against 2.6.4-udm1.

Mike Christie
--- linux-2.6.4-rc1-udm1.orig/drivers/md/dm-bio-record.h	2004-03-03 19:56:43.000000000 -0800
+++ linux-2.6.4-rc1-udm1/drivers/md/dm-bio-record.h	2004-03-03 20:50:58.645821621 -0800
@@ -37,6 +37,7 @@ static inline void dm_bio_restore(struct
 	bio->bi_bdev = bd->bi_bdev;
 	bio->bi_size = bd->bi_size;
 	bio->bi_idx = bd->bi_idx;
+	bio->bi_flags &= ~(1 << BIO_SEG_VALID);
 }
 
 #endif

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]