From d390808fd395bac095040f65170075ef59874340 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Tue, 26 Jan 2021 06:21:01 +0000 Subject: [PATCH] nvme_perf: stop sending I/O to hot removed namespaces It may be an interesting test case to send I/O to hot removed namespaces, but for a perf tool it seems better to stop sending them once we get an INVALID_NAMESPACE status code. Signed-off-by: Jim Harris Change-Id: Ie458fa63b12114cf05d5a3f1702e37f91d8a00f6 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6091 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Tomasz Zawadzki --- examples/nvme/perf/perf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/nvme/perf/perf.c b/examples/nvme/perf/perf.c index bc8dbb26f..b3663449a 100644 --- a/examples/nvme/perf/perf.c +++ b/examples/nvme/perf/perf.c @@ -1346,6 +1346,11 @@ io_complete(void *ctx, const struct spdk_nvme_cpl *cpl) RATELIMIT_LOG("Write completed with error (sct=%d, sc=%d)\n", cpl->status.sct, cpl->status.sc); } + if (cpl->status.sct == SPDK_NVME_SCT_GENERIC && + cpl->status.sc == SPDK_NVME_SC_INVALID_NAMESPACE_OR_FORMAT) { + /* The namespace was hotplugged. Stop trying to send I/O to it. */ + task->ns_ctx->is_draining = true; + } } task_complete(task);