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] --- diff/drivers/md/dm-crypt.c 2004-01-16 13:57:42.000000000 +0000 +++ source/drivers/md/dm-crypt.c 2004-01-23 13:00:28.000000000 +0000 @@ -223,6 +223,7 @@ bio->bi_idx = *bio_vec_idx; bio->bi_vcnt = *bio_vec_idx; bio->bi_size = 0; + bio->bi_flags &= ~(1 << BIO_SEG_VALID); /* bio->bi_idx pages have already been allocated */ size -= bio->bi_idx * PAGE_SIZE; --- diff/drivers/md/dm.c 2004-01-16 17:20:37.000000000 +0000 +++ source/drivers/md/dm.c 2004-01-23 13:00:28.000000000 +0000 @@ -408,6 +408,7 @@ 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; }