nvme: don't loop MMIO reads if the controller is already in failed state

This may happen when resetting a controller, if the ADMIN queue failed
to reconnect, the controller is set to failed state, so for this case
we don't need to loop until timeout, just exit.

Change-Id: I2b37af5453086cd64f3609c41eb8f6475da55fd4
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4143
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: JinYu <jin.yu@intel.com>
This commit is contained in:
Changpeng Liu 2020-09-10 10:27:45 +08:00 committed by Tomasz Zawadzki
parent 8387e97f90
commit fd5e781afc

View File

@ -2526,11 +2526,11 @@ nvme_ctrlr_process_init(struct spdk_nvme_ctrlr *ctrlr)
if (nvme_ctrlr_get_cc(ctrlr, &cc) ||
nvme_ctrlr_get_csts(ctrlr, &csts)) {
if (ctrlr->state_timeout_tsc != NVME_TIMEOUT_INFINITE) {
if (!ctrlr->is_failed && ctrlr->state_timeout_tsc != NVME_TIMEOUT_INFINITE) {
/* While a device is resetting, it may be unable to service MMIO reads
* temporarily. Allow for this case.
*/
SPDK_ERRLOG("Get registers failed while waiting for CSTS.RDY == 0\n");
SPDK_DEBUGLOG(SPDK_LOG_NVME, "Get registers failed while waiting for CSTS.RDY == 0\n");
goto init_timeout;
}
SPDK_ERRLOG("Failed to read CC and CSTS in state %d\n", ctrlr->state);