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

[dm-devel] [PATCH] Drop BIO_SEG_VALID bit when segment counts are invalidated



Hi,

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).


--- linux.orig/drivers/md/dm.c	2004-01-20 14:12:58.292188272 +0100
+++ linux/drivers/md/dm.c	2004-01-20 14:17:48.303099000 +0100
@@ -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;
 }
--- linux.orig/drivers/md/dm-crypt.c	2004-01-20 14:12:58.293188120 +0100
+++ linux/drivers/md/dm-crypt.c	2004-01-20 14:19:00.733088000 +0100
@@ -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;




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