Skip to contentSkip to conversation

nvme-mpath: fix last path removal during traffic

PATCH New Sagi Grimberg 2 participants 2 messages Dec 21, 2017 – Dec 29, 2017 NVMe

lore
Share & tools
lore

Sagi Grimberg

author maintainer
#0 lore raw

PATCH 1/1 nvme-mpath: fix last path removal during traffic

In case our last path is removed during traffic, we can end up requeueing the bio(s) but never schedule the actual requeue work as upper layers still have open handles on the mpath device node.

Fix this by scheduling requeue work if the namespace being removed is last path in ns_head path list.

Fixes 32acab3181c7 ("nvme: implement multipath access to nvme subsystems")
Signed-off-by Sagi Grimberg <sagi at grimberg.me>
---
 drivers/nvme/host/core.c |  1 +
 drivers/nvme/host/nvme.h | 12 ++++++++++++
 2 files changed, 13 insertions(+)
drivers/nvme/host/core.c +1 -0
index 12fe1704437b..2e9a3889074e 100644
@@ -3002,6 +3002,7 @@ static void nvme_ns_remove(struct nvme_ns *ns)
 	mutex_unlock(&ns->ctrl->namespaces_mutex);
 
 	synchronize_srcu(&ns->head->srcu);
+	nvme_mpath_check_last_path(ns);
 	nvme_put_ns(ns);
 }
 
drivers/nvme/host/nvme.h +12 -0
index 4361b71891e9..28d1f586619d 100644
@@ -422,6 +422,15 @@ static inline void nvme_mpath_clear_current_path(struct nvme_ns *ns)
 		rcu_assign_pointer(head->current_path, NULL);
 }
 struct nvme_ns *nvme_find_path(struct nvme_ns_head *head);
+
+static inline void nvme_mpath_check_last_path(struct nvme_ns *ns)
+{
+	struct nvme_ns_head *head = ns->head;
+
+	if (head->disk && list_empty(&head->list))
+		kblockd_schedule_work(&head->requeue_work);
+}
+
 #else
 static inline void nvme_failover_req(struct request *req)
 {
@@ -453,6 +462,9 @@ static inline void nvme_mpath_remove_disk_links(struct nvme_ns *ns)
 static inline void nvme_mpath_clear_current_path(struct nvme_ns *ns)
 {
 }
+static inline void nvme_mpath_check_last_path(struct nvme_ns *ns)
+{
+}
 #endif /* CONFIG_NVME_MULTIPATH */
 
 #ifdef CONFIG_NVM
Signature · 1 line
2.14.1
maintainer Applied
#1 lore raw

PATCH 1/1 nvme-mpath: fix last path removal during traffic

Thanks, applied to nvme-4.15.