From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 50519A0531; Wed, 29 Jan 2020 10:26:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B9F421BFB0; Wed, 29 Jan 2020 10:26:20 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 8FE7F1BFAE for ; Wed, 29 Jan 2020 10:26:18 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jan 2020 01:23:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,377,1574150400"; d="scan'208";a="232361078" Received: from unknown (HELO vmysak-MOBL.ger.corp.intel.com) ([10.237.140.121]) by orsmga006.jf.intel.com with ESMTP; 29 Jan 2020 01:23:45 -0800 From: Vitaliy Mysak To: Maxime Coquelin , Tiwei Bie , Zhihong Wang Cc: dev@dpdk.org, Vitaliy Mysak Date: Wed, 29 Jan 2020 10:22:03 +0100 Message-Id: <20200129092203.6060-1-vitaliy.mysak@intel.com> X-Mailer: git-send-email 2.18.0.windows.1 Subject: [dpdk-dev] [PATCH] rte_vhost: do not treat empty socket message as error X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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.