[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1666454846-11749-1-git-send-email-john.garry@huawei.com>
Date: Sun, 23 Oct 2022 00:07:26 +0800
From: John Garry <john.garry@...wei.com>
To: <axboe@...nel.dk>
CC: <linux-kernel@...r.kernel.org>, <linux-block@...r.kernel.org>,
<hch@....de>, John Garry <john.garry@...wei.com>
Subject: [PATCH] blk-mq: Properly init bios from blk_mq_alloc_request_hctx()
Function blk_mq_alloc_request_hctx() is missing zeroing/init of rq->bio,
biotail, __sector, and __data_len members, which blk_mq_alloc_request()
has.
Move init'ing of those members to common blk_mq_rq_ctx_init().
Fixes: 1f5bd336b9150 ("blk-mq: add blk_mq_alloc_request_hctx")
Suggested-by: Bart Van Assche <bvanassche@....org>
Signed-off-by: John Garry <john.garry@...wei.com>
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 8070b6c10e8d..260adeb2e455 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -402,6 +402,10 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,
}
}
+ rq->__data_len = 0;
+ rq->__sector = (sector_t) -1;
+ rq->bio = rq->biotail = NULL;
+
return rq;
}
@@ -591,9 +595,6 @@ struct request *blk_mq_alloc_request(struct request_queue *q, blk_opf_t opf,
if (!rq)
goto out_queue_exit;
}
- rq->__data_len = 0;
- rq->__sector = (sector_t) -1;
- rq->bio = rq->biotail = NULL;
return rq;
out_queue_exit:
blk_queue_exit(q);
--
2.35.3
Powered by blists - more mailing lists