[PATCH] nvmet-tcp: Add a multex lock to start_queue failure case
amit.engel at dell.com
amit.engel at dell.com
Thu Jun 10 01:41:12 PDT 2021
From: Amit Engel <amit.engel at dell.com>
this is in order to serialize nvme_tcp_stop_queue
Signed-off-by: Amit Engel <amit.engel at 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
More information about the Linux-nvme
mailing list