Commit d0cf194b authored by Changpeng Liu's avatar Changpeng Liu Committed by Tomasz Zawadzki
Browse files

nvmf/vfio-user: only relisten accept poller when connection is disconnected



For the case `nvmf_subsystem_remove_listener` RPC call when VM is connected,
we should not relisten the accept poller, because the endpoint will be
destroyed for this case.

Change-Id: Icf8299f26a3bbf7bbe44fd01edb4ede344692d25
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13548


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJohn Levon <levon@movementarian.org>
parent bc7f7399
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -417,6 +417,8 @@ struct nvmf_vfio_user_endpoint {
	 * in source VM.
	 */
	bool					need_resume;
	/* Start the accept poller again after destroying the controller */
	bool					need_relisten;

	TAILQ_ENTRY(nvmf_vfio_user_endpoint)	link;
};
@@ -4063,6 +4065,7 @@ vfio_user_register_accept_poller(struct nvmf_vfio_user_endpoint *endpoint)
	}

	endpoint->accept_thread = spdk_get_thread();
	endpoint->need_relisten = false;

	if (!spdk_interrupt_mode_is_enabled()) {
		return 0;
@@ -4109,7 +4112,7 @@ _free_ctrlr(void *ctx)

	if (endpoint->need_async_destroy) {
		nvmf_vfio_user_destroy_endpoint(endpoint);
	} else {
	} else if (endpoint->need_relisten) {
		spdk_thread_send_msg(endpoint->accept_thread,
				     _vfio_user_relisten, endpoint);
	}
@@ -4662,6 +4665,7 @@ vfio_user_destroy_ctrlr(struct nvmf_vfio_user_ctrlr *ctrlr)
	assert(endpoint != NULL);

	pthread_mutex_lock(&endpoint->lock);
	endpoint->need_relisten = true;
	if (TAILQ_EMPTY(&ctrlr->connected_sqs)) {
		endpoint->ctrlr = NULL;
		free_ctrlr(ctrlr);