From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 29951239; Mon, 11 Dec 2017 10:54:03 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 04A60883CF; Mon, 11 Dec 2017 09:54:03 +0000 (UTC) Received: from localhost (dhcp-192-241.str.redhat.com [10.33.192.241]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EC3172D21D; Mon, 11 Dec 2017 09:53:58 +0000 (UTC) Date: Mon, 11 Dec 2017 10:53:57 +0100 From: Jens Freimann To: Olivier Matz Cc: dev@dpdk.org, Yuanhan Liu , Maxime Coquelin , stable@dpdk.org Message-ID: <20171211095357.artnyzqvch4ine42@localhost.localdomain> References: <20171208101949.1768-1-olivier.matz@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20171208101949.1768-1-olivier.matz@6wind.com> User-Agent: NeoMutt/20171027 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 11 Dec 2017 09:54:03 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH] vhost: fix error code check when creating pthread X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Dec 2017 09:54:04 -0000 On Fri, Dec 08, 2017 at 11:19:49AM +0100, Olivier Matz wrote: >On error, pthread_create() returns a positive number (errno). >Fix the test on the return value. > >Fixes: af1475918124 ("vhost: introduce API to start a specific driver") >Fixes: e623e0c6d8a5 ("vhost: add reconnect ability") >Cc: stable@dpdk.org > >Signed-off-by: Olivier Matz >--- > lib/librte_vhost/socket.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > >diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c >index 422da002f..811e6bf16 100644 >--- a/lib/librte_vhost/socket.c >+++ b/lib/librte_vhost/socket.c >@@ -472,7 +472,7 @@ vhost_user_reconnect_init(void) > > ret = pthread_create(&reconn_tid, NULL, > vhost_user_client_reconnect, NULL); >- if (ret < 0) { >+ if (ret != 0) { > RTE_LOG(ERR, VHOST_CONFIG, "failed to create reconnect thread"); > if (pthread_mutex_destroy(&reconn_list.mutex)) { > RTE_LOG(ERR, VHOST_CONFIG, >@@ -678,9 +678,8 @@ rte_vhost_driver_register(const char *path, uint64_t flags) > if ((flags & RTE_VHOST_USER_CLIENT) != 0) { > vsocket->reconnect = !(flags & RTE_VHOST_USER_NO_RECONNECT); > if (vsocket->reconnect && reconn_tid == 0) { >- if (vhost_user_reconnect_init() < 0) { >+ if (vhost_user_reconnect_init() != 0) > goto out_mutex; >- } > } > } else { > vsocket->is_server = true; >@@ -837,7 +836,7 @@ rte_vhost_driver_start(const char *path) > if (fdset_tid == 0) { > int ret = pthread_create(&fdset_tid, NULL, fdset_event_dispatch, > &vhost_user.fdset); >- if (ret < 0) >+ if (ret != 0) > RTE_LOG(ERR, VHOST_CONFIG, > "failed to create fdset handling thread"); > } Reviewed-by: Jens Freimann