From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH 04/10] blk-mq: kill undead requests during CPU hotplug notify
Date: Sun, 27 Sep 2015 21:01:52 +0200 [thread overview]
Message-ID: <1443380518-6829-5-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1443380518-6829-1-git-send-email-hch@lst.de>
REQ_NO_TIMEOUT requests can linger out basically forever, so we need
to kill them before waiting for all requests to complete in the
hotplug CPU notification. Note that we really should be doing an
abort here, but that will require much more invasive changes to allow
certain preemptable requests to be started while the queue has already
been frozen. As this new code isn't any worse than the early request
freeing done currently by the nvme driver I'd like to get it in for now
and sort the full hornet's nest later.
Signed-off-by: Christoph Hellwig <hch at lst.de>
---
block/blk-mq.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 732f15c..f11c745 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2092,6 +2092,13 @@ static void blk_mq_queue_reinit(struct request_queue *q)
blk_mq_sysfs_register(q);
}
+static void blk_mq_kill_undead(struct blk_mq_hw_ctx *hctx,
+ struct request *rq, void *priv, bool reserved)
+{
+ if (rq->cmd_flags & REQ_NO_TIMEOUT)
+ blk_mq_complete_request(rq, -EINTR);
+}
+
static int blk_mq_queue_reinit_notify(struct notifier_block *nb,
unsigned long action, void *hcpu)
{
@@ -2116,8 +2123,10 @@ static int blk_mq_queue_reinit_notify(struct notifier_block *nb,
* one swoop and then wait for the completions so that freezing can
* take place in parallel.
*/
- list_for_each_entry(q, &all_q_list, all_q_node)
+ list_for_each_entry(q, &all_q_list, all_q_node) {
blk_mq_freeze_queue_start(q);
+ blk_mq_queue_tag_busy_iter(q, blk_mq_kill_undead, NULL);
+ }
list_for_each_entry(q, &all_q_list, all_q_node) {
blk_mq_freeze_queue_wait(q);
--
1.9.1
next prev parent reply other threads:[~2015-09-27 19:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-27 19:01 nvme completion path optimizations and fixes V2 Christoph Hellwig
2015-09-27 19:01 ` [PATCH 01/10] blk-mq: avoid setting hctx->tags->cpumask before allocation Christoph Hellwig
2015-09-27 19:01 ` [PATCH 02/10] blk-mq: fix racy updates of rq->errors Christoph Hellwig
2015-10-01 7:59 ` Christoph Hellwig
2015-10-01 8:12 ` Jens Axboe
2015-09-27 19:01 ` [PATCH 03/10] blk-mq: factor out a helper to iterate all tags for a request_queue Christoph Hellwig
2015-09-27 19:01 ` Christoph Hellwig [this message]
2015-09-28 17:39 ` [PATCH 04/10] blk-mq: kill undead requests during CPU hotplug notify Keith Busch
2015-09-28 17:46 ` Christoph Hellwig
2015-09-28 18:15 ` Keith Busch
2015-10-01 7:39 ` Christoph Hellwig
2015-09-27 19:01 ` [PATCH 05/10] nvme: switch AEN processing to use blk_execute_rq_nowait Christoph Hellwig
2015-09-27 19:01 ` [PATCH 06/10] nvme: switch delete SQ/CQ to blk_execute_rq_nowait Christoph Hellwig
2015-09-27 19:01 ` [PATCH 07/10] nvme: switch abort " Christoph Hellwig
2015-09-27 19:01 ` [PATCH 08/10] nvme: simplify completion handling Christoph Hellwig
2015-09-27 19:01 ` [PATCH 09/10] nvme: properly free resources for cancelled command Christoph Hellwig
2015-09-27 19:01 ` [PATCH 10/10] nvme: micro optimize nvme_submit_priv Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1443380518-6829-5-git-send-email-hch@lst.de \
--to=hch@lst.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).