]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
blk-mq: add might_sleep check to blk_mq_get_driver_tag()
authorJens Axboe <axboe@fb.com>
Thu, 20 Apr 2017 23:23:13 +0000 (17:23 -0600)
committerJens Axboe <axboe@fb.com>
Thu, 20 Apr 2017 23:23:13 +0000 (17:23 -0600)
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>
block/blk-mq.c

index b6dc9ba38e35dec65a8f3e9dd1dcbda46ebe41db..fa7d86f5968741c1ebe5253291a8029ac9b73723 100644 (file)
@@ -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;