nvme: return error if the controller with probe context got errors
Change-Id: I72b2ab93d15a82c20d90e787248248b15bc197c7 Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447021 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
9e37807399
commit
59746336cb
@ -612,12 +612,13 @@ struct spdk_nvme_probe_ctx *spdk_nvme_probe_async(const struct spdk_nvme_transpo
|
||||
*
|
||||
* \param probe_ctx Context used to track probe actions.
|
||||
*
|
||||
* \return true if all probe operations are complete; the probe_ctx
|
||||
* \return 0 if all probe operations are complete; the probe_ctx
|
||||
* is also freed and no longer valid.
|
||||
* \return false if there are still pending probe operations; user must call
|
||||
* spdk_nvme_probe_poll_async again to continue progress.
|
||||
* \return -EAGAIN if there are still pending probe operations; user must call
|
||||
* spdk_nvme_probe_poll_async again to continue progress.
|
||||
* \return value other than 0 and -EAGAIN probe error with one controller.
|
||||
*/
|
||||
bool spdk_nvme_probe_poll_async(struct spdk_nvme_probe_ctx *probe_ctx);
|
||||
int spdk_nvme_probe_poll_async(struct spdk_nvme_probe_ctx *probe_ctx);
|
||||
|
||||
/**
|
||||
* Detach specified device returned by spdk_nvme_probe()'s attach_cb from the
|
||||
|
@ -1092,28 +1092,34 @@ spdk_nvme_probe_async(const struct spdk_nvme_transport_id *trid,
|
||||
return probe_ctx;
|
||||
}
|
||||
|
||||
bool
|
||||
int
|
||||
spdk_nvme_probe_poll_async(struct spdk_nvme_probe_ctx *probe_ctx)
|
||||
{
|
||||
int rc = 0;
|
||||
struct spdk_nvme_ctrlr *ctrlr, *ctrlr_tmp;
|
||||
|
||||
if (!spdk_process_is_primary() && probe_ctx->trid.trtype == SPDK_NVME_TRANSPORT_PCIE) {
|
||||
free(probe_ctx);
|
||||
return true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
TAILQ_FOREACH_SAFE(ctrlr, &probe_ctx->init_ctrlrs, tailq, ctrlr_tmp) {
|
||||
nvme_ctrlr_poll_internal(ctrlr, probe_ctx);
|
||||
rc = nvme_ctrlr_poll_internal(ctrlr, probe_ctx);
|
||||
if (rc != 0) {
|
||||
rc = -EIO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (TAILQ_EMPTY(&probe_ctx->init_ctrlrs)) {
|
||||
if (rc != 0 || TAILQ_EMPTY(&probe_ctx->init_ctrlrs)) {
|
||||
nvme_robust_mutex_lock(&g_spdk_nvme_driver->lock);
|
||||
g_spdk_nvme_driver->initialized = true;
|
||||
nvme_robust_mutex_unlock(&g_spdk_nvme_driver->lock);
|
||||
free(probe_ctx);
|
||||
return true;
|
||||
return rc;
|
||||
}
|
||||
return false;
|
||||
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
SPDK_LOG_REGISTER_COMPONENT("nvme", SPDK_LOG_NVME)
|
||||
|
Loading…
Reference in New Issue
Block a user