From d804492f025567e3528980e137546f1b8ee36c82 Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Tue, 17 Oct 2017 03:06:26 -0400 Subject: [PATCH] vhost: exit the vhost app for error configuration Change-Id: I56cc1df278a35bf40f3bb67d25af6dc3658aac82 Signed-off-by: Changpeng Liu Reviewed-on: https://review.gerrithub.io/382770 Reviewed-by: Dariusz Stojaczyk Tested-by: SPDK Automated Test System Reviewed-by: Jim Harris Reviewed-by: Ben Walker Reviewed-by: Pawel Wodkowski Reviewed-by: Daniel Verkamp --- lib/vhost/vhost.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index e29a642dc..c34758e22 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -947,7 +947,7 @@ spdk_vhost_startup(void *arg1, void *arg2) ret = snprintf(dev_dirname, sizeof(dev_dirname) - 2, "%s", basename); if ((size_t)ret >= sizeof(dev_dirname) - 2) { SPDK_ERRLOG("Char dev dir path length %d is too long\n", ret); - abort(); + goto out; } if (dev_dirname[ret - 1] != '/') { @@ -959,14 +959,19 @@ spdk_vhost_startup(void *arg1, void *arg2) ret = spdk_vhost_scsi_controller_construct(); if (ret != 0) { SPDK_ERRLOG("Cannot construct vhost controllers\n"); - abort(); + goto out; } ret = spdk_vhost_blk_controller_construct(); if (ret != 0) { SPDK_ERRLOG("Cannot construct vhost block controllers\n"); - abort(); + goto out; } + + return; + +out: + spdk_vhost_shutdown_cb(); } static void