Blame SOURCES/0001-bus-vmbus-fix-race-in-subchannel-creation.patch

aed176
From 25363eb99bc43443bec354abea1e40db61280b30 Mon Sep 17 00:00:00 2001
aed176
From: Stephen Hemminger <sthemmin@microsoft.com>
aed176
Date: Wed, 5 Dec 2018 14:11:56 -0800
aed176
Subject: [PATCH 1/3] bus/vmbus: fix race in subchannel creation
aed176
aed176
[ upstream commit 4970103e89f4f828669acf3b465e984fdc891e1e ]
aed176
aed176
When using multiple queues, there was a race with the kernel
aed176
in setting up the second channel. This regression is due to a kernel change
aed176
which does not allow accessing sysfs files for Hyper-V channels that are not opened.
aed176
aed176
The fix is simple, just move the logic to detect not ready
aed176
sub channels earlier in the existing loop.
aed176
aed176
Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support")
aed176
aed176
Reported-by: Mohammed Gamal <mgamal@redhat.com>
aed176
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
aed176
(cherry picked from commit ca17e6624251b05cf188997cffc3e1ab2e50561a)
aed176
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
aed176
---
aed176
 drivers/bus/vmbus/linux/vmbus_uio.c | 12 ++++++------
aed176
 1 file changed, 6 insertions(+), 6 deletions(-)
aed176
aed176
diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c
aed176
index 12e97e3a4..38df4d724 100644
aed176
--- a/drivers/bus/vmbus/linux/vmbus_uio.c
aed176
+++ b/drivers/bus/vmbus/linux/vmbus_uio.c
aed176
@@ -357,6 +357,12 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary,
aed176
 			continue;
aed176
 		}
aed176
 
aed176
+		if (!vmbus_isnew_subchannel(primary, relid))
aed176
+			continue;	/* Already know about you */
aed176
+
aed176
+		if (!vmbus_uio_ring_present(dev, relid))
aed176
+			continue;	/* Ring may not be ready yet */
aed176
+
aed176
 		snprintf(subchan_path, sizeof(subchan_path), "%s/%lu",
aed176
 			 chan_path, relid);
aed176
 		err = vmbus_uio_sysfs_read(subchan_path, "subchannel_id",
aed176
@@ -370,12 +376,6 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary,
aed176
 		if (subid == 0)
aed176
 			continue;	/* skip primary channel */
aed176
 
aed176
-		if (!vmbus_isnew_subchannel(primary, relid))
aed176
-			continue;
aed176
-
aed176
-		if (!vmbus_uio_ring_present(dev, relid))
aed176
-			continue;	/* Ring may not be ready yet */
aed176
-
aed176
 		err = vmbus_uio_sysfs_read(subchan_path, "monitor_id",
aed176
 					   &monid, UINT8_MAX);
aed176
 		if (err) {
aed176
-- 
aed176
2.20.1
aed176