[dpdk-dev] [PATCH 1/2] vhost: make sure vhost fdset-thread created successfully

xiangxia.m.yue at gmail.com xiangxia.m.yue at gmail.com
Thu Mar 22 13:39:57 CET 2018


From: Tonghao Zhang <xiangxia.m.yue at gmail.com>

When first call the 'rte_vhost_driver_start', the
fdset_event_dispatch thread should be created successfully.
Because the vhost uses it to poll socket events for vhost
server or clients. Without it, for example, vhost will not
get the connection event.

This patch returns err code directly when created not successful.

Signed-off-by: Tonghao Zhang <xiangxia.m.yue at gmail.com>
---
 lib/librte_vhost/socket.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
index 83befdc..8ca01df 100644
--- a/lib/librte_vhost/socket.c
+++ b/lib/librte_vhost/socket.c
@@ -831,9 +831,11 @@ struct vhost_device_ops const *
 	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");
+			return ret;
+		}
 	}
 
 	if (vsocket->is_server)
-- 
1.8.3.1



More information about the dev mailing list