From b33e68a78975062bdb8879a5fd2dcba00dd40c5e Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Fri, 3 Dec 2021 22:57:04 +0000 Subject: [PATCH] nvme: call probe_cb when directly connecting to discovery ctrlr The host may have specified a hostnqn to use to connect to a discovery ctrlr, so we can't just use the default ctrlr opts to connect - we need to call the probe_cb (if there is one) to get any options that the host may have specified. Tested by using discovery_aer tool, creating a subsystem and listener, and then adding a host on the target side that matches the hostnqn specified to the discovery_aer tool. Signed-off-by: Jim Harris Change-Id: I07266e984e0094d3a768e6a0d5ea3a3bd71e32ba Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10547 Community-CI: Mellanox Build Bot Reviewed-by: Aleksey Marchuk Reviewed-by: Changpeng Liu Tested-by: SPDK CI Jenkins --- lib/nvme/nvme_fabric.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/nvme/nvme_fabric.c b/lib/nvme/nvme_fabric.c index eae5087c20..8bc1792a15 100644 --- a/lib/nvme/nvme_fabric.c +++ b/lib/nvme/nvme_fabric.c @@ -417,6 +417,9 @@ nvme_fabric_ctrlr_scan(struct spdk_nvme_probe_ctx *probe_ctx, } spdk_nvme_ctrlr_get_default_ctrlr_opts(&discovery_opts, sizeof(discovery_opts)); + if (direct_connect && probe_ctx->probe_cb) { + probe_ctx->probe_cb(probe_ctx->cb_ctx, &probe_ctx->trid, &discovery_opts); + } discovery_ctrlr = nvme_transport_ctrlr_construct(&probe_ctx->trid, &discovery_opts, NULL); if (discovery_ctrlr == NULL) {