DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost: fix error code check when creating pthread
@ 2017-12-08 10:19 Olivier Matz
  2017-12-11  9:53 ` Jens Freimann
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Olivier Matz @ 2017-12-08 10:19 UTC (permalink / raw)
  To: dev, Yuanhan Liu, Maxime Coquelin; +Cc: stable

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 <olivier.matz@6wind.com>
---
 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");
 	}
-- 
2.11.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: fix error code check when creating pthread
  2017-12-08 10:19 [dpdk-dev] [PATCH] vhost: fix error code check when creating pthread Olivier Matz
@ 2017-12-11  9:53 ` Jens Freimann
  2017-12-11 13:26 ` Maxime Coquelin
  2018-01-09 13:27 ` Yuanhan Liu
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Freimann @ 2017-12-11  9:53 UTC (permalink / raw)
  To: Olivier Matz; +Cc: dev, Yuanhan Liu, Maxime Coquelin, stable

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 <olivier.matz@6wind.com>
>---
> 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 <jfreimann@redhat.com> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: fix error code check when creating pthread
  2017-12-08 10:19 [dpdk-dev] [PATCH] vhost: fix error code check when creating pthread Olivier Matz
  2017-12-11  9:53 ` Jens Freimann
@ 2017-12-11 13:26 ` Maxime Coquelin
  2018-01-09 13:27 ` Yuanhan Liu
  2 siblings, 0 replies; 4+ messages in thread
From: Maxime Coquelin @ 2017-12-11 13:26 UTC (permalink / raw)
  To: Olivier Matz, dev, Yuanhan Liu; +Cc: stable



On 12/08/2017 11:19 AM, 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 <olivier.matz@6wind.com>
> ---
>   lib/librte_vhost/socket.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: fix error code check when creating pthread
  2017-12-08 10:19 [dpdk-dev] [PATCH] vhost: fix error code check when creating pthread Olivier Matz
  2017-12-11  9:53 ` Jens Freimann
  2017-12-11 13:26 ` Maxime Coquelin
@ 2018-01-09 13:27 ` Yuanhan Liu
  2 siblings, 0 replies; 4+ messages in thread
From: Yuanhan Liu @ 2018-01-09 13:27 UTC (permalink / raw)
  To: Olivier Matz; +Cc: dev, Maxime Coquelin, stable

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 <olivier.matz@6wind.com>
> ---

Applied to dpdk-next-virtio.

Thanks.

	--yliu

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-09 13:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-08 10:19 [dpdk-dev] [PATCH] vhost: fix error code check when creating pthread Olivier Matz
2017-12-11  9:53 ` Jens Freimann
2017-12-11 13:26 ` Maxime Coquelin
2018-01-09 13:27 ` Yuanhan Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).