diff --git a/include/spdk/nvmf_transport.h b/include/spdk/nvmf_transport.h index 6660e37b2..6aaae4ce8 100644 --- a/include/spdk/nvmf_transport.h +++ b/include/spdk/nvmf_transport.h @@ -242,17 +242,11 @@ struct spdk_nvmf_transport_ops { * action here, as the enforcement of the association is done in the generic * code. * - * The association is not considered complete until cb_fn is called. New - * connections on the listener targeting this subsystem will be rejected - * until that time. - * - * Pass a negated errno code to `cb_fn` to block the association. 0 to allow. + * Returns a negated errno code to block the association. 0 to allow. */ - void (*listen_associate)(struct spdk_nvmf_transport *transport, - const struct spdk_nvmf_subsystem *subsystem, - const struct spdk_nvme_transport_id *trid, - spdk_nvmf_tgt_subsystem_listen_done_fn cb_fn, - void *cb_arg); + int (*listen_associate)(struct spdk_nvmf_transport *transport, + const struct spdk_nvmf_subsystem *subsystem, + const struct spdk_nvme_transport_id *trid); /** * Check for new connections on the transport. diff --git a/lib/nvmf/subsystem.c b/lib/nvmf/subsystem.c index 24dac7dea..dd45d5247 100644 --- a/lib/nvmf/subsystem.c +++ b/lib/nvmf/subsystem.c @@ -831,6 +831,7 @@ spdk_nvmf_subsystem_add_listener(struct spdk_nvmf_subsystem *subsystem, struct spdk_nvmf_transport *transport; struct spdk_nvmf_subsystem_listener *listener; struct spdk_nvmf_listener *tr_listener; + int rc = 0; assert(cb_fn != NULL); @@ -874,12 +875,10 @@ spdk_nvmf_subsystem_add_listener(struct spdk_nvmf_subsystem *subsystem, listener->ana_state = SPDK_NVME_ANA_OPTIMIZED_STATE; if (transport->ops->listen_associate != NULL) { - transport->ops->listen_associate(transport, subsystem, trid, - _nvmf_subsystem_add_listener_done, - listener); - } else { - _nvmf_subsystem_add_listener_done(listener, 0); + rc = transport->ops->listen_associate(transport, subsystem, trid); } + + _nvmf_subsystem_add_listener_done(listener, rc); } int