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: 7fefd60fab ("bdev: make module init synchronous again")

Change-Id: Ia4b5d571d26beb34f0e6c0f4c7b3176215eec69f
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/375572
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-08-24 13:42:06 +02:00 committed by Daniel Verkamp
parent 5847d6887e
commit e237ce317e

View File

@ -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;
}