[ofa-general] [PATCH] libibverbs: increment comp_events_completed only if channel is set

Hoang-Nam Nguyen hnguyen at linux.vnet.ibm.com
Tue Sep 4 16:44:35 PDT 2007


Hello Roland!
I created this patch against your libibverbs git, stable branch.
Regards
Nam


increment counter comp_events_completed only if channel is set
this will prevent the while loop below in ibv_cmd_destroy_cq() to
hang if consumer calls ibv_ack_cq_events() without any assigned
channel

int ibv_cmd_destroy_cq(struct ibv_cq *cq)
{ ...
	pthread_mutex_lock(&cq->mutex);
	while (cq->comp_events_completed  != resp.comp_events_reported ||
	       cq->async_events_completed != resp.async_events_reported)

Signed-off-by: Hoang-Nam Nguyen <hnguyen at de.ibm.com>
---
 src/verbs.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/verbs.c b/src/verbs.c
index f5cf4d3..3460844 100644
--- a/src/verbs.c
+++ b/src/verbs.c
@@ -344,6 +344,8 @@ default_symver(__ibv_get_cq_event, ibv_get_cq_event);
 
 void __ibv_ack_cq_events(struct ibv_cq *cq, unsigned int nevents)
 {
+	if (!cq->channel)
+		return;
 	pthread_mutex_lock(&cq->mutex);
 	cq->comp_events_completed += nevents;
 	pthread_cond_signal(&cq->cond);
-- 
1.5.2





More information about the general mailing list