* [PATCH] nvmet-tcp: Add a multex lock to start_queue failure case
@ 2021-06-10 8:41 amit.engel
2021-06-15 18:02 ` Sagi Grimberg
0 siblings, 1 reply; 2+ messages in thread
From: amit.engel @ 2021-06-10 8:41 UTC (permalink / raw)
To: linux-nvme, sagi; +Cc: amit.engel
From: Amit Engel <amit.engel@dell.com>
this is in order to serialize nvme_tcp_stop_queue
Signed-off-by: Amit Engel <amit.engel@dell.com>
---
drivers/nvme/host/tcp.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 6a65b0516180..091f861c2067 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -1571,6 +1571,7 @@ static void nvme_tcp_stop_queue(struct nvme_ctrl *nctrl, int qid)
static int nvme_tcp_start_queue(struct nvme_ctrl *nctrl, int idx)
{
struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl);
+ struct nvme_tcp_queue *queue = &ctrl->queues[idx];
int ret;
if (idx)
@@ -1579,10 +1580,12 @@ static int nvme_tcp_start_queue(struct nvme_ctrl *nctrl, int idx)
ret = nvmf_connect_admin_queue(nctrl);
if (!ret) {
- set_bit(NVME_TCP_Q_LIVE, &ctrl->queues[idx].flags);
+ set_bit(NVME_TCP_Q_LIVE, &queue->flags);
} else {
- if (test_bit(NVME_TCP_Q_ALLOCATED, &ctrl->queues[idx].flags))
- __nvme_tcp_stop_queue(&ctrl->queues[idx]);
+ mutex_lock(&queue->queue_lock);
+ if (test_bit(NVME_TCP_Q_ALLOCATED, &queue->flags))
+ __nvme_tcp_stop_queue(queue);
+ mutex_unlock(&queue->queue_lock);
dev_err(nctrl->device,
"failed to connect queue: %d ret=%d\n", idx, ret);
}
--
2.18.2
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] nvmet-tcp: Add a multex lock to start_queue failure case
2021-06-10 8:41 [PATCH] nvmet-tcp: Add a multex lock to start_queue failure case amit.engel
@ 2021-06-15 18:02 ` Sagi Grimberg
0 siblings, 0 replies; 2+ messages in thread
From: Sagi Grimberg @ 2021-06-15 18:02 UTC (permalink / raw)
To: amit.engel, linux-nvme
> From: Amit Engel <amit.engel@dell.com>
>
> this is in order to serialize nvme_tcp_stop_queue
Thinking about this, I don't think this is needed, can you describe
what is the scenario that requires this protection?
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-15 21:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10 8:41 [PATCH] nvmet-tcp: Add a multex lock to start_queue failure case amit.engel
2021-06-15 18:02 ` 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.