From: Joe Thornber <thornber@redhat.com>

I just noticed that bio_clone copies the BIO_SEG_VALID bit from the original
bio when it was set.  When we modify bi_idx or bi_vcnt afterwards the segment
counts are invalid and the bit must be dropped (though it is fairly unlikely
that it has already been set).  [Christophe Saout]


---

 25-akpm/drivers/md/dm.c |    1 +
 1 files changed, 1 insertion(+)

diff -puN drivers/md/dm.c~dm-10-drop-BIO_SEG_VALID drivers/md/dm.c
--- 25/drivers/md/dm.c~dm-10-drop-BIO_SEG_VALID	Tue Feb 10 13:08:35 2004
+++ 25-akpm/drivers/md/dm.c	Tue Feb 10 13:08:35 2004
@@ -338,6 +338,7 @@ static struct bio *clone_bio(struct bio 
 	clone->bi_idx = idx;
 	clone->bi_vcnt = idx + bv_count;
 	clone->bi_size = to_bytes(len);
+	clone->bi_flags &= ~(1 << BIO_SEG_VALID);
 
 	return clone;
 }

_