From owner-svn-src-all@FreeBSD.ORG Wed Oct 29 06:24:13 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A9F41C6B; Wed, 29 Oct 2014 06:24:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D73874B; Wed, 29 Oct 2014 06:24:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9T6ODfU038595; Wed, 29 Oct 2014 06:24:13 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9T6OD1a038594; Wed, 29 Oct 2014 06:24:13 GMT (envelope-from np@FreeBSD.org) Message-Id: <201410290624.s9T6OD1a038594@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 29 Oct 2014 06:24:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273811 - head/contrib/ofed/librdmacm/examples X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 06:24:13 -0000 Author: np Date: Wed Oct 29 06:24:12 2014 New Revision: 273811 URL: https://svnweb.freebsd.org/changeset/base/273811 Log: 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 Modified: head/contrib/ofed/librdmacm/examples/rping.c Modified: head/contrib/ofed/librdmacm/examples/rping.c ============================================================================== --- head/contrib/ofed/librdmacm/examples/rping.c Wed Oct 29 04:32:46 2014 (r273810) +++ head/contrib/ofed/librdmacm/examples/rping.c Wed Oct 29 06:24:12 2014 (r273811) @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -280,10 +279,10 @@ static int rping_cq_event_handler(struct 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_thr 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 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 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);