Skip to contentSkip to conversation

nvme: schedule requeue whenever a LIVE state is entered

PATCH New Hannes Reinecke 4 participants 8 messages Mar 21, 2019 – Mar 27, 2019 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: schedule requeue whenever a LIVE state is entered

When undergoing state transitions I/O might be requeued, hence we always have to schedule requeue_work whenever the nvme device is live, independent on whether the old state was live or not.

Reported-by Martin George <martin.george at netapp.com>
Signed-off-by Hannes Reinecke <hare at suse.com>
---
 drivers/nvme/host/multipath.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/nvme/host/multipath.c +6 -4
index 2839bb70badf..f69c9476d663 100644
@@ -352,8 +352,6 @@ static void nvme_mpath_set_live(struct nvme_ns *ns)
 			__nvme_find_path(head, node);
 		srcu_read_unlock(&head->srcu, srcu_idx);
 	}
-
-	kblockd_schedule_work(&ns->head->requeue_work);
 }
 
 static int nvme_parse_ana_log(struct nvme_ctrl *ctrl, void *data,
@@ -412,8 +410,11 @@ static void nvme_update_ns_ana_state(struct nvme_ana_group_desc *desc,
 	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))
-		nvme_mpath_set_live(ns);
+	if (nvme_state_is_live(ns->ana_state)) {
+		if (!nvme_state_is_live(old))
+			nvme_mpath_set_live(ns);
+		kblockd_schedule_work(&ns->head->requeue_work);
+	}
 	mutex_unlock(&ns->head->lock);
 }
 
@@ -587,6 +588,7 @@ void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id)
 		mutex_lock(&ns->head->lock);
 		ns->ana_state = NVME_ANA_OPTIMIZED; 
 		nvme_mpath_set_live(ns);
+		kblockd_schedule_work(&ns->head->requeue_work);
 		mutex_unlock(&ns->head->lock);
 	}
 }
Signature · 1 line
2.16.4
maintainer
#1 lore raw

PATCH 1/1 nvme: schedule requeue whenever a LIVE state is entered

Quoted 4 lines

When undergoing state transitions I/O might be requeued, hence we always have to schedule requeue_work whenever the nvme device is live, independent on whether the old state was live or not.

Any reason why not simply update from live to live?

#2 lore raw

PATCH 1/1 nvme: schedule requeue whenever a LIVE state is entered

Quoted 7 lines · Sagi Grimberg
Quoted 4 lines

When undergoing state transitions I/O might be requeued, hence we always have to schedule requeue_work whenever the nvme device is live, independent on whether the old state was live or not.

Any reason why not simply update from live to live?

?

I somewhat fail to parse the answer.
Care to elaborate?

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		               zSeries & Storage
hare at suse.com			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: F. Imend?rffer, J. Smithard, D. Upmanyu, G. Norton
HRB 21284 (AG N?rnberg)
maintainer
#3 lore raw

PATCH 1/1 nvme: schedule requeue whenever a LIVE state is entered

Quoted 10 lines
Quoted 6 lines
Quoted 3 lines

When undergoing state transitions I/O might be requeued, hence we always have to schedule requeue_work whenever the nvme device is live, independent on whether the old state was live or not.

Any reason why not simply update from live to live?

?

I somewhat fail to parse the answer.
Care to elaborate?

--

drivers/nvme/host/multipath.c +0 -0
index 2839bb70badf..f0716f6ce41f 100644
@@ -404,15 +404,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);

}
--

#4 lore raw

PATCH 1/1 nvme: schedule requeue whenever a LIVE state is entered

Quoted 33 lines · Sagi Grimberg
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines

When undergoing state transitions I/O might be requeued, hence we always have to schedule requeue_work whenever the nvme device is live, independent on whether the old state was live or not.

Any reason why not simply update from live to live?

?

I somewhat fail to parse the answer.
Care to elaborate?

drivers/nvme/host/multipath.c +1 -4
index 2839bb70badf..f0716f6ce41f 100644
@@ -404,15 +404,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);
Quoted 2 lines

?}

That's what we tried initially (cf thread "[PATCH] nvme-multipath: relax ANA state check"), but got rejected by Christoph.

Cheers,

Hannes

maintainer
#5 lore raw

PATCH 1/1 nvme: schedule requeue whenever a LIVE state is entered

Quoted 3 lines

That's what we tried initially (cf thread "[PATCH] nvme-multipath: relax ANA state check"), but got rejected by Christoph.

IIRC Christoph was asking why was requests being requeued when moving from live -> live, and I think you answered that in your patch description..

#6 lore raw

PATCH 1/1 nvme: schedule requeue whenever a LIVE state is entered

Quoted 7 lines · Sagi Grimberg
Quoted 3 lines

That's what we tried initially (cf thread "[PATCH] nvme-multipath: relax ANA state check"), but got rejected by Christoph.

IIRC Christoph was asking why was requests being requeued when moving from live -> live, and I think you answered that in your patch description..

Exactltly. Asking to please explain WTF is happening is not rejecting, it is asking for more information to actually understand the issue.

So the patch from Georg with a changelog and comment in the code based on yours seems like what we need.

#7 lore raw

PATCH 1/1 nvme: schedule requeue whenever a LIVE state is entered

Quoted 9 lines · Christoph Hellwig
Quoted 7 lines · Sagi Grimberg
Quoted 3 lines

That's what we tried initially (cf thread "[PATCH] nvme-multipath: relax ANA state check"), but got rejected by Christoph.

IIRC Christoph was asking why was requests being requeued when moving from live -> live, and I think you answered that in your patch description..

Quoted 6 lines

Exactly. Asking to please explain WTF is happening is not rejecting, it is asking for more information to actually understand the issue.

So the patch from Georg with a changelog and comment in the code based on yours seems like what we need.

Okay, will be resending.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare at suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG N?rnberg)