From: James Bottomley <jejb@linux.vnet.ibm.com>
To: Bart Van Assche <bart.vanassche@sandisk.com>,
Steve Wise <swise@opengridcomputing.com>,
'Jens Axboe' <axboe@fb.com>
Cc: linux-block@vger.kernel.org,
"'Martin K. Petersen'" <martin.petersen@oracle.com>,
'Mike Snitzer' <snitzer@redhat.com>,
linux-rdma@vger.kernel.org, linux-nvme@lists.infradead.org,
'Keith Busch' <keith.busch@intel.com>,
'Doug Ledford' <dledford@redhat.com>,
linux-scsi@vger.kernel.org, 'Christoph Hellwig' <hch@lst.de>
Subject: Re: [PATCH 9/9] [RFC] nvme: Fix a race condition
Date: Tue, 27 Sep 2016 09:56:00 -0700 [thread overview]
Message-ID: <1474995360.2716.19.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <9d8e0f32-6703-cf23-d424-bcecb65c2a26@sandisk.com>
On Tue, 2016-09-27 at 09:43 -0700, Bart Van Assche wrote:
> On 09/27/2016 09:31 AM, Steve Wise wrote:
> > > @@ -2079,11 +2075,15 @@ EXPORT_SYMBOL_GPL(nvme_kill_queues);
> > > void nvme_stop_queues(struct nvme_ctrl *ctrl)
> > > {
> > > struct nvme_ns *ns;
> > > + struct request_queue *q;
> > >
> > > mutex_lock(&ctrl->namespaces_mutex);
> > > list_for_each_entry(ns, &ctrl->namespaces, list) {
> > > - blk_mq_cancel_requeue_work(ns->queue);
> > > - blk_mq_stop_hw_queues(ns->queue);
> > > + q = ns->queue;
> > > + blk_quiesce_queue(q);
> > > + blk_mq_cancel_requeue_work(q);
> > > + blk_mq_stop_hw_queues(q);
> > > + blk_resume_queue(q);
> > > }
> > > mutex_unlock(&ctrl->namespaces_mutex);
> >
> > Hey Bart, should nvme_stop_queues() really be resuming the blk
> > queue?
>
> Hello Steve,
>
> Would you perhaps prefer that blk_resume_queue(q) is called from
> nvme_start_queues()? I think that would make the NVMe code harder to
> review. The above code won't cause any unexpected side effects if an
> NVMe namespace is removed after nvme_stop_queues() has been called
> and before nvme_start_queues() is called. Moving the
> blk_resume_queue(q) call into nvme_start_queues() will only work as
> expected if no namespaces are added nor removed between the
> nvme_stop_queues() and nvme_start_queues() calls. I'm not familiar
> enough with the NVMe code to know whether or not this change is safe
> ...
It's something that looks obviously wrong, so explain why you need to
do it, preferably in a comment above the function.
James
next prev parent reply other threads:[~2016-09-27 16:56 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-26 18:25 [PATCH 0/9] Introduce blk_quiesce_queue() and blk_resume_queue() Bart Van Assche
2016-09-26 18:26 ` [PATCH 2/9] dm: Fix a race condition related to stopping and starting queues Bart Van Assche
[not found] ` <ba8ddc16-b709-e7fb-1120-b6e1bd393540-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-09-27 6:21 ` Hannes Reinecke
2016-09-27 7:47 ` Johannes Thumshirn
[not found] ` <7948dbb8-6333-dc62-2673-4da35b4dfdbc-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-09-26 18:26 ` [PATCH 1/9] blk-mq: Introduce blk_mq_queue_stopped() Bart Van Assche
2016-09-27 6:20 ` Hannes Reinecke
2016-09-27 7:38 ` Johannes Thumshirn
2016-09-26 18:27 ` [PATCH 3/9] [RFC] nvme: Use BLK_MQ_S_STOPPED instead of QUEUE_FLAG_STOPPED in blk-mq code Bart Van Assche
2016-09-26 18:27 ` [PATCH 5/9] block: Extend blk_freeze_queue_start() to the non-blk-mq path Bart Van Assche
2016-09-27 7:50 ` Johannes Thumshirn
2016-09-27 13:22 ` Ming Lei
[not found] ` <CACVXFVO=GFp=ArC_FT+xPSmL84m01fX6bzReBQ8DeLQ4fUD5cQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-09-27 14:42 ` Bart Van Assche
[not found] ` <a8e8796e-7266-4c8a-a4eb-31cedf73ec8a-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-09-27 15:55 ` Bart Van Assche
2016-09-26 18:33 ` [PATCH 0/9] Introduce blk_quiesce_queue() and blk_resume_queue() Mike Snitzer
[not found] ` <20160926183308.GA13309-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-09-26 18:46 ` Bart Van Assche
2016-09-26 22:26 ` Bart Van Assche
2016-09-26 18:27 ` [PATCH 4/9] block: Move blk_freeze_queue() and blk_unfreeze_queue() code Bart Van Assche
[not found] ` <f990694e-76ea-f6b1-10a4-c23b9a738b39-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-09-27 6:26 ` Hannes Reinecke
[not found] ` <ffad7b3c-e7f5-56d7-0a75-574e65ac5b31-l3A5Bk7waGM@public.gmane.org>
2016-09-27 7:52 ` Johannes Thumshirn
2016-09-26 18:28 ` [PATCH 6/9] block: Rename mq_freeze_wq and mq_freeze_depth Bart Van Assche
2016-09-27 7:51 ` Johannes Thumshirn
2016-09-26 18:28 ` [PATCH 7/9] blk-mq: Introduce blk_quiesce_queue() and blk_resume_queue() Bart Van Assche
2016-09-26 18:28 ` [PATCH 8/9] SRP transport: Port srp_wait_for_queuecommand() to scsi-mq Bart Van Assche
2016-09-26 18:28 ` [PATCH 9/9] [RFC] nvme: Fix a race condition Bart Van Assche
2016-09-27 16:31 ` Steve Wise
2016-09-27 16:43 ` Bart Van Assche
2016-09-27 16:56 ` James Bottomley [this message]
[not found] ` <1474995360.2716.19.camel-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-09-27 17:09 ` Bart Van Assche
[not found] ` <3fb86a78-de3a-b764-a493-cb5bc5b6d8b6-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-09-28 14:23 ` Steve Wise
2016-09-27 16:56 ` Steve Wise
2016-10-11 16:27 ` [PATCH 0/9] Introduce blk_quiesce_queue() and blk_resume_queue() Laurence Oberman
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=1474995360.2716.19.camel@linux.vnet.ibm.com \
--to=jejb@linux.vnet.ibm.com \
--cc=axboe@fb.com \
--cc=bart.vanassche@sandisk.com \
--cc=dledford@redhat.com \
--cc=hch@lst.de \
--cc=keith.busch@intel.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=snitzer@redhat.com \
--cc=swise@opengridcomputing.com \
/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).