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

iscsi: shutdown iscsi library as part of subsystem fini path



With the new asynchronous subsystem finish framework, we can
drive shutdown of existing connections as part of the subsystem
finish path instead of a separate spdk_iscsi_shutdown function
called as the shutdown function in response to SIGINT.

This is a step towards enabling a single target app that
supports multiple protocols (i.e. iSCSI + vhost + NVMe-oF).

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Id9f596a8091912a72ab7eb93cb45a46fdb130a48

Reviewed-on: https://review.gerrithub.io/386695


Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
parent 6bef902c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ main(int argc, char **argv)
		}
	}

	opts.shutdown_cb = spdk_iscsi_shutdown;
	opts.shutdown_cb = NULL;
	opts.usr1_handler = spdk_sigusr1;

	printf("Using net framework %s\n", spdk_net_framework_get_name());
+7 −2
Original line number Diff line number Diff line
@@ -48,12 +48,17 @@ spdk_iscsi_subsystem_init(void)
}

static void
spdk_iscsi_subsystem_fini(void *arg1, void *arg2)
spdk_iscsi_subsystem_fini_done(void *arg)
{
	spdk_iscsi_fini();
	spdk_subsystem_fini_next();
}

static void
spdk_iscsi_subsystem_fini(void *arg1, void *arg2)
{
	spdk_iscsi_fini(spdk_iscsi_subsystem_fini_done, NULL);
}

SPDK_SUBSYSTEM_REGISTER(iscsi, spdk_iscsi_subsystem_init, spdk_iscsi_subsystem_fini,
			spdk_iscsi_config_text)
SPDK_SUBSYSTEM_DEPEND(iscsi, scsi)
+1 −1
Original line number Diff line number Diff line
@@ -756,7 +756,7 @@ static void
spdk_iscsi_conn_check_shutdown_cb(void *arg1, void *arg2)
{
	spdk_iscsi_conns_cleanup();
	spdk_app_stop(0);
	spdk_iscsi_fini_done();
}

static void
+0 −7
Original line number Diff line number Diff line
@@ -4684,13 +4684,6 @@ spdk_append_iscsi_sess(struct spdk_iscsi_conn *conn,
	return 0;
}

void
spdk_iscsi_shutdown(void)
{
	spdk_iscsi_portal_grp_close_all();
	spdk_shutdown_iscsi_conns();
}

bool spdk_iscsi_is_deferred_free_pdu(struct spdk_iscsi_pdu *pdu)
{
	if (pdu == NULL)
+3 −2
Original line number Diff line number Diff line
@@ -320,7 +320,9 @@ extern struct spdk_iscsi_globals g_spdk_iscsi;
struct spdk_iscsi_task;

int spdk_iscsi_init(void);
void spdk_iscsi_fini(void);
typedef void (*spdk_iscsi_fini_cb)(void *arg);
void spdk_iscsi_fini(spdk_iscsi_fini_cb cb_fn, void *cb_arg);
void spdk_iscsi_fini_done(void);
void spdk_iscsi_config_text(FILE *fp);

int spdk_iscsi_send_nopin(struct spdk_iscsi_conn *conn);
@@ -344,7 +346,6 @@ void spdk_del_connection_queued_task(void *tailq, struct spdk_scsi_lun *lun);
void spdk_del_transfer_task(struct spdk_iscsi_conn *conn, uint32_t CmdSN);
bool  spdk_iscsi_is_deferred_free_pdu(struct spdk_iscsi_pdu *pdu);

void spdk_iscsi_shutdown(void);
int spdk_iscsi_negotiate_params(struct spdk_iscsi_conn *conn,
				struct iscsi_param **params_p, uint8_t *data,
				int alloc_len, int data_len);
Loading