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: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13548
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: John Levon <levon@movementarian.org>
This commit is contained in:
Changpeng Liu 2022-07-05 15:04:14 +08:00 committed by Tomasz Zawadzki
parent bc7f73996e
commit d0cf194bc4

View File

@ -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);