Skip to contentSkip to conversation

nvme-fc: clear q_live at beginning of association teardown

PATCH Applied James Smart 5 participants 7 messages May 11, 2021 – May 19, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-fc: clear q_live at beginning of association teardown

The __nvmf_check_ready() routine used to bounce all filesystem io if the controller state isn't LIVE. However, a later patch changed the logic so that it rejection ends up being based on the Q live check. The fc transport has a slightly different sequence from rdma and tcp for shutting down queues/marking them non-live. FC marks its queue non-live after aborting all ios and waiting for their termination, leaving a rather large window for filesystem io to continue to hit the transport. Unfortunately this resulted in filesystem io or applications seeing I/O errors.

Change the fc transport to mark the queues non-live at the first sign of teardown for the association (when i/o is initially terminated).

Fixes 73a5379937ec ("nvme-fabrics: allow to queue requests for live queues")
Cc <[email protected]> # v5.8+

---
stable trees for 5.8 and 5.9 will require a slightly modified patch

---
 drivers/nvme/host/fc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/nvme/host/fc.c +12 -0
index d9ab9e7871d0..256e87721a01 100644
@@ -2461,6 +2461,18 @@ nvme_fc_terminate_exchange(struct request *req, void *data, bool reserved)
 static void
 __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues)
 {
+	int q;
+
+	/*
+	 * if aborting io, the queues are no longer good, mark them
+	 * all as not live.
+	 */
+	if (ctrl->ctrl.queue_count > 1) {
+		for (q = 1; q < ctrl->ctrl.queue_count; q++)
+			clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[q].flags);
+	}
+	clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[0].flags);
+
 	/*
 	 * If io queues are present, stop them and terminate all outstanding
 	 * ios on them. As FC allocates FC exchange for each io, the
Signature · 1 line
2.26.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines

The __nvmf_check_ready() routine used to bounce all filesystem io if the controller state isn't LIVE. However, a later patch changed the logic so that it rejection ends up being based on the Q live check. The fc transport has a slightly different sequence from rdma and tcp for shutting down queues/marking them non-live. FC marks its queue non-live after aborting all ios and waiting for their termination, leaving a rather large window for filesystem io to continue to hit the transport. Unfortunately this resulted in filesystem io or applications seeing I/O errors.

Quoted 2 lines

Change the fc transport to mark the queues non-live at the first sign of teardown for the association (when i/o is initially terminated).

Sounds like the correct behavior to me, what is the motivation for doing that only after all I/O was aborted?

And,

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

#2 lore raw
Quoted 11 lines · Sagi Grimberg
Quoted 11 lines

The __nvmf_check_ready() routine used to bounce all filesystem io if the controller state isn't LIVE. However, a later patch changed the logic so that it rejection ends up being based on the Q live check. The fc transport has a slightly different sequence from rdma and tcp for shutting down queues/marking them non-live. FC marks its queue non-live after aborting all ios and waiting for their termination, leaving a rather large window for filesystem io to continue to hit the transport. Unfortunately this resulted in filesystem io or applications seeing I/O errors.

Quoted 8 lines
Quoted 2 lines

Change the fc transport to mark the queues non-live at the first sign of teardown for the association (when i/o is initially terminated).

Sounds like the correct behavior to me, what is the motivation for doing that only after all I/O was aborted?

And,

source evolution over time (rdma/tcp changed how they worked) and the need didn't show up earlier based on the earlier checks.

-- james

maintainer
#3 lore raw
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines

The __nvmf_check_ready() routine used to bounce all filesystem io if the controller state isn't LIVE. However, a later patch changed the logic so that it rejection ends up being based on the Q live check. The fc transport has a slightly different sequence from rdma and tcp for shutting down queues/marking them non-live. FC marks its queue non-live after aborting all ios and waiting for their termination, leaving a rather large window for filesystem io to continue to hit the transport. Unfortunately this resulted in filesystem io or applications seeing I/O errors.

Change the fc transport to mark the queues non-live at the first sign of teardown for the association (when i/o is initially terminated).

Quoted 7 lines
Quoted 5 lines

Sounds like the correct behavior to me, what is the motivation for doing that only after all I/O was aborted?

And,

source evolution over time (rdma/tcp changed how they worked) and the need didn't show up earlier based on the earlier checks.

Makes sense...

Reviewed-by on v1 1/1
#4 lore raw
In reply to James Smart
Quoted 37 lines · James Smart

The __nvmf_check_ready() routine used to bounce all filesystem io if the controller state isn't LIVE. However, a later patch changed the logic so that it rejection ends up being based on the Q live check. The fc transport has a slightly different sequence from rdma and tcp for shutting down queues/marking them non-live. FC marks its queue non-live after aborting all ios and waiting for their termination, leaving a rather large window for filesystem io to continue to hit the transport. Unfortunately this resulted in filesystem io or applications seeing I/O errors.

Change the fc transport to mark the queues non-live at the first sign of teardown for the association (when i/o is initially terminated).

Fixes 73a5379937ec ("nvme-fabrics: allow to queue requests for live queues")
Cc <[email protected]> # v5.8+

---
stable trees for 5.8 and 5.9 will require a slightly modified patch

---
  drivers/nvme/host/fc.c | 12 ++++++++++++
  1 file changed, 12 insertions(+)
drivers/nvme/host/fc.c +5 -0
index d9ab9e7871d0..256e87721a01 100644
@@ -2461,6 +2461,18 @@ nvme_fc_terminate_exchange(struct request *req, void *data, bool reserved)
  static void
  __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues)
  {
+	int q;
+
+	/*
+	 * if aborting io, the queues are no longer good, mark them
+	 * all as not live.

drivers/nvme/host/fc.c nvme_fc_terminate_exchange(struct request *req, void *data, bool reserved) · line 2478

Quoted 10 lines
drivers/nvme/host/fc.c +7 -0
+	 */
+	if (ctrl->ctrl.queue_count > 1) {
+		for (q = 1; q < ctrl->ctrl.queue_count; q++)
+			clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[q].flags);
+	}
+	clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[0].flags);
+
  	/*
  	 * If io queues are present, stop them and terminate all outstanding
  	 * ios on them. As FC allocates FC exchange for each io, the
Signature · 1 line
Himanshu Madhani                               Oracle Linux Engineering
Reviewed-by on v1 1/1
#5 lore raw
In reply to James Smart
Quoted 37 lines · James Smart

The __nvmf_check_ready() routine used to bounce all filesystem io if the controller state isn't LIVE. However, a later patch changed the logic so that it rejection ends up being based on the Q live check. The fc transport has a slightly different sequence from rdma and tcp for shutting down queues/marking them non-live. FC marks its queue non-live after aborting all ios and waiting for their termination, leaving a rather large window for filesystem io to continue to hit the transport. Unfortunately this resulted in filesystem io or applications seeing I/O errors.

Change the fc transport to mark the queues non-live at the first sign of teardown for the association (when i/o is initially terminated).

Fixes 73a5379937ec ("nvme-fabrics: allow to queue requests for live queues")
Cc <[email protected]> # v5.8+

---
stable trees for 5.8 and 5.9 will require a slightly modified patch

---
 drivers/nvme/host/fc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/nvme/host/fc.c +5 -0
index d9ab9e7871d0..256e87721a01 100644
@@ -2461,6 +2461,18 @@ nvme_fc_terminate_exchange(struct request *req, void *data, bool reserved)
 static void
 __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues)
 {
+	int q;
+
+	/*
+	 * if aborting io, the queues are no longer good, mark them
+	 * all as not live.

drivers/nvme/host/fc.c nvme_fc_terminate_exchange(struct request *req, void *data, bool reserved) · line 2478

Quoted 10 lines
drivers/nvme/host/fc.c +7 -0
+	 */
+	if (ctrl->ctrl.queue_count > 1) {
+		for (q = 1; q < ctrl->ctrl.queue_count; q++)
+			clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[q].flags);
+	}
+	clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[0].flags);
+
 	/*
 	 * If io queues are present, stop them and terminate all outstanding
 	 * ios on them. As FC allocates FC exchange for each io, the

Cheers,

Hannes

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