Commit 7b57e9f9 authored by Ben Walker's avatar Ben Walker Committed by Jim Harris
Browse files

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: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/389637


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 84eb1451
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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);
}
+0 −1
Original line number Diff line number Diff line
@@ -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;

+2 −0
Original line number Diff line number Diff line
@@ -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);

/**
+6 −2
Original line number Diff line number Diff line
@@ -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;