Commit 29093c7f authored by Darek Stojaczyk's avatar Darek Stojaczyk
Browse files

event/app: don't call start_fn twice when json config is used



When JSON config was used, app layer was calling the
app start callback twice - once from internally-sent
"start_subsystem_init" RPC, and once from the app layer
itself.

In case of JSON configs, the callback from within the
RPC was actually called prematurely, as the real RPC
server was still starting in the background at that
point. We still need to start the app from that RPC in
case of `--wait-for-listen` option, but for JSON configs
it doesn't make sense. Just ignore it now and rely on
json config load completion callback to start the app.

Fixes #816

Change-Id: Ib54d624f3167137216c910b2d947bbd1dc5023b1
Signed-off-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458351


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent a7d9fc4a
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -340,8 +340,6 @@ spdk_app_setup_signal_handlers(struct spdk_app_opts *opts)
static void
spdk_app_start_application(void)
{
	spdk_rpc_set_state(SPDK_RPC_RUNTIME);

	assert(spdk_get_thread() == g_app_thread);

	g_start_fn(g_start_arg);
@@ -352,6 +350,7 @@ spdk_app_start_rpc(void *arg1)
{
	spdk_rpc_initialize(g_spdk_app.rpc_addr);
	if (!g_delay_subsystem_init) {
		spdk_rpc_set_state(SPDK_RPC_RUNTIME);
		spdk_app_start_application();
	}
}
@@ -1061,7 +1060,15 @@ spdk_rpc_start_subsystem_init_cpl(void *arg1)

	assert(spdk_get_thread() == g_app_thread);

	spdk_rpc_set_state(SPDK_RPC_RUNTIME);
	/* If we're loading JSON config file, we're still operating on a fake,
	 * temporary RPC server. We'll have to defer calling the app start callback
	 * until this temporary server is shut down and a real one - listening on
	 * the proper socket - is started.
	 */
	if (g_spdk_app.json_config_file == NULL) {
		spdk_app_start_application();
	}

	w = spdk_jsonrpc_begin_result(request);
	if (w == NULL) {