sock: Fix the spdk_sock_remove_sock_group_from_map_table

We need to compare the group info, then delete the
related entry.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ie5ed7f3ce8611fd61448788f54a63f624c813c19
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463176
Reviewed-by: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Ziye Yang 2019-07-26 04:40:50 +08:00 committed by Jim Harris
parent 90520634bd
commit a81bdcf380

View File

@ -133,12 +133,14 @@ spdk_sock_map_lookup(int placement_id, struct spdk_sock_group **group)
static void static void
spdk_sock_remove_sock_group_from_map_table(struct spdk_sock_group *group) spdk_sock_remove_sock_group_from_map_table(struct spdk_sock_group *group)
{ {
struct spdk_sock_placement_id_entry *entry; struct spdk_sock_placement_id_entry *entry, *tmp;
pthread_mutex_lock(&g_map_table_mutex); pthread_mutex_lock(&g_map_table_mutex);
STAILQ_FOREACH(entry, &g_placement_id_map, link) { STAILQ_FOREACH_SAFE(entry, &g_placement_id_map, link, tmp) {
if (entry->group == group) {
STAILQ_REMOVE(&g_placement_id_map, entry, spdk_sock_placement_id_entry, link); STAILQ_REMOVE(&g_placement_id_map, entry, spdk_sock_placement_id_entry, link);
} }
}
pthread_mutex_unlock(&g_map_table_mutex); pthread_mutex_unlock(&g_map_table_mutex);
} }