From: Vitaliy Mysak <vitaliy.mysak@intel.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
Tiwei Bie <tiwei.bie@intel.com>,
Zhihong Wang <zhihong.wang@intel.com>
Cc: dev@dpdk.org, Vitaliy Mysak <vitaliy.mysak@intel.com>
Subject: [dpdk-dev] [PATCH] rte_vhost: do not treat empty socket message as error
Date: Thu, 30 Jan 2020 09:05:39 +0100 [thread overview]
Message-ID: <20200130080540.7616-1-vitaliy.mysak@intel.com> (raw)
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
next reply other threads:[~2020-01-30 8:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-30 8:05 Vitaliy Mysak [this message]
2020-02-05 5:08 ` Tiwei Bie
2020-02-05 9:47 ` Maxime Coquelin
-- strict thread matches above, loose matches on Subject: below --
2020-01-29 9:22 Vitaliy Mysak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200130080540.7616-1-vitaliy.mysak@intel.com \
--to=vitaliy.mysak@intel.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
--cc=tiwei.bie@intel.com \
--cc=zhihong.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).