Commit fde1276b authored by Tomasz Zawadzki's avatar Tomasz Zawadzki
Browse files

example/perf: remove exit() on polling errors



Fixes #3158

Whenever there is error on polling certain backend,
exit is called immediately. Resulting in memory leaks
for quite a lot of structures allocated by the application.

Instead allow for more graceful failure by indicating
failed status.

Signed-off-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: If4042066e0bcae98233a5c899ac01b8000c39be5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/20727


Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 400df299
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -501,6 +501,7 @@ uring_check_io(struct ns_worker_ctx *ns_ctx)
		 * It will automatically call spdk_io_uring_enter appropriately. */
		ret = io_uring_submit(&ns_ctx->u.uring.ring);
		if (ret < 0) {
			ns_ctx->status = 1;
			return -1;
		}
		ns_ctx->u.uring.io_pending = 0;
@@ -517,7 +518,8 @@ uring_check_io(struct ns_worker_ctx *ns_ctx)
			if (ns_ctx->u.uring.cqes[i]->res != (int)task->iovs[0].iov_len) {
				fprintf(stderr, "cqe->status=%d, iov_len=%d\n", ns_ctx->u.uring.cqes[i]->res,
					(int)task->iovs[0].iov_len);
				exit(1);
				ns_ctx->status = 1;
				return -1;
			}
			io_uring_cqe_seen(&ns_ctx->u.uring.ring, ns_ctx->u.uring.cqes[i]);
			task_complete(task);
@@ -636,7 +638,8 @@ aio_check_io(struct ns_worker_ctx *ns_ctx)
	count = io_getevents(ns_ctx->u.aio.ctx, 1, g_queue_depth, ns_ctx->u.aio.events, &timeout);
	if (count < 0) {
		fprintf(stderr, "io_getevents error\n");
		exit(1);
		ns_ctx->status = 1;
		return -1;
	}

	for (i = 0; i < count; i++) {
@@ -644,7 +647,8 @@ aio_check_io(struct ns_worker_ctx *ns_ctx)
		if (ns_ctx->u.aio.events[i].res != (uint64_t)task->iovs[0].iov_len) {
			fprintf(stderr, "event->res=%lu, iov_len=%lu\n", ns_ctx->u.aio.events[i].res,
				(uint64_t)task->iovs[0].iov_len);
			exit(1);
			ns_ctx->status = 1;
			return -1;
		}
		task_complete(ns_ctx->u.aio.events[i].data);
	}
@@ -957,7 +961,8 @@ nvme_check_io(struct ns_worker_ctx *ns_ctx)
			perf_disconnect_cb);
	if (rc < 0) {
		fprintf(stderr, "NVMe io qpair process completion error\n");
		exit(1);
		ns_ctx->status = 1;
		return -1;
	}
	return rc;
}