We just set hctx->tags->rqs[tag] when get driver tag, but will not set hctx->sched_tags->rqs[tag] when get sched tag. So, blk_mq_tag_to_rq() always return NULL for sched_tags. Signed-off-by: Yufen Yu <yuyufen@xxxxxxxxxx> --- block/blk-mq.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 5362a7958b74..424afe112b58 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -846,6 +846,7 @@ static int blk_mq_test_tag_bit(struct blk_mq_tags *tags, unsigned int tag) struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag) { + /* if tags is hctx->sched_tags, it always return NULL */ if (tag < tags->nr_tags && blk_mq_test_tag_bit(tags, tag)) { prefetch(tags->rqs[tag]); return tags->rqs[tag]; @@ -3845,17 +3846,8 @@ static bool blk_mq_poll_hybrid(struct request_queue *q, if (!blk_qc_t_is_internal(cookie)) rq = blk_mq_tag_to_rq(hctx->tags, blk_qc_t_to_tag(cookie)); - else { - rq = blk_mq_tag_to_rq(hctx->sched_tags, blk_qc_t_to_tag(cookie)); - /* - * With scheduling, if the request has completed, we'll - * get a NULL return here, as we clear the sched tag when - * that happens. The request still remains valid, like always, - * so we should be safe with just the NULL check. - */ - if (!rq) - return false; - } + else + return false; return blk_mq_poll_hybrid_sleep(q, rq); } -- 2.25.4