[PATCH] blk-mq-sched: add might_sleep() check for flush/fua insert

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If we're doing a flush/fua insert, insertion might block on getting
a driver tag, if can_block == true. Add a might_sleep check for that,
since we just had a bug like that. This will help us catch a similar
issue quicker in the future.

diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
index 9e3c0f92851b..57aec8462e93 100644
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@ -372,6 +372,7 @@ void blk_mq_sched_insert_request(struct request *rq, bool at_head,
 	struct blk_mq_hw_ctx *hctx = blk_mq_map_queue(q, ctx->cpu);
 
 	if (rq->tag == -1 && op_is_flush(rq->cmd_flags)) {
+		might_sleep_if(can_block);
 		blk_mq_sched_insert_flush(hctx, rq, can_block);
 		return;
 	}

Signed-off-by: Jens Axboe <axboe@xxxxxx>




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux