diff options
author | Jianchao Wang <jianchao.w.wang@oracle.com> | 2018-01-22 09:03:16 -0500 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-01-26 02:12:04 -0500 |
commit | ad70062cdb4002c74db4fbed4e2b34daffccacc2 (patch) | |
tree | f0e7997996e3861e4673e94dbc81fce2c442e0a8 | |
parent | 1dad3a67fbb03d88c68ca20a4f89296e50600710 (diff) |
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: James Smart <james.smart@broadcom.com>
Reviewed-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Reviewed-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r-- | drivers/nvme/host/core.c | 2 | ||||
-rw-r--r-- | drivers/nvme/host/pci.c | 19 |
2 files changed, 18 insertions, 3 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index fde6fd2e7eef..63c2c469112d 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c | |||
@@ -260,7 +260,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, | |||
260 | switch (new_state) { | 260 | switch (new_state) { |
261 | case NVME_CTRL_ADMIN_ONLY: | 261 | case NVME_CTRL_ADMIN_ONLY: |
262 | switch (old_state) { | 262 | switch (old_state) { |
263 | case NVME_CTRL_RESETTING: | 263 | case NVME_CTRL_RECONNECTING: |
264 | changed = true; | 264 | changed = true; |
265 | /* FALLTHRU */ | 265 | /* FALLTHRU */ |
266 | default: | 266 | default: |
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index e2342d365d3c..0bc6a9e48c8e 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c | |||
@@ -1140,9 +1140,14 @@ static bool nvme_should_reset(struct nvme_dev *dev, u32 csts) | |||
1140 | */ | 1140 | */ |
1141 | bool nssro = dev->subsystem && (csts & NVME_CSTS_NSSRO); | 1141 | bool nssro = dev->subsystem && (csts & NVME_CSTS_NSSRO); |
1142 | 1142 | ||
1143 | /* If there is a reset ongoing, we shouldn't reset again. */ | 1143 | /* If there is a reset/reinit ongoing, we shouldn't reset again. */ |
1144 | if (dev->ctrl.state == NVME_CTRL_RESETTING) | 1144 | switch (dev->ctrl.state) { |
1145 | case NVME_CTRL_RESETTING: | ||
1146 | case NVME_CTRL_RECONNECTING: | ||
1145 | return false; | 1147 | return false; |
1148 | default: | ||
1149 | break; | ||
1150 | } | ||
1146 | 1151 | ||
1147 | /* We shouldn't reset unless the controller is on fatal error state | 1152 | /* We shouldn't reset unless the controller is on fatal error state |
1148 | * _or_ if we lost the communication with it. | 1153 | * _or_ if we lost the communication with it. |
@@ -2284,6 +2289,16 @@ static void nvme_reset_work(struct work_struct *work) | |||
2284 | if (dev->ctrl.ctrl_config & NVME_CC_ENABLE) | 2289 | if (dev->ctrl.ctrl_config & NVME_CC_ENABLE) |
2285 | nvme_dev_disable(dev, false); | 2290 | nvme_dev_disable(dev, false); |
2286 | 2291 | ||
2292 | /* | ||
2293 | * Introduce RECONNECTING state from nvme-fc/rdma transports to mark the | ||
2294 | * initializing procedure here. | ||
2295 | */ | ||
2296 | if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RECONNECTING)) { | ||
2297 | dev_warn(dev->ctrl.device, | ||
2298 | "failed to mark controller RECONNECTING\n"); | ||
2299 | goto out; | ||
2300 | } | ||
2301 | |||
2287 | result = nvme_pci_enable(dev); | 2302 | result = nvme_pci_enable(dev); |
2288 | if (result) | 2303 | if (result) |
2289 | goto out; | 2304 | goto out; |