DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost: fix check peer close
@ 2020-04-21  8:59 Roland Qi
  2020-04-27  8:53 ` Maxime Coquelin
  2020-04-28 16:06 ` Maxime Coquelin
  0 siblings, 2 replies; 7+ messages in thread
From: Roland Qi @ 2020-04-21  8:59 UTC (permalink / raw)
  To: dev; +Cc: Roland Qi

In process_slave_message_reply(), there is a
possibility that receiving a peer close
message instead of a real message response.

this patch targeting to handle the peer close
scenario and report the correct error message.

Signed-off-by: Roland Qi <roland.qi@ucloud.cn>
---
 lib/librte_vhost/vhost_user.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index bd1be0104..971ccdb01 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -2812,11 +2812,19 @@ static int process_slave_message_reply(struct virtio_net *dev,
 	if ((msg->flags & VHOST_USER_NEED_REPLY) == 0)
 		return 0;
 
-	if (read_vhost_message(dev->slave_req_fd, &msg_reply) < 0) {
+	ret = read_vhost_message(dev->slave_req_fd, &msg_reply);
+	if (ret <= 0) {
+		if (ret < 0)
+			VHOST_LOG_CONFIG(ERR,
+				"vhost read slave message reply failed\n");
+		else
+			VHOST_LOG_CONFIG(INFO,
+				"vhost peer closed\n");
 		ret = -1;
 		goto out;
 	}
 
+	ret = 0;
 	if (msg_reply.request.slave != msg->request.slave) {
 		VHOST_LOG_CONFIG(ERR,
 			"Received unexpected msg type (%u), expected %u\n",
-- 
2.23.0.windows.1


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

* Re: [dpdk-dev] [PATCH] vhost: fix check peer close
  2020-04-21  8:59 [dpdk-dev] [PATCH] vhost: fix check peer close Roland Qi
@ 2020-04-27  8:53 ` Maxime Coquelin
  2020-04-28 16:06 ` Maxime Coquelin
  1 sibling, 0 replies; 7+ messages in thread
From: Maxime Coquelin @ 2020-04-27  8:53 UTC (permalink / raw)
  To: Roland Qi, dev



On 4/21/20 10:59 AM, Roland Qi wrote:
> In process_slave_message_reply(), there is a
> possibility that receiving a peer close
> message instead of a real message response.
> 
> this patch targeting to handle the peer close
> scenario and report the correct error message.
> 
> Signed-off-by: Roland Qi <roland.qi@ucloud.cn>
> ---
>  lib/librte_vhost/vhost_user.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)

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

Thanks,
Maxime


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

* Re: [dpdk-dev] [PATCH] vhost: fix check peer close
  2020-04-21  8:59 [dpdk-dev] [PATCH] vhost: fix check peer close Roland Qi
  2020-04-27  8:53 ` Maxime Coquelin
@ 2020-04-28 16:06 ` Maxime Coquelin
  1 sibling, 0 replies; 7+ messages in thread
From: Maxime Coquelin @ 2020-04-28 16:06 UTC (permalink / raw)
  To: Roland Qi, dev



On 4/21/20 10:59 AM, Roland Qi wrote:
> In process_slave_message_reply(), there is a
> possibility that receiving a peer close
> message instead of a real message response.
> 
> this patch targeting to handle the peer close
> scenario and report the correct error message.
> 
> Signed-off-by: Roland Qi <roland.qi@ucloud.cn>
> ---
>  lib/librte_vhost/vhost_user.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)

Applied to dpdk-next-virtio/master

Thanks,
Maxime


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

* [dpdk-dev] [PATCH] vhost: fix check peer close
@ 2020-04-21  7:52 Roland Qi
  0 siblings, 0 replies; 7+ messages in thread
From: Roland Qi @ 2020-04-21  7:52 UTC (permalink / raw)
  To: dev; +Cc: maxime.coquelin, qikai

From: qikai <roland.qi@ucloud.cn>

In process_slave_message_reply(), there is a
possibility that receiving a peer close
message instead of a real message response.

this patch targeting to handle the peer close
scenario and report the correct error message.

Signed-off-by: Roland Qi <roland.qi@ucloud.cn>
---
 lib/librte_vhost/vhost_user.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index bd1be0104..971ccdb01 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -2812,11 +2812,19 @@ static int process_slave_message_reply(struct virtio_net *dev,
 	if ((msg->flags & VHOST_USER_NEED_REPLY) == 0)
 		return 0;
 
-	if (read_vhost_message(dev->slave_req_fd, &msg_reply) < 0) {
+	ret = read_vhost_message(dev->slave_req_fd, &msg_reply);
+	if (ret <= 0) {
+		if (ret < 0)
+			VHOST_LOG_CONFIG(ERR,
+				"vhost read slave message reply failed\n");
+		else
+			VHOST_LOG_CONFIG(INFO,
+				"vhost peer closed\n");
 		ret = -1;
 		goto out;
 	}
 
+	ret = 0;
 	if (msg_reply.request.slave != msg->request.slave) {
 		VHOST_LOG_CONFIG(ERR,
 			"Received unexpected msg type (%u), expected %u\n",
-- 
2.23.0.windows.1


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

* Re: [dpdk-dev] [PATCH] vhost: fix check peer close
  2020-04-07  3:45 qikai
@ 2020-04-17 14:10 ` Maxime Coquelin
  0 siblings, 0 replies; 7+ messages in thread
From: Maxime Coquelin @ 2020-04-17 14:10 UTC (permalink / raw)
  To: qikai, dev



On 4/7/20 5:45 AM, qikai wrote:
> In process_slave_message_reply(), there is a
> possibility that receiving a peer close
> message instead of a real message response.
> 
> this patch targeting to handle the peer close
> scenario and report the correct error message.
> 
> Signed-off-by: qikai <roland.qi@ucloud.cn>

Could you please provide you full name to be compliant with
the contribution guidelines?

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


Thanks,
Maxime

> ---
>  lib/librte_vhost/vhost_user.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
> index bd1be0104..971ccdb01 100644
> --- a/lib/librte_vhost/vhost_user.c
> +++ b/lib/librte_vhost/vhost_user.c
> @@ -2812,11 +2812,19 @@ static int process_slave_message_reply(struct virtio_net *dev,
>  	if ((msg->flags & VHOST_USER_NEED_REPLY) == 0)
>  		return 0;
>  
> -	if (read_vhost_message(dev->slave_req_fd, &msg_reply) < 0) {
> +	ret = read_vhost_message(dev->slave_req_fd, &msg_reply);
> +	if (ret <= 0) {
> +		if (ret < 0)
> +			VHOST_LOG_CONFIG(ERR,
> +				"vhost read slave message reply failed\n");
> +		else
> +			VHOST_LOG_CONFIG(INFO,
> +				"vhost peer closed\n");
>  		ret = -1;
>  		goto out;
>  	}
>  
> +	ret = 0;
>  	if (msg_reply.request.slave != msg->request.slave) {
>  		VHOST_LOG_CONFIG(ERR,
>  			"Received unexpected msg type (%u), expected %u\n",
> 


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

* [dpdk-dev] [PATCH] vhost: fix check peer close
@ 2020-04-07  3:45 qikai
  2020-04-17 14:10 ` Maxime Coquelin
  0 siblings, 1 reply; 7+ messages in thread
From: qikai @ 2020-04-07  3:45 UTC (permalink / raw)
  To: dev; +Cc: qikai

In process_slave_message_reply(), there is a
possibility that receiving a peer close
message instead of a real message response.

this patch targeting to handle the peer close
scenario and report the correct error message.

Signed-off-by: qikai <roland.qi@ucloud.cn>
---
 lib/librte_vhost/vhost_user.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index bd1be0104..971ccdb01 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -2812,11 +2812,19 @@ static int process_slave_message_reply(struct virtio_net *dev,
 	if ((msg->flags & VHOST_USER_NEED_REPLY) == 0)
 		return 0;
 
-	if (read_vhost_message(dev->slave_req_fd, &msg_reply) < 0) {
+	ret = read_vhost_message(dev->slave_req_fd, &msg_reply);
+	if (ret <= 0) {
+		if (ret < 0)
+			VHOST_LOG_CONFIG(ERR,
+				"vhost read slave message reply failed\n");
+		else
+			VHOST_LOG_CONFIG(INFO,
+				"vhost peer closed\n");
 		ret = -1;
 		goto out;
 	}
 
+	ret = 0;
 	if (msg_reply.request.slave != msg->request.slave) {
 		VHOST_LOG_CONFIG(ERR,
 			"Received unexpected msg type (%u), expected %u\n",
-- 
2.23.0.windows.1


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

* [dpdk-dev] [PATCH] vhost: fix check peer close
@ 2020-04-03  6:27 qikai
  0 siblings, 0 replies; 7+ messages in thread
From: qikai @ 2020-04-03  6:27 UTC (permalink / raw)
  To: dev; +Cc: qikai

In process_slave_message_reply(), there is a possibility that receiving a peer close message instead of a real message response.

this patch targeting to handle the peer close scenario and report the correct error message.

Signed-off-by: qikai <roland.qi@ucloud.cn>
---
 lib/librte_vhost/vhost_user.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index bd1be0104..971ccdb01 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -2812,11 +2812,19 @@ static int process_slave_message_reply(struct virtio_net *dev,
 	if ((msg->flags & VHOST_USER_NEED_REPLY) == 0)
 		return 0;
 
-	if (read_vhost_message(dev->slave_req_fd, &msg_reply) < 0) {
+	ret = read_vhost_message(dev->slave_req_fd, &msg_reply);
+	if (ret <= 0) {
+		if (ret < 0)
+			VHOST_LOG_CONFIG(ERR,
+				"vhost read slave message reply failed\n");
+		else
+			VHOST_LOG_CONFIG(INFO,
+				"vhost peer closed\n");
 		ret = -1;
 		goto out;
 	}
 
+	ret = 0;
 	if (msg_reply.request.slave != msg->request.slave) {
 		VHOST_LOG_CONFIG(ERR,
 			"Received unexpected msg type (%u), expected %u\n",
-- 
2.23.0.windows.1


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

end of thread, other threads:[~2020-04-28 16:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21  8:59 [dpdk-dev] [PATCH] vhost: fix check peer close Roland Qi
2020-04-27  8:53 ` Maxime Coquelin
2020-04-28 16:06 ` Maxime Coquelin
  -- strict thread matches above, loose matches on Subject: below --
2020-04-21  7:52 Roland Qi
2020-04-07  3:45 qikai
2020-04-17 14:10 ` Maxime Coquelin
2020-04-03  6:27 qikai

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).