Skip to content

Commit 7528827

Browse files
MarkZhang81rleon
authored andcommitted
librdmacm: Fix rdma_resolve_addrinfo() deadlock in sync mode
Fix the issue that rdma_resolve_addrinfo() gets deadlock when run in sync mode: (gdb) bt #0 futex_wait linux-rdma#1 __GI___lll_lock_wait linux-rdma#2 0x00007ffff7dae791 in lll_mutex_lock_optimized linux-rdma#3 ___pthread_mutex_lock linux-rdma#4 0x00007ffff7f9f018 in ucma_process_addrinfo_resolved linux-rdma#5 0x00007ffff7fa1447 in rdma_get_cm_event linux-rdma#6 0x00007ffff7fa1fef in ucma_complete linux-rdma#7 0x00007ffff7fa2f9c in resolve_ai_sa linux-rdma#8 0x00007ffff7fa36ab in __rdma_resolve_addrinfo linux-rdma#9 rdma_resolve_addrinfo linux-rdma#10 0x00000000004017b6 in start_cm_client_sync linux-rdma#11 0x00000000004018ee in main Fixes: 7b1a686 ("librdmacm: Provide interfaces to resolve IB services") Signed-off-by: Mark Zhang <[email protected]> Signed-off-by: Sean Hefty <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 36b662f commit 7528827

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

librdmacm/cma.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3217,17 +3217,16 @@ int rdma_resolve_addrinfo(struct rdma_cm_id *id, const char *node,
32173217
return ERR(EBUSY);
32183218
}
32193219

3220-
ret = __rdma_resolve_addrinfo(id_priv, node, service, hints);
3221-
if (ret)
3222-
goto fail;
3223-
32243220
id_priv->resolving_ai = true;
32253221
pthread_mutex_unlock(&id_priv->mut);
3226-
return 0;
32273222

3228-
fail:
3229-
pthread_mutex_unlock(&id_priv->mut);
3230-
return ERR(ret);
3223+
ret = __rdma_resolve_addrinfo(id_priv, node, service, hints);
3224+
if (ret) {
3225+
id_priv->resolving_ai = false;
3226+
return ERR(ret);
3227+
}
3228+
3229+
return 0;
32313230
}
32323231

32333232
int rdma_query_addrinfo(struct rdma_cm_id *id, struct rdma_addrinfo **info)

0 commit comments

Comments
 (0)