All of lore.kernel.org
 help / color / mirror / Atom feed
From: hare@suse.de (Hannes Reinecke)
Subject: [PATCH 3/3] nvme-multipath: test namespace state when selecting a new path
Date: Wed, 27 Mar 2019 09:09:29 +0100	[thread overview]
Message-ID: <20190327080929.27918-4-hare@suse.de> (raw)
In-Reply-To: <20190327080929.27918-1-hare@suse.de>

When selecting a new path we need to check if the namespace is
not about to be removed.

Signed-off-by: Hannes Reinecke <hare at suse.com>
---
 drivers/nvme/host/multipath.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index f69c9476d663..a87462efc927 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -130,7 +130,8 @@ static struct nvme_ns *__nvme_find_path(struct nvme_ns_head *head, int node)
 
 	list_for_each_entry_rcu(ns, &head->list, siblings) {
 		if (ns->ctrl->state != NVME_CTRL_LIVE ||
-		    test_bit(NVME_NS_ANA_PENDING, &ns->flags))
+		    test_bit(NVME_NS_ANA_PENDING, &ns->flags) ||
+		    test_bit(NVME_NS_REMOVING, &ns->flags))
 			continue;
 
 		if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_NUMA)
@@ -185,7 +186,8 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
 	     ns != old;
 	     ns = nvme_next_ns(head, ns)) {
 		if (ns->ctrl->state != NVME_CTRL_LIVE ||
-		    test_bit(NVME_NS_ANA_PENDING, &ns->flags))
+		    test_bit(NVME_NS_ANA_PENDING, &ns->flags) ||
+		    test_bit(NVME_NS_REMOVING, &ns->flags))
 			continue;
 
 		if (ns->ana_state == NVME_ANA_OPTIMIZED) {
-- 
2.16.4

      parent reply	other threads:[~2019-03-27  8:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-27  8:09 [PATCH 0/3] nvme: fixup race with namespace removal Hannes Reinecke
2019-03-27  8:09 ` [PATCH 1/3] nvme: do not quiesce or unquiesce invalid namespaces Hannes Reinecke
2019-03-27  8:09 ` [PATCH 2/3] nvme: shorten race window in nvme_ns_remove() Hannes Reinecke
2019-03-27 14:02   ` Christoph Hellwig
2019-03-27 14:41     ` Hannes Reinecke
2019-03-27 14:20   ` Keith Busch
2019-03-27 15:12     ` Hannes Reinecke
2019-03-27 18:50       ` James Smart
2019-03-28  9:27         ` Hannes Reinecke
2019-03-28 11:07           ` Ming Lei
2019-03-28 11:48             ` Hannes Reinecke
2019-03-28 12:11               ` Hannes Reinecke
2019-03-28 15:19                 ` Ming Lei
2019-03-28 15:56                   ` James Smart
2019-03-28 15:46                 ` James Smart
2019-03-28 15:57                   ` Hannes Reinecke
2019-03-28 17:50                     ` James Smart
2019-03-28 15:05           ` James Smart
2019-03-28 15:50             ` Hannes Reinecke
2019-03-29  0:40               ` Ming Lei
2019-03-27  8:09 ` Hannes Reinecke [this message]

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=20190327080929.27918-4-hare@suse.de \
    --to=hare@suse.de \
    /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.