summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2018-12-17 21:11:17 -0700
committerJens Axboe <axboe@kernel.dk>2018-12-17 21:31:42 -0700
commit3c94d83cb352627f221d971b05f163c17527de74 (patch)
tree60f1445af634c7162225f86c9a791b6e2a6b382c
parente5edd5f298fafda28284bafb8371e6f0b7681035 (diff)
downloadlinux-3c94d83cb352627f221d971b05f163c17527de74.tar.gz
linux-3c94d83cb352627f221d971b05f163c17527de74.tar.bz2
linux-3c94d83cb352627f221d971b05f163c17527de74.zip
blk-mq: change blk_mq_queue_busy() to blk_mq_queue_inflight()
There's a single user of this function, dm, and dm just wants to check if IO is inflight, not that it's just allocated. This fixes a hang with srp/002 in blktests with dm, where it tries to suspend but waits for inflight IO to finish first. As it checks for just allocated requests, this fails. Tested-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--block/blk-mq.c16
-rw-r--r--drivers/md/dm.c2
-rw-r--r--include/linux/blk-mq.h2
3 files changed, 10 insertions, 10 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 6847f014606b..b0888a89fa66 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -805,14 +805,14 @@ struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag)
}
EXPORT_SYMBOL(blk_mq_tag_to_rq);
-static bool blk_mq_check_busy(struct blk_mq_hw_ctx *hctx, struct request *rq,
- void *priv, bool reserved)
+static bool blk_mq_rq_inflight(struct blk_mq_hw_ctx *hctx, struct request *rq,
+ void *priv, bool reserved)
{
/*
- * If we find a request, we know the queue is busy. Return false
- * to stop the iteration.
+ * If we find a request that is inflight and the queue matches,
+ * we know the queue is busy. Return false to stop the iteration.
*/
- if (rq->q == hctx->queue) {
+ if (rq->state == MQ_RQ_IN_FLIGHT && rq->q == hctx->queue) {
bool *busy = priv;
*busy = true;
@@ -822,14 +822,14 @@ static bool blk_mq_check_busy(struct blk_mq_hw_ctx *hctx, struct request *rq,
return true;
}
-bool blk_mq_queue_busy(struct request_queue *q)
+bool blk_mq_queue_inflight(struct request_queue *q)
{
bool busy = false;
- blk_mq_queue_tag_busy_iter(q, blk_mq_check_busy, &busy);
+ blk_mq_queue_tag_busy_iter(q, blk_mq_rq_inflight, &busy);
return busy;
}
-EXPORT_SYMBOL_GPL(blk_mq_queue_busy);
+EXPORT_SYMBOL_GPL(blk_mq_queue_inflight);
static void blk_mq_rq_timed_out(struct request *req, bool reserved)
{
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index c414d40d645d..dddbca63e140 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -663,7 +663,7 @@ static bool md_in_flight_bios(struct mapped_device *md)
static bool md_in_flight(struct mapped_device *md)
{
if (queue_is_mq(md->queue))
- return blk_mq_queue_busy(md->queue);
+ return blk_mq_queue_inflight(md->queue);
else
return md_in_flight_bios(md);
}
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 57eda7b20243..d3c0a0d2680b 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -257,7 +257,7 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule);
void blk_mq_free_request(struct request *rq);
bool blk_mq_can_queue(struct blk_mq_hw_ctx *);
-bool blk_mq_queue_busy(struct request_queue *q);
+bool blk_mq_queue_inflight(struct request_queue *q);
enum {
/* return when out of requests */