Commit 18f53446 authored by Paul Luse's avatar Paul Luse Committed by Jim Harris
Browse files

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: default avatarPaul 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 844aedf8
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -679,11 +679,17 @@ spdk_bdev_modules_init(void)
	return rc;
}


static void
spdk_bdev_init_failed(void *cb_arg)
spdk_bdev_init_failed_complete(void *cb_arg)
{
	spdk_bdev_init_complete(-1);
	return;
}

static void
spdk_bdev_init_failed(void *cb_arg)
{
	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;
	}