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: Jim Harris <james.r.harris@intel.com> Change-Id: Id9f596a8091912a72ab7eb93cb45a46fdb130a48 Reviewed-on: https://review.gerrithub.io/386695 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
6bef902ca5
commit
d97476efdf
@ -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());
|
||||
|
@ -47,11 +47,16 @@ spdk_iscsi_subsystem_init(void)
|
||||
spdk_subsystem_init_next(rc);
|
||||
}
|
||||
|
||||
static void
|
||||
spdk_iscsi_subsystem_fini_done(void *arg)
|
||||
{
|
||||
spdk_subsystem_fini_next();
|
||||
}
|
||||
|
||||
static void
|
||||
spdk_iscsi_subsystem_fini(void *arg1, void *arg2)
|
||||
{
|
||||
spdk_iscsi_fini();
|
||||
spdk_subsystem_fini_next();
|
||||
spdk_iscsi_fini(spdk_iscsi_subsystem_fini_done, NULL);
|
||||
}
|
||||
|
||||
SPDK_SUBSYSTEM_REGISTER(iscsi, spdk_iscsi_subsystem_init, spdk_iscsi_subsystem_fini,
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -49,6 +49,9 @@
|
||||
#include "spdk_internal/event.h"
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
static spdk_iscsi_fini_cb g_fini_cb_fn;
|
||||
static void *g_fini_cb_arg;
|
||||
|
||||
#define ISCSI_CONFIG_TMPL \
|
||||
"[iSCSI]\n" \
|
||||
" # node name (not include optional part)\n" \
|
||||
@ -875,7 +878,17 @@ spdk_iscsi_init(void)
|
||||
}
|
||||
|
||||
void
|
||||
spdk_iscsi_fini(void)
|
||||
spdk_iscsi_fini(spdk_iscsi_fini_cb cb_fn, void *cb_arg)
|
||||
{
|
||||
g_fini_cb_fn = cb_fn;
|
||||
g_fini_cb_arg = cb_arg;
|
||||
|
||||
spdk_iscsi_portal_grp_close_all();
|
||||
spdk_shutdown_iscsi_conns();
|
||||
}
|
||||
|
||||
void
|
||||
spdk_iscsi_fini_done(void)
|
||||
{
|
||||
spdk_iscsi_check_pools();
|
||||
spdk_iscsi_free_pools();
|
||||
@ -887,6 +900,7 @@ spdk_iscsi_fini(void)
|
||||
free(g_spdk_iscsi.nodebase);
|
||||
|
||||
pthread_mutex_destroy(&g_spdk_iscsi.mutex);
|
||||
g_fini_cb_fn(g_fini_cb_arg);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
x
Reference in New Issue
Block a user