lib/nvme: Attach ctrlr to second process with condition.

If user specify a trid, we should not attach other ctrlrs

Change-Id: I73a4278c1d7551908feb56d01a1c41c0d049bb91
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/377653
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ziye Yang 2017-09-08 15:51:41 +08:00 committed by Jim Harris
parent d8cdbb8931
commit 06988b1f2b

View File

@ -428,6 +428,12 @@ spdk_nvme_probe(const struct spdk_nvme_transport_id *trid, void *cb_ctx,
*/
if (!spdk_process_is_primary() && (trid->trtype == SPDK_NVME_TRANSPORT_PCIE)) {
TAILQ_FOREACH(ctrlr, &g_spdk_nvme_driver->attached_ctrlrs, tailq) {
/* Do not attach other ctrlrs if user specify a valid trid */
if ((strlen(trid->traddr) != 0) &&
(spdk_nvme_transport_id_compare(trid, &ctrlr->trid))) {
continue;
}
nvme_ctrlr_proc_get_ref(ctrlr);
/*