Commit 7717cfca authored by Jim Harris's avatar Jim Harris Committed by Daniel Verkamp
Browse files

bdev/iscsi: fix double spdk_bdev_module_finish_done() call



bdev_iscsi_lun_cleanup() was not accounting for LUNs
getting cleaned up before the module_finish function
was called.  This resulted in the bdev/iscsi module
calling spdk_bdev_module_finish_done twice which
resulted in io_device_unregister not found errors and
possible seg faults.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I42c3e0af250e0abcea1cd88ffd3c041ebdaeea49
Reviewed-on: https://review.gerrithub.io/415372


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 1a6d5933
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ static TAILQ_HEAD(, bdev_iscsi_lun) g_iscsi_lun_head = TAILQ_HEAD_INITIALIZER(g_
static TAILQ_HEAD(, bdev_iscsi_conn_req) g_iscsi_conn_req = TAILQ_HEAD_INITIALIZER(
			g_iscsi_conn_req);
static struct spdk_poller *g_conn_poller = NULL;
static bool g_finish_in_process = false;

struct bdev_iscsi_io {
	struct spdk_thread *submit_td;
@@ -140,7 +141,7 @@ bdev_iscsi_lun_cleanup(struct bdev_iscsi_lun *lun)
	TAILQ_REMOVE(&g_iscsi_lun_head, lun, link);
	iscsi_destroy_context(lun->context);
	iscsi_free_lun(lun);
	if (TAILQ_EMPTY(&g_iscsi_lun_head)) {
	if (TAILQ_EMPTY(&g_iscsi_lun_head) && g_finish_in_process) {
		bdev_iscsi_finish_done();
		spdk_bdev_module_finish_done();
	}
@@ -164,6 +165,12 @@ bdev_iscsi_finish(void)
{
	struct bdev_iscsi_lun *lun, *tmp;

	/*
	 * Set this flag so that bdev_iscsi_lun_cleanup knows it needs to mark
	 *  the module finish as done when the TAILQ is not empty.
	 */
	g_finish_in_process = true;

	if (TAILQ_EMPTY(&g_iscsi_lun_head)) {
		bdev_iscsi_finish_done();
		spdk_bdev_module_finish_done();