Commit 616f6844 authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Tomasz Zawadzki
Browse files

perf: report error on IO error or qpair disconnection



This makes sure the app returns a non-zero exit code when an IO error
occurs or a qpair gets disconnected.  It's especially important when
perf is run as part of a test suite.

Signed-off-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I1d1a2e8e5f624fe43892aadc5e1ca179f80a8b40
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/19054


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <jim.harris@gmail.com>
parent 3e41b535
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -942,7 +942,10 @@ nvme_submit_io(struct perf_task *task, struct ns_worker_ctx *ns_ctx,
static void
perf_disconnect_cb(struct spdk_nvme_qpair *qpair, void *ctx)
{
	struct ns_worker_ctx *ns_ctx = ctx;

	ns_ctx->is_draining = true;
	ns_ctx->status = 1;
}

static int64_t
@@ -1015,7 +1018,7 @@ nvme_init_ns_worker_ctx(struct ns_worker_ctx *ns_ctx)
	opts.create_only = true;
	opts.async_mode = true;

	ns_ctx->u.nvme.group = spdk_nvme_poll_group_create(NULL, NULL);
	ns_ctx->u.nvme.group = spdk_nvme_poll_group_create(ns_ctx, NULL);
	if (ns_ctx->u.nvme.group == NULL) {
		goto poll_group_failed;
	}
@@ -1566,12 +1569,15 @@ 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 (!g_continue_on_error &&
		    cpl->status.sct == SPDK_NVME_SCT_GENERIC &&
		if (!g_continue_on_error) {
			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->ns_ctx->status = 1;
		}
	}

	task_complete(task);