All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-multipath: relax ANA state check
@ 2019-01-28 14:24 martinus.gpy
  2019-01-28 16:30 ` Christoph Hellwig
  0 siblings, 1 reply; 8+ messages in thread
From: martinus.gpy @ 2019-01-28 14:24 UTC (permalink / raw)


From: Martin George <marting@netapp.com>

Always call nvme_mpath_set_live() when transitioning to a live
state, where live is defined as ANA Optimized or Non-Optimized,
irrespective of what the previous asymmetric access state was.
This removes the restriction of only permitting transitions
from states that were not considered live.

Signed-off-by: Martin George <marting at netapp.com>
Signed-off-by: Gargi Srinivas <sring at netapp.com>
---
 drivers/nvme/host/multipath.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index b9fff3b8ed1b..23da7beadd62 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -366,15 +366,12 @@ static inline bool nvme_state_is_live(enum nvme_ana_state state)
 static void nvme_update_ns_ana_state(struct nvme_ana_group_desc *desc,
 		struct nvme_ns *ns)
 {
-	enum nvme_ana_state old;
-
 	mutex_lock(&ns->head->lock);
-	old = ns->ana_state;
 	ns->ana_grpid = le32_to_cpu(desc->grpid);
 	ns->ana_state = desc->state;
 	clear_bit(NVME_NS_ANA_PENDING, &ns->flags);
 
-	if (nvme_state_is_live(ns->ana_state) && !nvme_state_is_live(old))
+	if (nvme_state_is_live(ns->ana_state))
 		nvme_mpath_set_live(ns);
 	mutex_unlock(&ns->head->lock);
 }
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH] nvme-multipath: relax ANA state check
@ 2019-01-25 11:12 martinus.gpy
  2019-01-25 12:57 ` Hannes Reinecke
  2019-01-28  7:43 ` Christoph Hellwig
  0 siblings, 2 replies; 8+ messages in thread
From: martinus.gpy @ 2019-01-25 11:12 UTC (permalink / raw)


From: Martin George <marting@netapp.com>

The current nvme multipath code prevents access to a namespace
through a controller that has transitioned from ANA Optimized
to Non-Optimized and vice versa. As per the NVMe 1.3 TP4004
spec, "The change from one asymmetric namespace access state
to another asymmetric namespace access state is called a
transition". The emphasis here is on the change itself,
whatever the change may be. So a change from ANA Optimized to
Non-Optimized and vice versa, are actually valid transition
scenarios. In fact, if one were to exit and reenter the same
state, that too is a change i.e. a change to the same state
is also a valid transition scenario.

So remove the "old" state check during ANA state update, so
that transition from ANA Optimized to Non-Optimized and vice
versa, along with transition to the same state, are all
permitted.

Signed-off-by: Martin George <marting at netapp.com>
Signed-off-by: Gargi Srinivas <sring at netapp.com>
---
 drivers/nvme/host/multipath.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index b9fff3b8ed1b..23da7beadd62 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -366,15 +366,12 @@ static inline bool nvme_state_is_live(enum nvme_ana_state state)
 static void nvme_update_ns_ana_state(struct nvme_ana_group_desc *desc,
 		struct nvme_ns *ns)
 {
-	enum nvme_ana_state old;
-
 	mutex_lock(&ns->head->lock);
-	old = ns->ana_state;
 	ns->ana_grpid = le32_to_cpu(desc->grpid);
 	ns->ana_state = desc->state;
 	clear_bit(NVME_NS_ANA_PENDING, &ns->flags);
 
-	if (nvme_state_is_live(ns->ana_state) && !nvme_state_is_live(old))
+	if (nvme_state_is_live(ns->ana_state))
 		nvme_mpath_set_live(ns);
 	mutex_unlock(&ns->head->lock);
 }
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-01-31 10:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-28 14:24 [PATCH] nvme-multipath: relax ANA state check martinus.gpy
2019-01-28 16:30 ` Christoph Hellwig
2019-01-28 17:10   ` George, Martin
2019-01-31 10:03     ` hch
  -- strict thread matches above, loose matches on Subject: below --
2019-01-25 11:12 martinus.gpy
2019-01-25 12:57 ` Hannes Reinecke
2019-01-28  7:43 ` Christoph Hellwig
2019-01-28 14:01   ` George, Martin

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.