From 6915ad7c34dfb1a9669225b964be776178d6d4f4 Mon Sep 17 00:00:00 2001 From: Niklas Cassel Date: Thu, 22 Oct 2020 09:22:30 +0000 Subject: [PATCH] examples/nvme/hello_world: call exit() on read error The printout in read_complete() says "Read I/O failed, aborting run", however, execution still continues, and prints and prints the buffer where the result was supposed to be stored. Since we got a read error, we will not have gotten any data stored in the buffer, so it is simply confusing to print it. Calling exit() in the read_complete() error handling code code also makes it consistent with the error handling code in write_complete() and reset_zone_complete(). Signed-off-by: Niklas Cassel Change-Id: I6e542758c57efc376f921857c2cdb24e252d49c6 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4837 Tested-by: SPDK CI Jenkins Reviewed-by: Paul Luse Reviewed-by: Jim Harris Reviewed-by: Aleksey Marchuk --- examples/nvme/hello_world/hello_world.c | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/nvme/hello_world/hello_world.c b/examples/nvme/hello_world/hello_world.c index cfd440656..affb93aee 100644 --- a/examples/nvme/hello_world/hello_world.c +++ b/examples/nvme/hello_world/hello_world.c @@ -102,6 +102,7 @@ read_complete(void *arg, const struct spdk_nvme_cpl *completion) fprintf(stderr, "I/O error status: %s\n", spdk_nvme_cpl_get_status_string(&completion->status)); fprintf(stderr, "Read I/O failed, aborting run\n"); sequence->is_completed = 2; + exit(1); } /*