Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8d307269 authored by Mike Snitzer's avatar Mike Snitzer Committed by Jens Axboe
Browse files

dm cache: increment bi_remaining when bi_end_io is restored



Move the bio->bi_remaining increment into dm_unhook_bio() so the
overwrite_endio() handler works as expected.

Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent bc1e79ac
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -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);
}

/*----------------------------------------------------------------*/
@@ -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;