[PATCH] Fw: [PATCH] bio_clone fix
authorAndrew Morton <akpm@osdl.org>
Thu, 28 Jul 2005 18:02:26 +0000 (11:02 -0700)
committerChris Wright <chrisw@osdl.org>
Fri, 5 Aug 2005 07:04:22 +0000 (00:04 -0700)
[PATCH] bio_clone fix

Fix bug introduced in 2.6.11-rc2: when we clone a BIO we need to copy over the
current index into it as well.

It corrupts data with some MD setups.

See http://bugzilla.kernel.org/show_bug.cgi?id=4946

Huuuuuuuuge thanks to Matthew Stapleton <matthew4196@gmail.com> for doggedly
chasing this one down.

Acked-by: Jens Axboe <axboe@suse.de>
Cc: <linux-raid@vger.kernel.org>
Cc: <dm-devel@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Chris Wright <chrisw@osdl.org>
fs/bio.c

index 3a1472acc361ef0e95f03843cac07f5b92f23e61..eb02df13cd63bd7b67aa27c0171b8397c71dc35f 100644 (file)
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -261,6 +261,7 @@ inline void __bio_clone(struct bio *bio, struct bio *bio_src)
         */
        bio->bi_vcnt = bio_src->bi_vcnt;
        bio->bi_size = bio_src->bi_size;
+       bio->bi_idx = bio_src->bi_idx;
        bio_phys_segments(q, bio);
        bio_hw_segments(q, bio);
 }