bdev: defer call of spdk_bdev_init_failed() when a module fails
If a module fails during init, github issue #363 reported ASAN errors due to leaks from not cleaning up modules that may have completed init before the failure. An earlier partial fix was added, this is a more correct fix that addresses the specific scenario reported as well as the simplified one used during early debug... Change-Id: Ia43476faf33d8e31b581529de3b6d75caed09096 Signed-off-by: Paul Luse <paul.e.luse@intel.com> Reviewed-on: https://review.gerrithub.io/420118 Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
844aedf8ad
commit
18f534465c
@ -679,11 +679,17 @@ spdk_bdev_modules_init(void)
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
spdk_bdev_init_failed_complete(void *cb_arg)
|
||||
{
|
||||
spdk_bdev_init_complete(-1);
|
||||
}
|
||||
|
||||
static void
|
||||
spdk_bdev_init_failed(void *cb_arg)
|
||||
{
|
||||
spdk_bdev_init_complete(-1);
|
||||
return;
|
||||
spdk_bdev_finish(spdk_bdev_init_failed_complete, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -790,7 +796,7 @@ spdk_bdev_initialize(spdk_bdev_init_cb cb_fn, void *cb_arg)
|
||||
rc = spdk_bdev_modules_init();
|
||||
if (rc != 0) {
|
||||
SPDK_ERRLOG("bdev modules init failed\n");
|
||||
spdk_bdev_finish(spdk_bdev_init_failed, NULL);
|
||||
spdk_thread_send_msg(spdk_get_thread(), spdk_bdev_init_failed, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user