From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 730C8A051C
	for <public@inbox.dpdk.org>; Tue, 11 Feb 2020 12:42:26 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 67D141C05C;
	Tue, 11 Feb 2020 12:42:26 +0100 (CET)
Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com
 [209.85.128.67]) by dpdk.org (Postfix) with ESMTP id 8604B1C05C
 for <stable@dpdk.org>; Tue, 11 Feb 2020 12:42:24 +0100 (CET)
Received: by mail-wm1-f67.google.com with SMTP id b17so3156265wmb.0
 for <stable@dpdk.org>; Tue, 11 Feb 2020 03:42:24 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=di44ynmYV5TquURZWpN4tqHMICdfKLKRdY/FHD7Nzp4=;
 b=goj3qED5tFMlQAtIROjWj35HW3JXlZUkTuWJ3wJslzQ/4H/cWtN6AxtVakkt8H9hG8
 E4InDLy3b2S6mkT/6X3+7RtEny4C2lTMNmZIgs4e/BrkEr4y64VhOCoM/LKOAdVH5eWI
 miW2yO7a/6zuiF5zDJC/fsDkcN1XhTiEZiZ8cK+SKrj8xVHxX8KYI234JXqDUIBgHM84
 +FRlxGVQyej1+tRaIlARzwoe4QkP461Dex+ov6DUE2P4FZdNefE22KvtGCwikhQgDFVA
 k16bs53Gm9kizLDiXd7wZvSuGmul0ghYvEKxSkpbPbWqF8++CpZzb9Qdqau7tRONCciY
 C5Lw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=di44ynmYV5TquURZWpN4tqHMICdfKLKRdY/FHD7Nzp4=;
 b=AAG+f6zAeUfHqEvXx2Jj4V/kYXALlY+e1E3S8U/dcrfDeV3j52zimTCkHxCxZUWI4b
 pfdPHyQLfc8bmtIHXvG3HC9ni+U8W3f7iJ5YPBZZlt0QGL2p9k8b8iCRs7RRilamkC4+
 BIK7SQW0mMVnjylvKoV7/j7mU9jvdBc8Ce7EsyHrn9S2ryc3HDe8jJS8TgJHbEx2wbQ3
 sqZ3XMkjXstKd29Y6rEvs2fcWwNQ6AeqM05PMShdwATRcI+yQdz070PYU+/iFWIQ1iTq
 j3peIK6M7R5B1NEgA5feXQEsgRXTsYbRAh5xGQD/JCbTVI+XHCscIDIb0zBRjPG8sraF
 uI9g==
X-Gm-Message-State: APjAAAV9EFhllE1USL4D/syhu8PlGMELK8cFLSaP6RhxiZxB6PgYancT
 qOYI7zTazhDeKdQaelkzDgE=
X-Google-Smtp-Source: APXvYqxzy6a1aI750z31cdIFN76MXWZtZAXBmLR6y6tkybydpjbfBWyE8+DMpMVIWt4XP6eelNw07A==
X-Received: by 2002:a1c:1b4d:: with SMTP id b74mr5314643wmb.33.1581421344263; 
 Tue, 11 Feb 2020 03:42:24 -0800 (PST)
Received: from localhost ([88.98.246.218])
 by smtp.gmail.com with ESMTPSA id u14sm4749203wrm.51.2020.02.11.03.42.23
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 11 Feb 2020 03:42:23 -0800 (PST)
From: luca.boccassi@gmail.com
To: Vitaliy Mysak <vitaliy.mysak@intel.com>
Cc: Tiwei Bie <tiwei.bie@intel.com>,
	dpdk stable <stable@dpdk.org>
Date: Tue, 11 Feb 2020 11:22:03 +0000
Message-Id: <20200211112216.3929-177-luca.boccassi@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200211112216.3929-1-luca.boccassi@gmail.com>
References: <20200211112216.3929-1-luca.boccassi@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-stable] patch 'vhost: do not treat empty socket message as
	error' has been queued to stable release 19.11.1
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

Hi,

FYI, your patch has been queued to stable release 19.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/13/20. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Thanks.

Luca Boccassi

---
>From d4cd6ac99c71a8acc6f0fd0aa43fcd16fc325cb1 Mon Sep 17 00:00:00 2001
From: Vitaliy Mysak <vitaliy.mysak@intel.com>
Date: Thu, 30 Jan 2020 09:05:39 +0100
Subject: [PATCH] vhost: do not treat empty socket message as error

[ upstream commit bedf87c521902d1caeb0974fe9d3344584b849b5 ]

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

Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: Tiwei Bie <tiwei.bie@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 26b9bb5534..c9322707e7 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) {
-		RTE_LOG(ERR, VHOST_CONFIG, "recvmsg failed\n");
+		if (ret)
+			RTE_LOG(ERR, VHOST_CONFIG, "recvmsg failed\n");
 		return ret;
 	}
 
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-02-11 11:17:44.715493262 +0000
+++ 0177-vhost-do-not-treat-empty-socket-message-as-error.patch	2020-02-11 11:17:38.824009275 +0000
@@ -1,8 +1,10 @@
-From bedf87c521902d1caeb0974fe9d3344584b849b5 Mon Sep 17 00:00:00 2001
+From d4cd6ac99c71a8acc6f0fd0aa43fcd16fc325cb1 Mon Sep 17 00:00:00 2001
 From: Vitaliy Mysak <vitaliy.mysak@intel.com>
 Date: Thu, 30 Jan 2020 09:05:39 +0100
 Subject: [PATCH] vhost: do not treat empty socket message as error
 
+[ upstream commit bedf87c521902d1caeb0974fe9d3344584b849b5 ]
+
 According to recvmsg() specification, 0 is a valid
 return code when client is disconnecting.
 Therefore, it should not be reported as error, unless there
@@ -14,7 +16,6 @@
 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>
 Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
@@ -23,16 +24,16 @@
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
-index 85c64485c2..7c80121790 100644
+index 26b9bb5534..c9322707e7 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");
+-		RTE_LOG(ERR, VHOST_CONFIG, "recvmsg failed\n");
 +		if (ret)
-+			VHOST_LOG_CONFIG(ERR, "recvmsg failed\n");
++			RTE_LOG(ERR, VHOST_CONFIG, "recvmsg failed\n");
  		return ret;
  	}