Skip to contentSkip to conversation

nvmet-rdma: don't forget to delete a queue from the list of connection failed

PATCH New Sagi Grimberg 2 participants 3 messages Nov 6, 2016

Subsystems (2)
lore
Share & tools
lore

Sagi Grimberg

author maintainer
#0 lore raw

PATCH 1/1 nvmet-rdma: don't forget to delete a queue from the list of connection failed

In case we accepted a queue connection and it failed, we might not remove the queue from the list until we unload and clean it up. We should delete it from the queue list on the relevant handler.

Signed-off-by Sagi Grimberg <sagi at grimberg.me>

---
Changes from v1:
- changed strategy according to hch's comments. remove the queue on connection failure handlers.
- chaged the commit description (was "nvmet-rdma: add queue to queue list only if connection established")

 drivers/nvme/target/rdma.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/nvme/target/rdma.c +6 -1
index bafd9898b5f6..a9eb677d562a 100644
@@ -1272,7 +1272,12 @@ static void nvmet_rdma_queue_connect_fail(struct rdma_cm_id *cm_id,
 {
 	WARN_ON_ONCE(queue->state != NVMET_RDMA_Q_CONNECTING);
 
-	pr_err("failed to connect queue\n");
+	mutex_lock(&nvmet_rdma_queue_mutex);
+	if (!list_empty(&queue->queue_list))
+		list_del_init(&queue->queue_list);
+	mutex_unlock(&nvmet_rdma_queue_mutex);
+
+	pr_err("failed to connect queue %d\n", queue->idx);
 	schedule_work(&queue->release_work);
 }
 
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 nvmet-rdma: don't forget to delete a queue from the list of connection failed

Quoted 3 lines · Sagi Grimberg

In case we accepted a queue connection and it failed, we might not remove the queue from the list until we unload and clean it up. We should delete it from the queue list on the relevant handler.

I think for this to work we'll also need to initialize ->queue_list when allocating the queue.

author maintainer
#2 lore raw

PATCH 1/1 nvmet-rdma: don't forget to delete a queue from the list of connection failed

Quoted 7 lines
Quoted 4 lines

In case we accepted a queue connection and it failed, we might not remove the queue from the list until we unload and clean it up. We should delete it from the queue list on the relevant handler.

I think for this to work we'll also need to initialize ->queue_list when allocating the queue.

Not really because we'll only manipulate the queue_list if we accept which means that it's in the list, nvmet_rdma_queue_connect() failures won't ever see nvmet_rdma_queue_connect_fail(). But I can add it for good measures...