Skip to content

Commit

Permalink
prov/verbs: Fix data race vrb_open_ep function
Browse files Browse the repository at this point in the history
Resolved a data race in the vrb_open_ep function of the verbs provider caused
by concurrent modifications to the global variable vrb_ep_ops. This issue
violated the FI_THREAD_SAFE threading model, leading to unpredictable behavior
when creating endpoints from multiple threads.

Signed-off-by: Piotr Chmiel <[email protected]>
  • Loading branch information
piotrchmiel committed Nov 27, 2024
1 parent 2ad2e37 commit 7fadc6d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions prov/verbs/src/verbs_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ ssize_t vrb_post_send(struct vrb_ep *ep, struct ibv_send_wr *wr, uint64_t flags)
}

if (vrb_wr_consumes_recv(wr)) {
if (!ep->peer_rq_credits ||
if (!ep->peer_rq_credits ||
(ep->peer_rq_credits == 1 && !(flags & OFI_PRIORITY)))
/* Last credit is reserved for credit update */
goto freectx;
Expand Down Expand Up @@ -1161,7 +1161,7 @@ static struct fi_ops vrb_ep_ops = {
.close = vrb_ep_close,
.bind = vrb_ep_bind,
.control = vrb_ep_control,
.ops_open = fi_no_ops_open,
.ops_open = vrb_ep_ops_open,
};

static struct fi_ops_cm vrb_dgram_cm_ops = {
Expand Down Expand Up @@ -1394,7 +1394,6 @@ int vrb_open_ep(struct fid_domain *domain, struct fi_info *info,
*ep_fid = &ep->util_ep.ep_fid;
ep->util_ep.ep_fid.fid.ops = &vrb_ep_ops;
ep->util_ep.ep_fid.ops = &vrb_ep_base_ops;
(*ep_fid)->fid.ops->ops_open = vrb_ep_ops_open;

vrb_prof_func_end("vrb_open_ep");

Expand Down

0 comments on commit 7fadc6d

Please sign in to comment.