Commit 68b9d583 authored by Ben Walker's avatar Ben Walker Committed by Jim Harris
Browse files

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: default avatarBen 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 38ed4e4a
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -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