nvme_ctrlr: Allow resets from failed state
Failed is not a final state for either fabric or pcie controllers. We have historically not allowed resets in the failed state, but we should. Instead of checking for the failed state, we should check for the removed state. If the controller is removed, then we cannot even attempt a reset. Change-Id: I2c1a3d85db84f84cd1895cbfaf16575c8b496155 Signed-off-by: Seth Howell <seth.howell@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471415 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
3e1569e875
commit
81b20a4d96
@ -963,17 +963,18 @@ spdk_nvme_ctrlr_reset(struct spdk_nvme_ctrlr *ctrlr)
|
||||
|
||||
nvme_robust_mutex_lock(&ctrlr->ctrlr_lock);
|
||||
|
||||
if (ctrlr->is_resetting || ctrlr->is_failed) {
|
||||
if (ctrlr->is_resetting || ctrlr->is_removed) {
|
||||
/*
|
||||
* Controller is already resetting or has failed. Return
|
||||
* Controller is already resetting or has been removed. Return
|
||||
* immediately since there is no need to kick off another
|
||||
* reset in these cases.
|
||||
*/
|
||||
nvme_robust_mutex_unlock(&ctrlr->ctrlr_lock);
|
||||
return 0;
|
||||
return ctrlr->is_resetting ? 0 : -ENXIO;
|
||||
}
|
||||
|
||||
ctrlr->is_resetting = true;
|
||||
ctrlr->is_failed = false;
|
||||
|
||||
SPDK_NOTICELOG("resetting controller\n");
|
||||
|
||||
@ -1031,10 +1032,10 @@ spdk_nvme_ctrlr_reset(struct spdk_nvme_ctrlr *ctrlr)
|
||||
}
|
||||
|
||||
out:
|
||||
ctrlr->is_resetting = false;
|
||||
if (rc) {
|
||||
nvme_ctrlr_fail(ctrlr, false);
|
||||
}
|
||||
ctrlr->is_resetting = false;
|
||||
|
||||
nvme_robust_mutex_unlock(&ctrlr->ctrlr_lock);
|
||||
|
||||
|
@ -441,8 +441,10 @@ spdk_nvme_qpair_process_completions(struct spdk_nvme_qpair *qpair, uint32_t max_
|
||||
int32_t i;
|
||||
struct nvme_request *req, *tmp;
|
||||
|
||||
if (qpair->ctrlr->is_failed) {
|
||||
nvme_qpair_abort_reqs(qpair, 1 /* do not retry */);
|
||||
if (spdk_unlikely(qpair->ctrlr->is_failed)) {
|
||||
if (qpair->ctrlr->is_removed) {
|
||||
nvme_qpair_abort_reqs(qpair, 1 /* Do not retry */);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user