From: Jens Axboe Date: Thu, 20 Apr 2017 23:23:13 +0000 (-0600) Subject: blk-mq: add might_sleep check to blk_mq_get_driver_tag() X-Git-Tag: v4.12-rc1~175^2~21 X-Git-Url: https://git.kernelconcepts.de/?p=karo-tx-linux.git;a=commitdiff_plain;h=5feeacdd4a75bc6e5c6c613ae09ef07bc5dfd05a blk-mq: add might_sleep check to blk_mq_get_driver_tag() 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 Signed-off-by: Jens Axboe --- diff --git a/block/blk-mq.c b/block/blk-mq.c index b6dc9ba38e35..fa7d86f59687 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -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;