nvmf: check whether the transport already in poll group

Add a check when adding transport in the poll group.
If already there, just return.

The poll_group_add_transport operation can be called
at the poll group creation and target listen both.

Change-Id: I655d6fa97cafdc11fa23d199bdfe31350b920ca4
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/395039
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
GangCao 2018-01-16 20:06:52 -05:00 committed by Daniel Verkamp
parent 37273c20c2
commit fc7e847539

View File

@ -398,6 +398,13 @@ spdk_nvmf_poll_group_add_transport(struct spdk_nvmf_poll_group *group,
{
struct spdk_nvmf_transport_poll_group *tgroup;
TAILQ_FOREACH(tgroup, &group->tgroups, link) {
if (tgroup->transport == transport) {
/* Transport already in the poll group */
return 0;
}
}
tgroup = spdk_nvmf_transport_poll_group_create(transport);
if (!tgroup) {
SPDK_ERRLOG("Unable to create poll group for transport\n");