DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] rte_vhost: do not treat empty socket message as error
@ 2020-01-29  9:22 Vitaliy Mysak
  0 siblings, 0 replies; 4+ messages in thread
From: Vitaliy Mysak @ 2020-01-29  9:22 UTC (permalink / raw)
  To: Maxime Coquelin, Tiwei Bie, Zhihong Wang; +Cc: dev, Vitaliy Mysak

According to recvmsg() specification, 0 is a valid
return code when client is disconnecting.
Therefore, it should not be reported as error, unless there
are other dependencies that require message to not be empty.
But there are none, since the next immediate caller of recvmsg()
reports "vhost peer closed" info (not error) when message is empty.

This patch changes return code check for recvmsg() so that
misleading error message is not printed when the code is 0.

Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
---
 lib/librte_vhost/socket.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
index 9740fb340..0cac3ce8e 100644
--- a/lib/librte_vhost/socket.c
+++ b/lib/librte_vhost/socket.c
@@ -127,7 +127,8 @@ read_fd_message(int sockfd, char *buf, int buflen, int *fds, int max_fds,
 
 	ret = recvmsg(sockfd, &msgh, 0);
 	if (ret <= 0) {
-		VHOST_LOG_CONFIG(ERR, "recvmsg failed\n");
+		if (ret)
+			VHOST_LOG_CONFIG(ERR, "recvmsg failed\n");
 		return ret;
 	}
 
-- 
2.17.1

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.


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

* Re: [dpdk-dev] [PATCH] rte_vhost: do not treat empty socket message as error
  2020-01-30  8:05 Vitaliy Mysak
  2020-02-05  5:08 ` Tiwei Bie
@ 2020-02-05  9:47 ` Maxime Coquelin
  1 sibling, 0 replies; 4+ messages in thread
From: Maxime Coquelin @ 2020-02-05  9:47 UTC (permalink / raw)
  To: Vitaliy Mysak, Tiwei Bie, Zhihong Wang; +Cc: dev



On 1/30/20 9:05 AM, Vitaliy Mysak wrote:
> According to recvmsg() specification, 0 is a valid
> return code when client is disconnecting.
> Therefore, it should not be reported as error, unless there
> are other dependencies that require message to not be empty.
> But there are none, since the next immediate caller of recvmsg()
> reports "vhost peer closed" info (not error) when message is empty.
> 
> This patch changes return code check for recvmsg() so that
> misleading error message is not printed when the code is 0.
> 
> Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
> ---
>  lib/librte_vhost/socket.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Applied to dpdk-next-virtio tree.

Thanks,
Maxime


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

* Re: [dpdk-dev] [PATCH] rte_vhost: do not treat empty socket message as error
  2020-01-30  8:05 Vitaliy Mysak
@ 2020-02-05  5:08 ` Tiwei Bie
  2020-02-05  9:47 ` Maxime Coquelin
  1 sibling, 0 replies; 4+ messages in thread
From: Tiwei Bie @ 2020-02-05  5:08 UTC (permalink / raw)
  To: Vitaliy Mysak; +Cc: Maxime Coquelin, Zhihong Wang, dev


[PATCH] rte_vhost: do not treat empty socket message as error

s/rte_vhost:/vhost:/

On Thu, Jan 30, 2020 at 09:05:39AM +0100, Vitaliy Mysak wrote:
> According to recvmsg() specification, 0 is a valid
> return code when client is disconnecting.
> Therefore, it should not be reported as error, unless there
> are other dependencies that require message to not be empty.
> But there are none, since the next immediate caller of recvmsg()
> reports "vhost peer closed" info (not error) when message is empty.
> 
> This patch changes return code check for recvmsg() so that
> misleading error message is not printed when the code is 0.

Fixes: 8f972312b8f4 ("vhost: support vhost-user")
Cc: stable@dpdk.org

> 
> Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
> ---
>  lib/librte_vhost/socket.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>

Thanks,
Tiwei

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

* [dpdk-dev] [PATCH] rte_vhost: do not treat empty socket message as error
@ 2020-01-30  8:05 Vitaliy Mysak
  2020-02-05  5:08 ` Tiwei Bie
  2020-02-05  9:47 ` Maxime Coquelin
  0 siblings, 2 replies; 4+ messages in thread
From: Vitaliy Mysak @ 2020-01-30  8:05 UTC (permalink / raw)
  To: Maxime Coquelin, Tiwei Bie, Zhihong Wang; +Cc: dev, Vitaliy Mysak

According to recvmsg() specification, 0 is a valid
return code when client is disconnecting.
Therefore, it should not be reported as error, unless there
are other dependencies that require message to not be empty.
But there are none, since the next immediate caller of recvmsg()
reports "vhost peer closed" info (not error) when message is empty.

This patch changes return code check for recvmsg() so that
misleading error message is not printed when the code is 0.

Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
---
 lib/librte_vhost/socket.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
index 9740fb340..0cac3ce8e 100644
--- a/lib/librte_vhost/socket.c
+++ b/lib/librte_vhost/socket.c
@@ -127,7 +127,8 @@ read_fd_message(int sockfd, char *buf, int buflen, int *fds, int max_fds,
 
 	ret = recvmsg(sockfd, &msgh, 0);
 	if (ret <= 0) {
-		VHOST_LOG_CONFIG(ERR, "recvmsg failed\n");
+		if (ret)
+			VHOST_LOG_CONFIG(ERR, "recvmsg failed\n");
 		return ret;
 	}
 
-- 
2.17.1


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

end of thread, other threads:[~2020-02-05  9:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-29  9:22 [dpdk-dev] [PATCH] rte_vhost: do not treat empty socket message as error Vitaliy Mysak
2020-01-30  8:05 Vitaliy Mysak
2020-02-05  5:08 ` Tiwei Bie
2020-02-05  9:47 ` Maxime Coquelin

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