diff options
author | Omar Sandoval <osandov@fb.com> | 2017-02-27 10:28:27 -0800 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-03-02 08:56:04 -0700 |
commit | 6d2809d51a5079f01a416d91dd63b0766cb685d0 (patch) | |
tree | 7f8b40edd637604227357062ce0c63be550b8ea4 /block/blk-mq-sched.c | |
parent | 415b806de5576b656f3ff94366589af9a161d0c8 (diff) | |
download | lwn-6d2809d51a5079f01a416d91dd63b0766cb685d0.tar.gz lwn-6d2809d51a5079f01a416d91dd63b0766cb685d0.zip |
blk-mq: make blk_mq_alloc_request_hctx() allocate a scheduler request
blk_mq_alloc_request_hctx() allocates a driver request directly, unlike
its blk_mq_alloc_request() counterpart. It also crashes because it
doesn't update the tags->rqs map.
Fix it by making it allocate a scheduler request.
Reported-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Tested-by: Sagi Grimberg <sagi@grimberg.me>
Diffstat (limited to 'block/blk-mq-sched.c')
-rw-r--r-- | block/blk-mq-sched.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c index 46ca965fff5c..5697b23412a1 100644 --- a/block/blk-mq-sched.c +++ b/block/blk-mq-sched.c @@ -110,15 +110,14 @@ struct request *blk_mq_sched_get_request(struct request_queue *q, struct blk_mq_alloc_data *data) { struct elevator_queue *e = q->elevator; - struct blk_mq_hw_ctx *hctx; - struct blk_mq_ctx *ctx; struct request *rq; blk_queue_enter_live(q); - ctx = blk_mq_get_ctx(q); - hctx = blk_mq_map_queue(q, ctx->cpu); - - blk_mq_set_alloc_data(data, q, data->flags, ctx, hctx); + data->q = q; + if (likely(!data->ctx)) + data->ctx = blk_mq_get_ctx(q); + if (likely(!data->hctx)) + data->hctx = blk_mq_map_queue(q, data->ctx->cpu); if (e) { data->flags |= BLK_MQ_REQ_INTERNAL; |