Skip to content

Commit

Permalink
blk-mq: update hardware and software queues for sleeping alloc
Browse files Browse the repository at this point in the history
If we end up sleeping due to running out of requests, we should
update the hardware and software queues in the map ctx structure.
Otherwise we could end up having rq->mq_ctx point to the pre-sleep
context, and risk corrupting ctx->rq_list since we'll be
grabbing the wrong lock when inserting the request.

Reported-by: Dave Jones <davej@codemonkey.org.uk>
Reported-by: Chris Mason <clm@fb.com>
Tested-by: Chris Mason <clm@fb.com>
Fixes: 63581af ("blk-mq: remove non-blocking pass in blk_mq_map_request")
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
Jens Axboe committed Oct 28, 2016
1 parent ff26956 commit 7dd2fb6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1217,9 +1217,9 @@ static struct request *blk_mq_map_request(struct request_queue *q,
blk_mq_set_alloc_data(&alloc_data, q, 0, ctx, hctx);
rq = __blk_mq_alloc_request(&alloc_data, op, op_flags);

hctx->queued++;
data->hctx = hctx;
data->ctx = ctx;
data->hctx = alloc_data.hctx;
data->ctx = alloc_data.ctx;
data->hctx->queued++;
return rq;
}

Expand Down

0 comments on commit 7dd2fb6

Please sign in to comment.