Skip to content

Commit

Permalink
dm cache: increment bi_remaining when bi_end_io is restored
Browse files Browse the repository at this point in the history
Move the bio->bi_remaining increment into dm_unhook_bio() so the
overwrite_endio() handler works as expected.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Mike Snitzer authored and Jens Axboe committed Dec 4, 2013
1 parent bc1e79a commit 8d30726
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/md/dm-cache-target.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ static void dm_unhook_bio(struct dm_hook_info *h, struct bio *bio)
{
bio->bi_end_io = h->bi_end_io;
bio->bi_private = h->bi_private;

/*
* Must bump bi_remaining to allow bio to complete with
* restored bi_end_io.
*/
atomic_inc(&bio->bi_remaining);
}

/*----------------------------------------------------------------*/
Expand Down Expand Up @@ -765,12 +771,6 @@ static void writethrough_endio(struct bio *bio, int err)

dm_unhook_bio(&pb->hook_info, bio);

/*
* Must bump bi_remaining to allow bio to complete with
* restored bi_end_io.
*/
atomic_inc(&bio->bi_remaining);

if (err) {
bio_endio(bio, err);
return;
Expand Down

0 comments on commit 8d30726

Please sign in to comment.