Skip to content

Commit

Permalink
blk-mq: add might_sleep check to blk_mq_get_driver_tag()
Browse files Browse the repository at this point in the history
If the caller passes in wait=true, it has to be able to block
for a driver tag. We just had a bug where flush insertion
would block on tag allocation, while we had preempt disabled.
Ensure that we catch cases like that earlier next time.

Reviewed-by: Bart Van Assche <Bart.VanAssche@sandisk.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
Jens Axboe committed Apr 20, 2017
1 parent 0206319 commit 5feeacd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,8 @@ bool blk_mq_get_driver_tag(struct request *rq, struct blk_mq_hw_ctx **hctx,
.flags = wait ? 0 : BLK_MQ_REQ_NOWAIT,
};

might_sleep_if(wait);

if (rq->tag != -1)
goto done;

Expand Down

0 comments on commit 5feeacd

Please sign in to comment.