Skip to contentSkip to conversation

nvme: generate uevent once a multipath namespace is operational again

PATCH Superseded Hannes Reinecke 3 participants 6 messages May 11, 2021 – May 12, 2021 NVMe

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 nvme: generate uevent once a multipath namespace is operational again

In an all paths down scenario I/O will be requeued or aborted, so no further I/O will be ongoing on this namespace.
This leaves upper layers like MD unable to determine if the namespace becomes operational again after a successful controller reset. This patch will send an uevent per multipathed namespace once the underlying controller is LIVE, allowing MD to start resync.

Changes to v1:
- use disk_uevent() as suggested by hch

---
 drivers/nvme/host/multipath.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/nvme/host/multipath.c +5 -2
index 0551796517e6..ecc99bd5f8ad 100644
@@ -100,8 +100,11 @@ void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl)
 
 	down_read(&ctrl->namespaces_rwsem);
 	list_for_each_entry(ns, &ctrl->namespaces, list) {
-		if (ns->head->disk)
-			kblockd_schedule_work(&ns->head->requeue_work);
+		if (!ns->head->disk)
+			continue;
+		kblockd_schedule_work(&ns->head->requeue_work);
+		if (ctrl->state == NVME_CTRL_LIVE)
+			disk_uevent(ns->head->disk, KOBJ_CHANGE);
 	}
 	up_read(&ctrl->namespaces_rwsem);
 }
Signature · 7 lines
2.29.2


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
#1 lore raw
Quoted 6 lines · Hannes Reinecke

In an all paths down scenario I/O will be requeued or aborted, so no further I/O will be ongoing on this namespace.
This leaves upper layers like MD unable to determine if the namespace becomes operational again after a successful controller reset. This patch will send an uevent per multipathed namespace once the underlying controller is LIVE, allowing MD to start resync.

Can you please also add a comment why we are sending the event?

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#2 lore raw
Quoted 10 lines · Christoph Hellwig
Quoted 6 lines · Hannes Reinecke

In an all paths down scenario I/O will be requeued or aborted, so no further I/O will be ongoing on this namespace.
This leaves upper layers like MD unable to determine if the namespace becomes operational again after a successful controller reset. This patch will send an uevent per multipathed namespace once the underlying controller is LIVE, allowing MD to start resync.

Can you please also add a comment why we are sending the event?

You mean, why sending KOBJ_CHANGE and not KOBJ_ADD?

Cheers,

Hannes

Signature · 9 lines
Dr. Hannes Reinecke                Kernel Storage Architect
[email protected]                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
#4 lore raw
Quoted 7 lines · Christoph Hellwig
Quoted 3 lines · Hannes Reinecke
Quoted 2 lines

Can you please also add a comment why we are sending the event?

You mean, why sending KOBJ_CHANGE and not KOBJ_ADD?

Maybe that to, but most importantly why we are sending an event here.

Ah. A comment in the code, you mean.
Of course, will do.

Cheers,

Hannes

Signature · 9 lines
Dr. Hannes Reinecke		           Kernel Storage Architect
[email protected]			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
maintainer
#5 lore raw
In reply to Hannes Reinecke
Quoted 24 lines

In an all paths down scenario I/O will be requeued or aborted, so no further I/O will be ongoing on this namespace.
This leaves upper layers like MD unable to determine if the namespace becomes operational again after a successful controller reset. This patch will send an uevent per multipathed namespace once the underlying controller is LIVE, allowing MD to start resync.

Changes to v1:
- use disk_uevent() as suggested by hch

---
  drivers/nvme/host/multipath.c | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)
drivers/nvme/host/multipath.c +0 -0
index 0551796517e6..ecc99bd5f8ad 100644
@@ -100,8 +100,11 @@ void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl)
 
  	down_read(&ctrl->namespaces_rwsem);
  	list_for_each_entry(ns, &ctrl->namespaces, list) {

drivers/nvme/host/multipath.c void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl) · line 110

Quoted 10 lines
drivers/nvme/host/multipath.c +5 -2
-		if (ns->head->disk)
-			kblockd_schedule_work(&ns->head->requeue_work);
+		if (!ns->head->disk)
+			continue;
+		kblockd_schedule_work(&ns->head->requeue_work);
+		if (ctrl->state == NVME_CTRL_LIVE)
+			disk_uevent(ns->head->disk, KOBJ_CHANGE);
  	}
  	up_read(&ctrl->namespaces_rwsem);
  }

Why only for multipath namespaces though? This is not needed for non-multipath namespaces

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme