From 0891f506fcd84346ba747720202b33b61b09857d Mon Sep 17 00:00:00 2001 From: Lance Hartmann Date: Tue, 27 Nov 2018 14:00:17 -0500 Subject: [PATCH] nvme: Silently ignore ns key in transport id string spdk_nvme_transport_id_parse() does not recognize the namespace id, "ns", key as part of the transport id string and thus logs an error message, but does not fail the call. However, some SPDK applications, e.g. nvme/perf, in addition to using spdk_nvme_transport_id_parse() also check for the existence of a "ns" key in the transport id string to limit the target to a specific namespace. This commit adds a special case to spdk_nvme_transport_id_parse() to silently ignore the presence of a "ns" key without logging it as an error. Change-Id: I49732b4d1b0227a38bb308eab1f6324dd241a2de Signed-off-by: Lance Hartmann Reviewed-on: https://review.gerrithub.io/435192 Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Darek Stojaczyk Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- lib/nvme/nvme.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/nvme/nvme.c b/lib/nvme/nvme.c index 9479975ec..2641062c3 100644 --- a/lib/nvme/nvme.c +++ b/lib/nvme/nvme.c @@ -811,6 +811,18 @@ spdk_nvme_transport_id_parse(struct spdk_nvme_transport_id *trid, const char *st return -EINVAL; } memcpy(trid->subnqn, val, val_len + 1); + } else if (strcasecmp(key, "ns") == 0) { + /* + * Special case. The namespace id parameter may + * optionally be passed in the transport id string + * for an SPDK application (e.g. nvme/perf) + * and additionally parsed therein to limit + * targeting a specific namespace. For this + * scenario, just silently ignore this key + * rather than letting it default to logging + * it as an invalid key. + */ + continue; } else { SPDK_ERRLOG("Unknown transport ID key '%s'\n", key); }