examples/abort: check process_completions()'s status
The abort app expects some requests to be failed (because they're aborted), so a failed I/O doesn't cause the app to exit with a failed status. However, the qpairs should never be disconnected during the test, so we should check their status to avoid hiding errors when that happens. Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: I100cda8656ad748983695a434721424db84ea260 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16647 Reviewed-by: Michal Berger <michal.berger@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
parent
924a61bfa6
commit
13d3123115
@ -423,6 +423,7 @@ work_fn(void *arg)
|
||||
struct spdk_nvme_io_qpair_opts opts;
|
||||
uint64_t tsc_end;
|
||||
uint32_t unfinished_ctx;
|
||||
int rc = 0;
|
||||
|
||||
/* Allocate queue pair for each namespace. */
|
||||
TAILQ_FOREACH(ns_ctx, &worker->ns_ctx, link) {
|
||||
@ -450,15 +451,27 @@ work_fn(void *arg)
|
||||
|
||||
while (1) {
|
||||
TAILQ_FOREACH(ns_ctx, &worker->ns_ctx, link) {
|
||||
spdk_nvme_qpair_process_completions(ns_ctx->qpair, 0);
|
||||
rc = spdk_nvme_qpair_process_completions(ns_ctx->qpair, 0);
|
||||
if (rc < 0) {
|
||||
fprintf(stderr, "spdk_nvme_qpair_process_completions returned "
|
||||
"%d\n", rc);
|
||||
worker->status = rc;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (worker->lcore == g_main_core) {
|
||||
TAILQ_FOREACH(ctrlr_ctx, &worker->ctrlr_ctx, link) {
|
||||
/* Hold mutex to guard ctrlr_ctx->current_queue_depth. */
|
||||
pthread_mutex_lock(&ctrlr_ctx->mutex);
|
||||
spdk_nvme_ctrlr_process_admin_completions(ctrlr_ctx->ctrlr);
|
||||
rc = spdk_nvme_ctrlr_process_admin_completions(ctrlr_ctx->ctrlr);
|
||||
pthread_mutex_unlock(&ctrlr_ctx->mutex);
|
||||
if (rc < 0) {
|
||||
fprintf(stderr, "spdk_nvme_ctrlr_process_admin_completions "
|
||||
"returned %d\n", rc);
|
||||
worker->status = rc;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -475,7 +488,13 @@ work_fn(void *arg)
|
||||
ns_ctx->is_draining = true;
|
||||
}
|
||||
if (ns_ctx->current_queue_depth > 0) {
|
||||
spdk_nvme_qpair_process_completions(ns_ctx->qpair, 0);
|
||||
rc = spdk_nvme_qpair_process_completions(ns_ctx->qpair, 0);
|
||||
if (rc < 0) {
|
||||
fprintf(stderr, "spdk_nvme_qpair_process_completions "
|
||||
"returned %d\n", rc);
|
||||
worker->status = rc;
|
||||
goto out;
|
||||
}
|
||||
unfinished_ctx++;
|
||||
}
|
||||
}
|
||||
@ -488,15 +507,23 @@ work_fn(void *arg)
|
||||
TAILQ_FOREACH(ctrlr_ctx, &worker->ctrlr_ctx, link) {
|
||||
pthread_mutex_lock(&ctrlr_ctx->mutex);
|
||||
if (ctrlr_ctx->current_queue_depth > 0) {
|
||||
spdk_nvme_ctrlr_process_admin_completions(ctrlr_ctx->ctrlr);
|
||||
rc = spdk_nvme_ctrlr_process_admin_completions(ctrlr_ctx->ctrlr);
|
||||
unfinished_ctx++;
|
||||
}
|
||||
pthread_mutex_unlock(&ctrlr_ctx->mutex);
|
||||
if (rc < 0) {
|
||||
fprintf(stderr, "spdk_nvme_ctrlr_process_admin_completions "
|
||||
"returned %d\n", rc);
|
||||
worker->status = rc;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
} while (unfinished_ctx > 0);
|
||||
}
|
||||
out:
|
||||
TAILQ_FOREACH(ns_ctx, &worker->ns_ctx, link) {
|
||||
/* Make sure we don't submit any IOs at this point */
|
||||
ns_ctx->is_draining = true;
|
||||
spdk_nvme_ctrlr_free_io_qpair(ns_ctx->qpair);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user