lib/nvme: nvme_ctrlr_fail() return immediately if ctrlr is already failed
As log shows 00:06:32.300 [2020-12-18 21:13:35.511014] nvme_ctrlr.c:1414:spdk_nvme_ctrlr_reset: *ERROR*: Controller reinitialization failed. 00:06:32.300 [2020-12-18 21:13:35.511104] nvme_ctrlr.c: 925:nvme_ctrlr_fail: *ERROR*: ctrlr 192.168.100.8 in failed state. 00:06:32.300 [2020-12-18 21:13:35.511132] bdev_nvme.c: 392:_bdev_nvme_reset_complete: *ERROR*: Resetting controller failed. 00:06:32.300 [2020-12-18 21:13:35.511240] nvme_ctrlr.c: 925:nvme_ctrlr_fail: *ERROR*: ctrlr 192.168.100.8 in failed state. 00:06:32.300 [2020-12-18 21:13:35.511511] bdev_nvme.c: 556:bdev_nvme_failover: *NOTICE*: Unable to perform reset, already in progress. if spdk_nvme_ctrlr_reset() failed, nvme_ctrlr_fail() is called, and then if spdk_nvme_ctrlr_process_admin_completions() failed, nvme_ctrlr_fail() is called. We don't know which one comes first but nvme_ctrlr_fail() should do nothing if the ctrlr is already failed. Hence we should avoid setting ctrlr->is_failed and calling nvme_transport_ctrlr_disconnect_qpair() twice. However we should set ctrlr->is_removed if the parameter hot_remove is true. We do these changes in this patch. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: Iac37c892e054fb59d78e69346ca7f0575d596235 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5694 Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
92d2ad357c
commit
974c70e63f
@ -869,6 +869,12 @@ nvme_ctrlr_fail(struct spdk_nvme_ctrlr *ctrlr, bool hot_remove)
|
|||||||
if (hot_remove) {
|
if (hot_remove) {
|
||||||
ctrlr->is_removed = true;
|
ctrlr->is_removed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctrlr->is_failed) {
|
||||||
|
SPDK_NOTICELOG("ctrlr %s is already in failed state\n", ctrlr->trid.traddr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ctrlr->is_failed = true;
|
ctrlr->is_failed = true;
|
||||||
nvme_transport_ctrlr_disconnect_qpair(ctrlr, ctrlr->adminq);
|
nvme_transport_ctrlr_disconnect_qpair(ctrlr, ctrlr->adminq);
|
||||||
SPDK_ERRLOG("ctrlr %s in failed state.\n", ctrlr->trid.traddr);
|
SPDK_ERRLOG("ctrlr %s in failed state.\n", ctrlr->trid.traddr);
|
||||||
|
Loading…
Reference in New Issue
Block a user