Revert "nvme: call the remove_cb in nvme_ctrlr_fail."
This reverts commit bc4e31d6b2
.
This change was accidentally merged after it was decided to go with a
different architecture.
Change-Id: Ifc9d8b08bd1fcbc4ace8dd6fb4bd0014330916ed
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471144
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
2cb14abc95
commit
85d9f0a9ab
@ -585,8 +585,6 @@ nvme_ctrlr_set_supported_features(struct spdk_nvme_ctrlr *ctrlr)
|
|||||||
void
|
void
|
||||||
nvme_ctrlr_fail(struct spdk_nvme_ctrlr *ctrlr, bool hot_remove)
|
nvme_ctrlr_fail(struct spdk_nvme_ctrlr *ctrlr, bool hot_remove)
|
||||||
{
|
{
|
||||||
int had_lock;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the flag here and leave the work failure of qpairs to
|
* Set the flag here and leave the work failure of qpairs to
|
||||||
* spdk_nvme_qpair_process_completions().
|
* spdk_nvme_qpair_process_completions().
|
||||||
@ -594,36 +592,8 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Return if we have already set the state to failed since we
|
|
||||||
* don't want to call the disconnect callback twice.
|
|
||||||
*/
|
|
||||||
if (ctrlr->is_failed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ctrlr->is_failed = true;
|
ctrlr->is_failed = true;
|
||||||
SPDK_ERRLOG("ctrlr %s in failed state.\n", ctrlr->trid.traddr);
|
SPDK_ERRLOG("ctrlr %s in failed state.\n", ctrlr->trid.traddr);
|
||||||
|
|
||||||
if (ctrlr->remove_cb == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* In the pcie hotplug case, this function may be called with the
|
|
||||||
* global driver lock. In that case, we want to make sure that we
|
|
||||||
* release it before calling the remove callback and restore the
|
|
||||||
* old state afterwards.
|
|
||||||
* robust locks return EPERM if we try to unlock a lock we
|
|
||||||
* aren't holding.
|
|
||||||
*/
|
|
||||||
had_lock = (nvme_robust_mutex_unlock(&g_spdk_nvme_driver->lock) == 0);
|
|
||||||
|
|
||||||
ctrlr->remove_cb(ctrlr->cb_ctx, ctrlr);
|
|
||||||
|
|
||||||
if (had_lock) {
|
|
||||||
nvme_robust_mutex_lock(&g_spdk_nvme_driver->lock);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -296,8 +296,14 @@ _nvme_pcie_hotplug_monitor(struct spdk_nvme_probe_ctx *probe_ctx)
|
|||||||
SPDK_DEBUGLOG(SPDK_LOG_NVME, "remove nvme address: %s\n",
|
SPDK_DEBUGLOG(SPDK_LOG_NVME, "remove nvme address: %s\n",
|
||||||
event.traddr);
|
event.traddr);
|
||||||
|
|
||||||
/* get the user app to clean up and stop I/O. */
|
|
||||||
nvme_ctrlr_fail(ctrlr, true);
|
nvme_ctrlr_fail(ctrlr, true);
|
||||||
|
|
||||||
|
/* get the user app to clean up and stop I/O */
|
||||||
|
if (ctrlr->remove_cb) {
|
||||||
|
nvme_robust_mutex_unlock(&g_spdk_nvme_driver->lock);
|
||||||
|
ctrlr->remove_cb(probe_ctx->cb_ctx, ctrlr);
|
||||||
|
nvme_robust_mutex_lock(&g_spdk_nvme_driver->lock);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -325,6 +331,11 @@ _nvme_pcie_hotplug_monitor(struct spdk_nvme_probe_ctx *probe_ctx)
|
|||||||
|
|
||||||
if (do_remove) {
|
if (do_remove) {
|
||||||
nvme_ctrlr_fail(ctrlr, true);
|
nvme_ctrlr_fail(ctrlr, true);
|
||||||
|
if (ctrlr->remove_cb) {
|
||||||
|
nvme_robust_mutex_unlock(&g_spdk_nvme_driver->lock);
|
||||||
|
ctrlr->remove_cb(probe_ctx->cb_ctx, ctrlr);
|
||||||
|
nvme_robust_mutex_lock(&g_spdk_nvme_driver->lock);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user