All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: axboe@kernel.dk
Cc: linux-kernel@vger.kernel.org, kmo@daterainc.com,
	nab@linux-iscsi.org, Tejun Heo <tj@kernel.org>
Subject: [PATCH 1/6] blk-mq: make blk_mq_stop_hw_queue() reliably block queue processing
Date: Wed, 18 Jun 2014 11:21:07 -0400	[thread overview]
Message-ID: <1403104872-22236-2-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1403104872-22236-1-git-send-email-tj@kernel.org>

blk_mq_stop_hw_queue() has the following two issues.

* BLK_MQ_S_STOPPED should be set before canceling the work items;
  otherwise, a new instance may proceed beyond STOPPED checking
  inbetween.

* cancel_delayed_work() doesn't do anything to work instance already
  executing.  Use cancel_delayed_work_sync() to ensure that the
  currently in-flight one is finished.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Nicholas A. Bellinger <nab@linux-iscsi.org>
---
 block/blk-mq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index e11f5f8..4787c3d 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -862,9 +862,9 @@ EXPORT_SYMBOL(blk_mq_run_queues);
 
 void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx)
 {
-	cancel_delayed_work(&hctx->run_work);
-	cancel_delayed_work(&hctx->delay_work);
 	set_bit(BLK_MQ_S_STOPPED, &hctx->state);
+	cancel_delayed_work_sync(&hctx->run_work);
+	cancel_delayed_work_sync(&hctx->delay_work);
 }
 EXPORT_SYMBOL(blk_mq_stop_hw_queue);
 
-- 
1.9.3


  reply	other threads:[~2014-06-18 15:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-18 15:21 [PATCHSET block/for-next] blk-mq: update freezing Tejun Heo
2014-06-18 15:21 ` Tejun Heo [this message]
2014-06-19 10:10   ` [PATCH 1/6] blk-mq: make blk_mq_stop_hw_queue() reliably block queue processing Ming Lei
2014-06-19 13:12     ` Tejun Heo
2014-06-18 15:21 ` [PATCH 2/6] blk-mq: fix a memory ordering bug in blk_mq_queue_enter() Tejun Heo
2014-06-18 15:21 ` [PATCH 3/6] block, blk-mq: draining can't be skipped even if bypass_depth was non-zero Tejun Heo
2014-06-18 15:21 ` [PATCH 4/6] blk-mq: decouble blk-mq freezing from generic bypassing Tejun Heo
2014-06-18 15:21 ` [PATCH 5/6] blk-mq: collapse __blk_mq_drain_queue() into blk_mq_freeze_queue() Tejun Heo
2014-06-18 15:21 ` [PATCH 6/6] blk-mq: use percpu_ref for mq usage count Tejun Heo
2014-06-18 16:19 ` [PATCHSET block/for-next] blk-mq: update freezing Jens Axboe
2014-06-28 12:13   ` Tejun Heo
2014-06-28 14:29     ` Jens Axboe

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=1403104872-22236-2-git-send-email-tj@kernel.org \
    --to=tj@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=kmo@daterainc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nab@linux-iscsi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.