[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACVXFVMhkKgvzXO7QnXRup3wqy2Bom-iPWVQoe_EGZkSMcneag@mail.gmail.com>
Date: Thu, 19 Jun 2014 18:10:28 +0800
From: Ming Lei <tom.leiming@...il.com>
To: Tejun Heo <tj@...nel.org>
Cc: Jens Axboe <axboe@...nel.dk>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Kent Overstreet <kmo@...erainc.com>,
"Nicholas A. Bellinger" <nab@...ux-iscsi.org>
Subject: Re: [PATCH 1/6] blk-mq: make blk_mq_stop_hw_queue() reliably block
queue processing
On Wed, Jun 18, 2014 at 11:21 PM, Tejun Heo <tj@...nel.org> wrote:
> 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@...nel.org>
> Cc: Jens Axboe <axboe@...nel.dk>
> Cc: Nicholas A. Bellinger <nab@...ux-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);
The function can be called from atomic context, like virtio-blk.
Currently blk_mq_stop_hw_queue() is called in case of queue
being busy, so looks it is ok with cancel_delayed_work().
Thanks,
--
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists