nvme: don't fail the ctrlr from ctrlr_process_init

If we are to have multiple reconnect attempts, we have to control
whetehr the controller is placed in the failed state from outside the
reset function itself. This will allow us to fail the controller only
after all of our retries are exhausted.

Change-Id: Ia82e10325272f25b2b8527336dc3bc507c93b401
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469932
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
This commit is contained in:
Seth Howell 2019-09-30 11:01:15 -07:00 committed by Jim Harris
parent f5d88e46e2
commit 584a630287
3 changed files with 2 additions and 5 deletions

View File

@ -446,6 +446,7 @@ nvme_ctrlr_poll_internal(struct spdk_nvme_ctrlr *ctrlr,
/* Controller failed to initialize. */
TAILQ_REMOVE(&probe_ctx->init_ctrlrs, ctrlr, tailq);
SPDK_ERRLOG("Failed to initialize SSD: %s\n", ctrlr->trid.traddr);
nvme_ctrlr_fail(ctrlr, false);
nvme_ctrlr_destruct(ctrlr);
return rc;
}

View File

@ -2114,7 +2114,6 @@ nvme_ctrlr_process_init(struct spdk_nvme_ctrlr *ctrlr)
goto init_timeout;
}
SPDK_ERRLOG("Failed to read CC and CSTS in state %d\n", ctrlr->state);
nvme_ctrlr_fail(ctrlr, false);
return -EIO;
}
@ -2161,7 +2160,6 @@ nvme_ctrlr_process_init(struct spdk_nvme_ctrlr *ctrlr)
cc.bits.en = 0;
if (nvme_ctrlr_set_cc(ctrlr, &cc)) {
SPDK_ERRLOG("set_cc() failed\n");
nvme_ctrlr_fail(ctrlr, false);
return -EIO;
}
nvme_ctrlr_set_state(ctrlr, NVME_CTRLR_STATE_DISABLE_WAIT_FOR_READY_0, ready_timeout_in_ms);
@ -2193,7 +2191,6 @@ nvme_ctrlr_process_init(struct spdk_nvme_ctrlr *ctrlr)
cc.bits.en = 0;
if (nvme_ctrlr_set_cc(ctrlr, &cc)) {
SPDK_ERRLOG("set_cc() failed\n");
nvme_ctrlr_fail(ctrlr, false);
return -EIO;
}
nvme_ctrlr_set_state(ctrlr, NVME_CTRLR_STATE_DISABLE_WAIT_FOR_READY_0, ready_timeout_in_ms);
@ -2348,7 +2345,6 @@ nvme_ctrlr_process_init(struct spdk_nvme_ctrlr *ctrlr)
default:
assert(0);
nvme_ctrlr_fail(ctrlr, false);
return -1;
}
@ -2356,7 +2352,6 @@ init_timeout:
if (ctrlr->state_timeout_tsc != NVME_TIMEOUT_INFINITE &&
spdk_get_ticks() > ctrlr->state_timeout_tsc) {
SPDK_ERRLOG("Initialization timed out in state %d\n", ctrlr->state);
nvme_ctrlr_fail(ctrlr, false);
return -1;
}

View File

@ -43,6 +43,7 @@
DEFINE_STUB_V(nvme_ctrlr_proc_get_ref, (struct spdk_nvme_ctrlr *ctrlr));
DEFINE_STUB_V(nvme_ctrlr_proc_put_ref, (struct spdk_nvme_ctrlr *ctrlr));
DEFINE_STUB_V(nvme_ctrlr_fail, (struct spdk_nvme_ctrlr *ctrlr, bool hotremove));
DEFINE_STUB(spdk_nvme_transport_available, bool,
(enum spdk_nvme_transport_type trtype), true);
/* return anything non-NULL, this won't be deferenced anywhere in this test */