summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorKeith Busch <kbusch@kernel.org>2020-05-29 07:51:59 -0700
committerJens Axboe <axboe@kernel.dk>2020-05-29 10:21:59 -0600
commit7b11eab041dacfeaaa6d27d9183b247a995bc16d (patch)
treec4376ec288a34bd594e4662807e4dce958e40817 /block
parentdc35ada4251f183137ee3a524543c9329d7a4fa2 (diff)
downloadlinux-stable-7b11eab041dacfeaaa6d27d9183b247a995bc16d.tar.gz
linux-stable-7b11eab041dacfeaaa6d27d9183b247a995bc16d.tar.bz2
linux-stable-7b11eab041dacfeaaa6d27d9183b247a995bc16d.zip
blk-mq: blk-mq: provide forced completion method
Drivers may need to bypass error injection for error recovery. Rename __blk_mq_complete_request() to blk_mq_force_complete_rq() and export that function so drivers may skip potential fake timeouts after they've reclaimed lost requests. Signed-off-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/blk-mq.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index c606c74463cc..c6dcd390be2d 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -556,7 +556,17 @@ static void __blk_mq_complete_request_remote(void *data)
q->mq_ops->complete(rq);
}
-static void __blk_mq_complete_request(struct request *rq)
+/**
+ * blk_mq_force_complete_rq() - Force complete the request, bypassing any error
+ * injection that could drop the completion.
+ * @rq: Request to be force completed
+ *
+ * Drivers should use blk_mq_complete_request() to complete requests in their
+ * normal IO path. For timeout error recovery, drivers may call this forced
+ * completion routine after they've reclaimed timed out requests to bypass
+ * potentially subsequent fake timeouts.
+ */
+void blk_mq_force_complete_rq(struct request *rq)
{
struct blk_mq_ctx *ctx = rq->mq_ctx;
struct request_queue *q = rq->q;
@@ -602,6 +612,7 @@ static void __blk_mq_complete_request(struct request *rq)
}
put_cpu();
}
+EXPORT_SYMBOL_GPL(blk_mq_force_complete_rq);
static void hctx_unlock(struct blk_mq_hw_ctx *hctx, int srcu_idx)
__releases(hctx->srcu)
@@ -635,7 +646,7 @@ bool blk_mq_complete_request(struct request *rq)
{
if (unlikely(blk_should_fake_timeout(rq->q)))
return false;
- __blk_mq_complete_request(rq);
+ blk_mq_force_complete_rq(rq);
return true;
}
EXPORT_SYMBOL(blk_mq_complete_request);