nvme: improve probe error handling

The underlying probe might fail, but we don't check its
return code. Right now we ignore the failure and in secondary
process we even continue referencing a locally-unitialized
controller struct. Then, a few calls later, we fail on assert
because current process is not on the ctrlr->active_procs list.

Change-Id: I65a59a9515a8e0196b60a181cee2af33434784dc
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/431486
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Darek Stojaczyk 2018-10-31 10:59:39 +01:00 committed by Jim Harris
parent 7f128c757b
commit 47f2a2337d

View File

@ -518,7 +518,12 @@ spdk_nvme_probe_internal(const struct spdk_nvme_transport_id *trid, void *cb_ctx
nvme_robust_mutex_lock(&g_spdk_nvme_driver->lock);
nvme_transport_ctrlr_scan(trid, cb_ctx, probe_cb, remove_cb, direct_connect);
rc = nvme_transport_ctrlr_scan(trid, cb_ctx, probe_cb, remove_cb, direct_connect);
if (rc != 0) {
SPDK_ERRLOG("NVMe ctrlr scan failed\n");
nvme_robust_mutex_unlock(&g_spdk_nvme_driver->lock);
return -1;
}
/*
* Probe controllers on the shared_attached_ctrlrs list