sock: Placement Ids may only map to a single group

Change-Id: Ib917f2e95f93f4cb48d53e35f3273b0c42ba1a4f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7206
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Ben Walker 2021-03-29 15:10:41 -07:00 committed by Jim Harris
parent 28b3889c8e
commit 141a95aa36

View File

@ -67,9 +67,10 @@ sock_map_insert(int placement_id, struct spdk_sock_group *group, bool init)
pthread_mutex_lock(&g_map_table_mutex);
STAILQ_FOREACH(entry, &g_placement_id_map, link) {
if (placement_id == entry->placement_id) {
/* The mapping already exists, it means that different sockets have
* the same placement_ids.
*/
if (entry->group != group) {
pthread_mutex_unlock(&g_map_table_mutex);
return -EINVAL;
}
entry->ref++;
pthread_mutex_unlock(&g_map_table_mutex);
return 0;