All of lore.kernel.org
 help / color / mirror / Atom feed
From: ming.lei@redhat.com (Ming Lei)
Subject: [PATCH V2] nvme: fix nvme_remove going to uninterruptible sleep for ever
Date: Thu, 1 Jun 2017 22:56:10 +0800	[thread overview]
Message-ID: <20170601145605.GA29369@ming.t460p> (raw)
In-Reply-To: <20170601124631.GA28652@lst.de>

On Thu, Jun 01, 2017@02:46:32PM +0200, Christoph Hellwig wrote:
> On Thu, Jun 01, 2017@03:36:50PM +0300, Rakesh Pandit wrote:
> > Also Sagi pointed out that user space set_features ioctl if fired up
> > in a window after nvme_removal it can also result in this issue seems
> > to be correct.  I would prefer to keep this as it is and introduce
> > similar check higher up in nvme_ioctrl instead so that we don't send
> > sync commands if queues are killed already.
> > 
> > Would you prefer a patch ? Thanks,
> 
> If we want to kill everyone we probably should do it in ->queue_rq.

Looks ->queue_rq has done it already via checking nvmeq->cq_vector

> Or is the block layer blocking you somewhere else?

blk-mq doesn't handle dying in the I/O path.

Maybe it is similar with 806f026f9b901eaf1a(nvme: use blk_mq_start_hw_queues() in
nvme_kill_queues()), seems we need to do it for admin_q too.

Can the following change fix the issue?

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index e44326d5cf19..360758488124 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2438,6 +2438,7 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl)
 	struct nvme_ns *ns;
 
 	mutex_lock(&ctrl->namespaces_mutex);
+	blk_mq_start_hw_queues(ctrl->admin_q);
 	list_for_each_entry(ns, &ctrl->namespaces, list) {
 		/*
 		 * Revalidating a dead namespace sets capacity to 0. This will


Thanks,
Ming

WARNING: multiple messages have this Message-ID (diff)
From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Rakesh Pandit <rakesh@tuxera.com>, Jens Axboe <axboe@fb.com>,
	Sagi Grimberg <sagi@grimberg.me>,
	linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org,
	Keith Busch <keith.busch@intel.com>,
	Andy Lutomirski <luto@kernel.org>
Subject: Re: [PATCH V2] nvme: fix nvme_remove going to uninterruptible sleep for ever
Date: Thu, 1 Jun 2017 22:56:10 +0800	[thread overview]
Message-ID: <20170601145605.GA29369@ming.t460p> (raw)
In-Reply-To: <20170601124631.GA28652@lst.de>

On Thu, Jun 01, 2017 at 02:46:32PM +0200, Christoph Hellwig wrote:
> On Thu, Jun 01, 2017 at 03:36:50PM +0300, Rakesh Pandit wrote:
> > Also Sagi pointed out that user space set_features ioctl if fired up
> > in a window after nvme_removal it can also result in this issue seems
> > to be correct.  I would prefer to keep this as it is and introduce
> > similar check higher up in nvme_ioctrl instead so that we don't send
> > sync commands if queues are killed already.
> > 
> > Would you prefer a patch ? Thanks,
> 
> If we want to kill everyone we probably should do it in ->queue_rq.

Looks ->queue_rq has done it already via checking nvmeq->cq_vector

> Or is the block layer blocking you somewhere else?

blk-mq doesn't handle dying in the I/O path.

Maybe it is similar with 806f026f9b901eaf1a(nvme: use blk_mq_start_hw_queues() in
nvme_kill_queues()), seems we need to do it for admin_q too.

Can the following change fix the issue?

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index e44326d5cf19..360758488124 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2438,6 +2438,7 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl)
 	struct nvme_ns *ns;
 
 	mutex_lock(&ctrl->namespaces_mutex);
+	blk_mq_start_hw_queues(ctrl->admin_q);
 	list_for_each_entry(ns, &ctrl->namespaces, list) {
 		/*
 		 * Revalidating a dead namespace sets capacity to 0. This will


Thanks,
Ming

  reply	other threads:[~2017-06-01 14:56 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-30  7:16 [PATCH V2] nvme: fix nvme_remove going to uninterruptible sleep for ever Rakesh Pandit
2017-05-30  7:16 ` Rakesh Pandit
2017-05-30  9:36 ` Christoph Hellwig
2017-05-30  9:36   ` Christoph Hellwig
2017-05-30 10:18 ` Sagi Grimberg
2017-05-30 10:18   ` Sagi Grimberg
2017-05-30 14:23   ` Rakesh Pandit
2017-05-30 14:23     ` Rakesh Pandit
2017-06-01 11:43     ` Christoph Hellwig
2017-06-01 11:43       ` Christoph Hellwig
2017-06-01 12:28       ` Rakesh Pandit
2017-06-01 12:28         ` Rakesh Pandit
2017-06-01 12:35         ` Christoph Hellwig
2017-06-01 12:35           ` Christoph Hellwig
2017-06-01 12:36         ` Rakesh Pandit
2017-06-01 12:36           ` Rakesh Pandit
2017-06-01 12:46           ` Christoph Hellwig
2017-06-01 12:46             ` Christoph Hellwig
2017-06-01 14:56             ` Ming Lei [this message]
2017-06-01 14:56               ` Ming Lei
2017-06-01 19:33               ` Rakesh Pandit
2017-06-01 19:33                 ` Rakesh Pandit
2017-06-02  1:42                 ` Ming Lei
2017-06-02  1:42                   ` Ming Lei
2017-06-04 15:28       ` Sagi Grimberg
2017-06-04 15:28         ` Sagi Grimberg
2017-06-05  8:18         ` Christoph Hellwig
2017-06-05  8:18           ` Christoph Hellwig
2017-06-05 10:52           ` Rakesh Pandit
2017-06-05 10:52             ` Rakesh Pandit
2017-06-05 11:09             ` Sagi Grimberg
2017-06-05 11:09               ` Sagi Grimberg

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=20170601145605.GA29369@ming.t460p \
    --to=ming.lei@redhat.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 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.