nvmf: Stop subsystems from the thread they were started on

This correctly puts all of the I/O channels on the right
thread during shutdown.

Change-Id: I432c8cb981a68b40639f8876dae42597a9e6a85f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/389637
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ben Walker 2017-11-29 13:37:16 -07:00 committed by Jim Harris
parent 84eb1451ea
commit 7b57e9f973
4 changed files with 11 additions and 6 deletions

View File

@ -77,12 +77,12 @@ subsystem_delete_event(void *arg1, void *arg2)
}
static void
subsystem_unregister_poller(void *arg1, void *arg2)
subsystem_stop(void *arg1, void *arg2)
{
struct nvmf_tgt_subsystem *app_subsys = arg1;
struct spdk_event *event = arg2;
spdk_poller_unregister(&app_subsys->poller);
spdk_nvmf_subsystem_stop(app_subsys->subsystem);
spdk_event_call(event);
}
@ -94,7 +94,7 @@ nvmf_tgt_delete_subsystem(struct nvmf_tgt_subsystem *app_subsys)
event2 = spdk_event_allocate(spdk_env_get_current_core(), subsystem_delete_event,
app_subsys, NULL);
event1 = spdk_event_allocate(app_subsys->lcore, subsystem_unregister_poller, app_subsys, event2);
event1 = spdk_event_allocate(app_subsys->lcore, subsystem_stop, app_subsys, event2);
spdk_event_call(event1);
}

View File

@ -53,7 +53,6 @@ struct spdk_nvmf_tgt_conf {
struct nvmf_tgt_subsystem {
struct spdk_nvmf_subsystem *subsystem;
struct spdk_poller *poller;
TAILQ_ENTRY(nvmf_tgt_subsystem) tailq;

View File

@ -134,6 +134,8 @@ struct spdk_nvmf_subsystem *spdk_nvmf_tgt_find_subsystem(struct spdk_nvmf_tgt *t
*/
int spdk_nvmf_subsystem_start(struct spdk_nvmf_subsystem *subsystem);
void spdk_nvmf_subsystem_stop(struct spdk_nvmf_subsystem *subsystem);
void spdk_nvmf_delete_subsystem(struct spdk_nvmf_subsystem *subsystem);
/**

View File

@ -50,6 +50,12 @@ spdk_nvmf_subsystem_start(struct spdk_nvmf_subsystem *subsystem)
return spdk_nvmf_subsystem_bdev_attach(subsystem);
}
void
spdk_nvmf_subsystem_stop(struct spdk_nvmf_subsystem *subsystem)
{
spdk_nvmf_subsystem_bdev_detach(subsystem);
}
static bool
spdk_nvmf_valid_nqn(const char *nqn)
{
@ -171,8 +177,6 @@ spdk_nvmf_delete_subsystem(struct spdk_nvmf_subsystem *subsystem)
spdk_nvmf_ctrlr_destruct(ctrlr);
}
spdk_nvmf_subsystem_bdev_detach(subsystem);
free(subsystem->ns);
subsystem->tgt->subsystems[subsystem->id] = NULL;