From: Goldwyn Rodrigues <[email protected]>

If blk_mq_map_request returns NULL, bio_endio() function is not
called. Call bio_io_error() in case request returned is NULL.

Signed-off-by: Goldwyn Rodrigues <[email protected]>
---
 block/blk-mq.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 81caceb..7cd8912 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1286,8 +1286,10 @@ static blk_qc_t blk_mq_make_request(struct request_queue 
*q, struct bio *bio)
                return BLK_QC_T_NONE;
 
        rq = blk_mq_map_request(q, bio, &data);
-       if (unlikely(!rq))
+       if (unlikely(!rq)) {
+               bio_io_error(bio);
                return BLK_QC_T_NONE;
+       }
 
        cookie = blk_tag_to_qc_t(rq->tag, data.hctx->queue_num);
 
@@ -1381,8 +1383,10 @@ static blk_qc_t blk_sq_make_request(struct request_queue 
*q, struct bio *bio)
                request_count = blk_plug_queued_count(q);
 
        rq = blk_mq_map_request(q, bio, &data);
-       if (unlikely(!rq))
+       if (unlikely(!rq)) {
+               bio_io_error(bio);
                return BLK_QC_T_NONE;
+       }
 
        cookie = blk_tag_to_qc_t(rq->tag, data.hctx->queue_num);
 
-- 
2.10.2

Reply via email to