blk_mq_get_tag() selects tag_offset in the beginning and doesn't update it even though the tag set it may have changed hw queue during waiting. Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> --- block/blk-mq-tag.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index 9c92053e704d..dbbf11edf9a6 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c @@ -101,10 +101,8 @@ unsigned int blk_mq_get_tag(struct blk_mq_alloc_data *data) return BLK_MQ_NO_TAG; } bt = tags->breserved_tags; - tag_offset = 0; } else { bt = tags->bitmap_tags; - tag_offset = tags->nr_reserved_tags; } tag = __blk_mq_get_tag(data, bt); @@ -167,6 +165,11 @@ unsigned int blk_mq_get_tag(struct blk_mq_alloc_data *data) sbitmap_finish_wait(bt, ws, &wait); found_tag: + if (data->flags & BLK_MQ_REQ_RESERVED) + tag_offset = 0; + else + tag_offset = tags->nr_reserved_tags; + /* * Give up this allocation if the hctx is inactive. The caller will * retry on an active hctx. -- 2.24.0