bio: fix bio_copy_kern() handling of bio->bv_len
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Mon, 25 Aug 2008 18:36:08 +0000 (20:36 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 27 Aug 2008 07:50:19 +0000 (09:50 +0200)
commit76029ff37f31dad64641489c610d98955217bb68
treee8f729fa6288676be357295141a0950f171a62d8
parent48fd4f93a00eac844678629f2f00518e146ed30d
bio: fix bio_copy_kern() handling of bio->bv_len

The commit 68154e90c9d1492d570671ae181d9a8f8530da55 introduced
bio_copy_kern() to add bounce support to blk_rq_map_kern.

bio_copy_kern() uses bio->bv_len to copy data for READ commands after
the completion but it doesn't work with a request that partially
completed. SCSI always completes a PC request as a whole but seems
some don't.

This patch fixes bio_copy_kern to handle the above case. As
bio_copy_user does, bio_copy_kern uses struct bio_map_data to store
struct bio_vec.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reported-by: Nix <nix@esperi.org.uk>
Tested-by: Nix <nix@esperi.org.uk>
Cc: stable@kernel.org
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fs/bio.c