From: martinus.gpy@gmail.com (martinus.gpy@gmail.com) Date: Fri, 25 Jan 2019 16:42:36 +0530 Subject: [PATCH] nvme-multipath: relax ANA state check Message-ID: <20190125111236.5389-1-marting@netapp.com> From: Martin George 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 Signed-off-by: Gargi Srinivas --- 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