From 06988b1f2bbe102ca454c968e4267a1248b54057 Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Fri, 8 Sep 2017 15:51:41 +0800 Subject: [PATCH] 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 Reviewed-on: https://review.gerrithub.io/377653 Tested-by: SPDK Automated Test System Reviewed-by: Changpeng Liu Reviewed-by: Daniel Verkamp Reviewed-by: Jim Harris --- lib/nvme/nvme.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/nvme/nvme.c b/lib/nvme/nvme.c index c4f9fac63..d09999fb9 100644 --- a/lib/nvme/nvme.c +++ b/lib/nvme/nvme.c @@ -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); /*