From be299bf533fdca8c1760204eb2b35faf2ff8e996 Mon Sep 17 00:00:00 2001 From: buzagg Date: Sun, 22 Jan 2023 16:14:20 +0200 Subject: [PATCH] bdev_nvme: Support multipath across all discovery contexts. This is required when volume is attached via different storage boxes for example while migrating it. Signed-off-by: Gili Buzaglo Change-Id: I680c781ae5de078972d6aef547804d60fff3c643 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16407 Reviewed-by: Jim Harris Reviewed-by: Aleksey Marchuk Tested-by: SPDK CI Jenkins --- module/bdev/nvme/bdev_nvme.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/module/bdev/nvme/bdev_nvme.c b/module/bdev/nvme/bdev_nvme.c index 7e9ae6070..468c58c66 100644 --- a/module/bdev/nvme/bdev_nvme.c +++ b/module/bdev/nvme/bdev_nvme.c @@ -5696,11 +5696,17 @@ discovery_log_page_cb(void *cb_arg, int rc, const struct spdk_nvme_cpl *cpl, } } if (!found) { - struct discovery_entry_ctx *subnqn_ctx, *new_ctx; + struct discovery_entry_ctx *subnqn_ctx = NULL, *new_ctx; + struct discovery_ctx *d_ctx; - TAILQ_FOREACH(subnqn_ctx, &ctx->nvm_entry_ctxs, tailq) { - if (!memcmp(subnqn_ctx->entry.subnqn, new_entry->subnqn, - sizeof(new_entry->subnqn))) { + TAILQ_FOREACH(d_ctx, &g_discovery_ctxs, tailq) { + TAILQ_FOREACH(subnqn_ctx, &d_ctx->nvm_entry_ctxs, tailq) { + if (!memcmp(subnqn_ctx->entry.subnqn, new_entry->subnqn, + sizeof(new_entry->subnqn))) { + break; + } + } + if (subnqn_ctx) { break; } }