OSDN Git Service

nvme-rdma: use NVME_CTRL_CONNECTING state to mark init process
authorMax Gurtovoy <maxg@mellanox.com>
Wed, 31 Jan 2018 16:31:25 +0000 (18:31 +0200)
committerSagi Grimberg <sagi@grimberg.me>
Thu, 8 Feb 2018 16:35:53 +0000 (18:35 +0200)
In order to avoid concurrent error recovery during initialization
process (allowed by the NVME_CTRL_NEW --> NVME_CTRL_RESETTING transition)
we must mark the ctrl as CONNECTING before initial connection
establisment.

Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
drivers/nvme/host/core.c
drivers/nvme/host/rdma.c

index 1033de4..86dca29 100644 (file)
@@ -296,6 +296,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
                break;
        case NVME_CTRL_CONNECTING:
                switch (old_state) {
+               case NVME_CTRL_NEW:
                case NVME_CTRL_LIVE:
                case NVME_CTRL_RESETTING:
                        changed = true;
index 050eaa2..5e2cc4f 100644 (file)
@@ -1942,6 +1942,9 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev,
        if (!ctrl->queues)
                goto out_uninit_ctrl;
 
+       changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING);
+       WARN_ON_ONCE(!changed);
+
        ret = nvme_rdma_configure_admin_queue(ctrl, true);
        if (ret)
                goto out_kfree_queues;