Skip to content

Commit 53280e3

Browse files
Shida Zhangaxboe
authored andcommitted
bcache: fix improper use of bi_end_io
Don't call bio->bi_end_io() directly. Use the bio_endio() helper function instead, which handles completion more safely and uniformly. Suggested-by: Christoph Hellwig <hch@infradead.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Shida Zhang <zhangshida@kylinos.cn> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 87213b0 commit 53280e3

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/md/bcache/request.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ static void detached_dev_end_io(struct bio *bio)
11041104
}
11051105

11061106
kfree(ddip);
1107-
bio->bi_end_io(bio);
1107+
bio_endio(bio);
11081108
}
11091109

11101110
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,
11211121
ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO);
11221122
if (!ddip) {
11231123
bio->bi_status = BLK_STS_RESOURCE;
1124-
bio->bi_end_io(bio);
1124+
bio_endio(bio);
11251125
return;
11261126
}
11271127

@@ -1136,7 +1136,7 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio,
11361136

11371137
if ((bio_op(bio) == REQ_OP_DISCARD) &&
11381138
!bdev_max_discard_sectors(dc->bdev))
1139-
bio->bi_end_io(bio);
1139+
detached_dev_end_io(bio);
11401140
else
11411141
submit_bio_noacct(bio);
11421142
}

0 commit comments

Comments
 (0)