fio_plugin: exit immediately if spdk_fio_init_env fails

This is going to be moved to a separate thread later in
the patch series and it won't be able to return an error
code. The entire program must exit.

Change-Id: I718d2a82346f78596f805492392a843e7a79359e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/432088
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Ben Walker 2018-11-05 15:32:19 -07:00 committed by Jim Harris
parent 38ed4e4a05
commit 68b9d5838b

View File

@ -279,25 +279,28 @@ spdk_fio_init_env(struct thread_data *td)
eo = td->eo;
if (!eo->conf || !strlen(eo->conf)) {
SPDK_ERRLOG("No configuration file provided\n");
return -1;
rc = EINVAL;
goto err_exit;
}
config = spdk_conf_allocate();
if (!config) {
SPDK_ERRLOG("Unable to allocate configuration file\n");
return -1;
rc = ENOMEM;
goto err_exit;
}
rc = spdk_conf_read(config, eo->conf);
if (rc != 0) {
SPDK_ERRLOG("Invalid configuration file format\n");
spdk_conf_free(config);
return -1;
goto err_exit;
}
if (spdk_conf_first_section(config) == NULL) {
SPDK_ERRLOG("Invalid configuration file format\n");
spdk_conf_free(config);
return -1;
rc = EINVAL;
goto err_exit;
}
spdk_conf_set_as_default(config);
@ -313,7 +316,8 @@ spdk_fio_init_env(struct thread_data *td)
if (spdk_env_init(&opts) < 0) {
SPDK_ERRLOG("Unable to initialize SPDK env\n");
spdk_conf_free(config);
return -1;
rc = EINVAL;
goto err_exit;
}
spdk_unaffinitize_thread();
@ -321,7 +325,7 @@ spdk_fio_init_env(struct thread_data *td)
rc = spdk_fio_init_thread(td);
if (rc < 0) {
SPDK_ERRLOG("Failed to create initialization thread\n");
return -1;
goto err_exit;
}
g_init_thread = fio_thread = td->io_ops_data;
@ -356,6 +360,10 @@ spdk_fio_init_env(struct thread_data *td)
}
return 0;
err_exit:
exit(rc);
return -1;
}
/* Called for each thread to fill in the 'real_file_size' member for