提交 066a4a73 编写于 作者: J Jens Axboe

blk-mq: blk_mq_try_issue_directly() should lookup hardware queue

A previous commit changed this to pass in the hardware queue, but
it was using the wrong hardware queue. Hence a request that was
allocated on one hardware queue ended up being issued on another
one, and that caused IO timeouts and oopses on some drivers. Since
the request holds hardware queue private resources, like a tag,
we can't just issue it on a different hardware queue.

Fixes: 2253efc8 ("blk-mq: Move more code into blk_mq_direct_issue_request()")
Signed-off-by: NJens Axboe <axboe@fb.com>
上级 87760e5e
...@@ -1291,11 +1291,11 @@ static struct request *blk_mq_map_request(struct request_queue *q, ...@@ -1291,11 +1291,11 @@ static struct request *blk_mq_map_request(struct request_queue *q,
return rq; return rq;
} }
static void blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx, static void blk_mq_try_issue_directly(struct request *rq, blk_qc_t *cookie)
struct request *rq, blk_qc_t *cookie)
{ {
int ret; int ret;
struct request_queue *q = rq->q; struct request_queue *q = rq->q;
struct blk_mq_hw_ctx *hctx = blk_mq_map_queue(q, rq->mq_ctx->cpu);
struct blk_mq_queue_data bd = { struct blk_mq_queue_data bd = {
.rq = rq, .rq = rq,
.list = NULL, .list = NULL,
...@@ -1414,11 +1414,11 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) ...@@ -1414,11 +1414,11 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio)
if (!(data.hctx->flags & BLK_MQ_F_BLOCKING)) { if (!(data.hctx->flags & BLK_MQ_F_BLOCKING)) {
rcu_read_lock(); rcu_read_lock();
blk_mq_try_issue_directly(data.hctx, old_rq, &cookie); blk_mq_try_issue_directly(old_rq, &cookie);
rcu_read_unlock(); rcu_read_unlock();
} else { } else {
srcu_idx = srcu_read_lock(&data.hctx->queue_rq_srcu); srcu_idx = srcu_read_lock(&data.hctx->queue_rq_srcu);
blk_mq_try_issue_directly(data.hctx, old_rq, &cookie); blk_mq_try_issue_directly(old_rq, &cookie);
srcu_read_unlock(&data.hctx->queue_rq_srcu, srcu_idx); srcu_read_unlock(&data.hctx->queue_rq_srcu, srcu_idx);
} }
goto done; goto done;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册