bcache: call bio_endio() to replace directly calling bio->bi_end_io()
Subsystems (3)
PATCH 1/1 bcache: call bio_endio() to replace directly calling bio->bi_end_io()
From: Coly Li <[email protected]>
When a bcache device is not attached to a cache device, current code calls the request's bi_end_io() callback directly. The correct method is to call bio_endio(bio) instead of bio->bi_end_io(bio).
This patch fixes the incorrect calling.
Fixes bc082a55d25c ("bcache: fix inaccurate io state for detached bcache devices")
Fixes 40f567bbb3b0 ("md: bcache: check the return value of kzalloc() in detached_dev_do_request()")
Reported-by Shida Zhang <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Jia-Ju Bai <[email protected]>
Cc [email protected] #4.17+
Signed-off-by Coly Li <[email protected]>
--- drivers/md/bcache/request.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/md/bcache/request.c +3 -3
@@ -1104,7 +1104,7 @@ static void detached_dev_end_io(struct bio *bio) }kfree (ddip); - bio->bi_end_io (bio); +bio_endio (bio); } static void detached_dev_do_request(struct bcache_device *d, struct bio *bio,
@@ -1121,7 +1121,7 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio, ddip =kzalloc (sizeof (struct detached_dev_io_private ),GFP_NOIO );if (!ddip) { bio->bi_status =BLK_STS_RESOURCE ; - bio->bi_end_io (bio); +bio_endio (bio);return ; }
@@ -1136,7 +1136,7 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio,if ((bio_op (bio) ==REQ_OP_DISCARD ) && !bdev_max_discard_sectors (dc->bdev)) - bio->bi_end_io (bio); +bio_endio (bio);else submit_bio_noacct (bio); }
Signature · 1 line
2.47.3