Commit ad70062c authored by Jianchao Wang's avatar Jianchao Wang Committed by Christoph Hellwig

nvme-pci: introduce RECONNECTING state to mark initializing procedure

After Sagi's commit (nvme-rdma: fix concurrent reset and reconnect),
both nvme-fc/rdma have following pattern:
RESETTING    - quiesce blk-mq queues, teardown and delete queues/
               connections, clear out outstanding IO requests...
RECONNECTING - establish new queues/connections and some other
               initializing things.
Introduce RECONNECTING to nvme-pci transport to do the same mark.
Then we get a coherent state definition among nvme pci/rdma/fc
transports.
Suggested-by: default avatarJames Smart <james.smart@broadcom.com>
Reviewed-by: default avatarJames Smart <james.smart@broadcom.com>
Reviewed-by: default avatarReviewed-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: default avatarJianchao Wang <jianchao.w.wang@oracle.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 1dad3a67
...@@ -260,7 +260,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, ...@@ -260,7 +260,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
switch (new_state) { switch (new_state) {
case NVME_CTRL_ADMIN_ONLY: case NVME_CTRL_ADMIN_ONLY:
switch (old_state) { switch (old_state) {
case NVME_CTRL_RESETTING: case NVME_CTRL_RECONNECTING:
changed = true; changed = true;
/* FALLTHRU */ /* FALLTHRU */
default: default:
......
...@@ -1140,9 +1140,14 @@ static bool nvme_should_reset(struct nvme_dev *dev, u32 csts) ...@@ -1140,9 +1140,14 @@ static bool nvme_should_reset(struct nvme_dev *dev, u32 csts)
*/ */
bool nssro = dev->subsystem && (csts & NVME_CSTS_NSSRO); bool nssro = dev->subsystem && (csts & NVME_CSTS_NSSRO);
/* If there is a reset ongoing, we shouldn't reset again. */ /* If there is a reset/reinit ongoing, we shouldn't reset again. */
if (dev->ctrl.state == NVME_CTRL_RESETTING) switch (dev->ctrl.state) {
case NVME_CTRL_RESETTING:
case NVME_CTRL_RECONNECTING:
return false; return false;
default:
break;
}
/* We shouldn't reset unless the controller is on fatal error state /* We shouldn't reset unless the controller is on fatal error state
* _or_ if we lost the communication with it. * _or_ if we lost the communication with it.
...@@ -2284,6 +2289,16 @@ static void nvme_reset_work(struct work_struct *work) ...@@ -2284,6 +2289,16 @@ static void nvme_reset_work(struct work_struct *work)
if (dev->ctrl.ctrl_config & NVME_CC_ENABLE) if (dev->ctrl.ctrl_config & NVME_CC_ENABLE)
nvme_dev_disable(dev, false); nvme_dev_disable(dev, false);
/*
* Introduce RECONNECTING state from nvme-fc/rdma transports to mark the
* initializing procedure here.
*/
if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RECONNECTING)) {
dev_warn(dev->ctrl.device,
"failed to mark controller RECONNECTING\n");
goto out;
}
result = nvme_pci_enable(dev); result = nvme_pci_enable(dev);
if (result) if (result)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment