diff options
author | Navdeep Parhar <np@FreeBSD.org> | 2014-10-29 06:24:12 +0000 |
---|---|---|
committer | Navdeep Parhar <np@FreeBSD.org> | 2014-10-29 06:24:12 +0000 |
commit | 1db6552d17f583ab5d13564a0f3878c1f93ad717 (patch) | |
tree | 9ac5c268bf363ade033e2010e6f88761431dcee5 /contrib/ofed/librdmacm | |
parent | 05f0ff5a303ac187de8afaef60c470ed2c19a19d (diff) | |
download | src-1db6552d17f583ab5d13564a0f3878c1f93ad717.tar.gz src-1db6552d17f583ab5d13564a0f3878c1f93ad717.zip |
rping: make sure that the CQ event thread can never poll a CQ after it
has been destroyed.
Submitted by: Hariprasad at Chelsio dot com
Sponsored by: Chelsio Communications
Notes
Notes:
svn path=/head/; revision=273811
Diffstat (limited to 'contrib/ofed/librdmacm')
-rw-r--r-- | contrib/ofed/librdmacm/examples/rping.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/contrib/ofed/librdmacm/examples/rping.c b/contrib/ofed/librdmacm/examples/rping.c index 40e6bf43488c..9bbfab1caa14 100644 --- a/contrib/ofed/librdmacm/examples/rping.c +++ b/contrib/ofed/librdmacm/examples/rping.c @@ -40,7 +40,6 @@ #include <netinet/in.h> #include <sys/socket.h> #include <netdb.h> -#include <byteswap.h> #include <semaphore.h> #include <arpa/inet.h> #include <pthread.h> @@ -280,10 +279,10 @@ static int rping_cq_event_handler(struct rping_cb *cb) ret = 0; if (wc.status) { - fprintf(stderr, "cq completion failed status %d\n", - wc.status); if (wc.status != IBV_WC_WR_FLUSH_ERR) - ret = -1; + fprintf(stderr, "cq completion failed status %d\n", + wc.status); + ret = -1; goto error; } @@ -800,10 +799,9 @@ static void *rping_persistent_server_thread(void *arg) rping_test_server(cb); rdma_disconnect(cb->child_cm_id); + pthread_join(cb->cqthread, NULL); rping_free_buffers(cb); rping_free_qp(cb); - pthread_cancel(cb->cqthread); - pthread_join(cb->cqthread, NULL); rdma_destroy_id(cb->child_cm_id); free_cb(cb); return NULL; @@ -888,6 +886,7 @@ static int rping_run_server(struct rping_cb *cb) rping_test_server(cb); rdma_disconnect(cb->child_cm_id); + pthread_join(cb->cqthread, NULL); rdma_destroy_id(cb->child_cm_id); err2: rping_free_buffers(cb); @@ -1053,9 +1052,16 @@ static int rping_run_client(struct rping_cb *cb) goto err2; } - rping_test_client(cb); + ret = rping_test_client(cb); + if (ret) { + fprintf(stderr, "rping client failed: %d\n", ret); + goto err3; + } + ret = 0; +err3: rdma_disconnect(cb->cm_id); err2: + pthread_join(cb->cqthread, NULL); rping_free_buffers(cb); err1: rping_free_qp(cb); |