]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcache: fix improper use of bi_end_io
authorShida Zhang <zhangshida@kylinos.cn>
Tue, 9 Dec 2025 09:01:56 +0000 (17:01 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 9 Dec 2025 17:20:03 +0000 (10:20 -0700)
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>
drivers/md/bcache/request.c

index af345dc6fde14f689917ca58447a372104ebe4e8..82fdea7dea7aac618418b3ce650d3170dd6855df 100644 (file)
@@ -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);
+               detached_dev_end_io(bio);
        else
                submit_bio_noacct(bio);
 }