Commit e237ce31 authored by Dariusz Stojaczyk's avatar Dariusz Stojaczyk Committed by Daniel Verkamp
Browse files

bdev: don't continue on module init error



spdk_bdev_init_complete could have been called twice.

While here, also simplify bdev_initialize error path.
On allocation failure, bdev subsystem will now finish
with bdev_mgr->module_init_complete set to false.

Fixes: 7fefd60f ("bdev: make module init synchronous again")

Change-Id: Ia4b5d571d26beb34f0e6c0f4c7b3176215eec69f
Signed-off-by: default avatarDariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/375572


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 5847d688
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -369,6 +369,7 @@ spdk_bdev_module_init_complete(int rc)

	if (rc != 0) {
		spdk_bdev_init_complete(rc);
		return;
	}

	/*
@@ -445,7 +446,7 @@ spdk_bdev_initialize(spdk_bdev_init_cb cb_fn, void *cb_arg,

	if (g_bdev_mgr.bdev_io_pool == NULL) {
		SPDK_ERRLOG("could not allocate spdk_bdev_io pool\n");
		spdk_bdev_module_init_complete(-1);
		spdk_bdev_init_complete(-1);
		return;
	}

@@ -464,7 +465,7 @@ spdk_bdev_initialize(spdk_bdev_init_cb cb_fn, void *cb_arg,
				    SPDK_ENV_SOCKET_ID_ANY);
	if (!g_bdev_mgr.buf_small_pool) {
		SPDK_ERRLOG("create rbuf small pool failed\n");
		spdk_bdev_module_init_complete(-1);
		spdk_bdev_init_complete(-1);
		return;
	}

@@ -478,7 +479,7 @@ spdk_bdev_initialize(spdk_bdev_init_cb cb_fn, void *cb_arg,
				    SPDK_ENV_SOCKET_ID_ANY);
	if (!g_bdev_mgr.buf_large_pool) {
		SPDK_ERRLOG("create rbuf large pool failed\n");
		spdk_bdev_module_init_complete(-1);
		spdk_bdev_init_complete(-1);
		return;
	}