All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvmet-rdma: add queue to queue list only if connection established
@ 2016-11-06  9:48 Sagi Grimberg
  2016-11-06 16:43 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Sagi Grimberg @ 2016-11-06  9:48 UTC (permalink / raw)


In case we accepted a queue connection and it failed, we might not
remove the queue from the list. Instead of dealing with it, simply
add the insert the queue only if we successfully established.

Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
---
 drivers/nvme/target/rdma.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index bafd9898b5f6..c25a5f58eea6 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -1184,10 +1184,6 @@ static int nvmet_rdma_queue_connect(struct rdma_cm_id *cm_id,
 	if (ret)
 		goto release_queue;
 
-	mutex_lock(&nvmet_rdma_queue_mutex);
-	list_add_tail(&queue->queue_list, &nvmet_rdma_queue_list);
-	mutex_unlock(&nvmet_rdma_queue_mutex);
-
 	return 0;
 
 release_queue:
@@ -1209,6 +1205,10 @@ static void nvmet_rdma_queue_established(struct nvmet_rdma_queue *queue)
 	}
 	queue->state = NVMET_RDMA_Q_LIVE;
 
+	mutex_lock(&nvmet_rdma_queue_mutex);
+	list_add_tail(&queue->queue_list, &nvmet_rdma_queue_list);
+	mutex_unlock(&nvmet_rdma_queue_mutex);
+
 	while (!list_empty(&queue->rsp_wait_list)) {
 		struct nvmet_rdma_rsp *cmd;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] nvmet-rdma: add queue to queue list only if connection established
  2016-11-06  9:48 [PATCH] nvmet-rdma: add queue to queue list only if connection established Sagi Grimberg
@ 2016-11-06 16:43 ` Christoph Hellwig
  2016-11-06 17:19   ` Sagi Grimberg
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2016-11-06 16:43 UTC (permalink / raw)


On Sun, Nov 06, 2016@11:48:10AM +0200, Sagi Grimberg wrote:
> In case we accepted a queue connection and it failed, we might not
> remove the queue from the list. Instead of dealing with it, simply
> add the insert the queue only if we successfully established.

But that means we'd potentionally leak it when unloading the module,
if that happens at just the wrong time, don't we?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] nvmet-rdma: add queue to queue list only if connection established
  2016-11-06 16:43 ` Christoph Hellwig
@ 2016-11-06 17:19   ` Sagi Grimberg
  0 siblings, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2016-11-06 17:19 UTC (permalink / raw)



>> In case we accepted a queue connection and it failed, we might not
>> remove the queue from the list. Instead of dealing with it, simply
>> add the insert the queue only if we successfully established.
>
> But that means we'd potentionally leak it when unloading the module,
> if that happens at just the wrong time, don't we?

Yea... didn't think of that. I started with removing from the list on
connect failure too but thought this would be better...

I'll reverse the strategy again...

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-06 17:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-06  9:48 [PATCH] nvmet-rdma: add queue to queue list only if connection established Sagi Grimberg
2016-11-06 16:43 ` Christoph Hellwig
2016-11-06 17:19   ` Sagi Grimberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.