nvmf: allow removal of listen addresses at runtime
Change-Id: I53ffdd061ba068070f66a752780229ecfe53e737 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/398688 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
6ad3a5ce9b
commit
54bfde6a09
@ -317,6 +317,18 @@ const char *spdk_nvmf_host_get_nqn(struct spdk_nvmf_host *host);
|
||||
int spdk_nvmf_subsystem_add_listener(struct spdk_nvmf_subsystem *subsystem,
|
||||
struct spdk_nvme_transport_id *trid);
|
||||
|
||||
/**
|
||||
* Stop accepting new connections on the address provided
|
||||
*
|
||||
* May only be performed on subsystems in the PAUSED or INACTIVE states.
|
||||
*
|
||||
* \param subsystem Subsystem to remove listener from
|
||||
* \param trid The address to no longer accept connections from
|
||||
* \return 0 on success. Negated errno value on failure.
|
||||
*/
|
||||
int spdk_nvmf_subsystem_remove_listener(struct spdk_nvmf_subsystem *subsystem,
|
||||
const struct spdk_nvme_transport_id *trid);
|
||||
|
||||
/**
|
||||
* Check if connections originated from the given address are allowed to connect to the subsystem.
|
||||
*
|
||||
|
@ -700,6 +700,28 @@ spdk_nvmf_subsystem_add_listener(struct spdk_nvmf_subsystem *subsystem,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
spdk_nvmf_subsystem_remove_listener(struct spdk_nvmf_subsystem *subsystem,
|
||||
const struct spdk_nvme_transport_id *trid)
|
||||
{
|
||||
struct spdk_nvmf_listener *listener;
|
||||
|
||||
if (!(subsystem->state == SPDK_NVMF_SUBSYSTEM_INACTIVE ||
|
||||
subsystem->state == SPDK_NVMF_SUBSYSTEM_PAUSED)) {
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
listener = _spdk_nvmf_subsystem_find_listener(subsystem, trid);
|
||||
if (listener == NULL) {
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
TAILQ_REMOVE(&subsystem->listeners, listener, link);
|
||||
free(listener);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: this is the whitelist and will be called during connection setup
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user