linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: mchristi@redhat.com
To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org,
	target-devel@vger.kernel.org
Cc: Mike Christie <mchristi@redhat.com>
Subject: [PATCH 1/5] blk mq: take ref to q when running it
Date: Wed, 25 May 2016 02:54:59 -0500	[thread overview]
Message-ID: <1464162903-14735-2-git-send-email-mchristi@redhat.com> (raw)
In-Reply-To: <1464162903-14735-1-git-send-email-mchristi@redhat.com>

From: Mike Christie <mchristi@redhat.com>

If the __blk_mq_run_hw_queue is a result of a async run or retry
then we do not have a reference to the queue. At this time,
blk_cleanup_queue could begin tearing it down while the queue_rq
function is being run.

This patch just has us do a blk_queue_enter call.

Signed-off-by: Mike Christie <mchristi@redhat.com>
---
 block/blk-mq.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 7df9c92..5958a02 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -738,8 +738,13 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
 
 	WARN_ON(!cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask));
 
-	if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state)))
+	if (blk_queue_enter(q, false)) {
+		blk_mq_run_hw_queue(hctx, true);
 		return;
+	}
+
+	if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state)))
+		goto exit_queue;
 
 	hctx->run++;
 
@@ -832,6 +837,9 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
 		 **/
 		blk_mq_run_hw_queue(hctx, true);
 	}
+
+exit_queue:
+	blk_queue_exit(q);
 }
 
 /*
-- 
2.7.2


  reply	other threads:[~2016-05-25  7:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25  7:54 [PATCH 0/5] block/target queue/LUN reset support mchristi
2016-05-25  7:54 ` mchristi [this message]
2016-05-25 15:53   ` [PATCH 1/5] blk mq: take ref to q when running it Bart Van Assche
2016-05-25 19:15     ` Mike Christie
2016-05-25 19:20       ` Mike Christie
2016-05-25  7:55 ` [PATCH 2/5] block: add queue reset support mchristi
2016-05-25 16:13   ` Bart Van Assche
2016-05-25 19:16     ` Mike Christie
2016-05-25  7:55 ` [PATCH 3/5] target: call queue reset if supported mchristi
2016-05-27  8:22   ` Christoph Hellwig
2016-05-25  7:55 ` [PATCH 4/5] scsi: add new async device reset support mchristi
2016-05-27  8:23   ` Christoph Hellwig
2016-05-27  9:16     ` Hannes Reinecke
2016-05-30  6:27   ` Hannes Reinecke
2016-05-31 19:38     ` Mike Christie
2016-05-31 19:59       ` Mike Christie
2016-05-31 20:34       ` Mike Christie
2016-05-25  7:55 ` [PATCH 5/5] iscsi initiator: support eh_async_device_reset_handler mchristi
2016-05-30  6:37 ` [PATCH 0/5] block/target queue/LUN reset support Hannes Reinecke
2016-05-31 19:56   ` Mike Christie
2016-06-01  6:05     ` Hannes Reinecke

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=1464162903-14735-2-git-send-email-mchristi@redhat.com \
    --to=mchristi@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=target-devel@vger.kernel.org \
    /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).