kernel: Update 4.12.x to latest VMBus/Hyper-V socket patches

Notie, the instructions added in: https://github.com/Microsoft/opengcs/pull/147
add a commit to revert another patch in this series. Instead of applying
c15d7f606f8 ("Revert "vmbus: destroy a hv_sock device only after the RESCIND_OFFER
is received"") we simply drop the orginal commit e37da6e7a52ea6 ("vmbus: destroy a
hv_sock device only after the RESCIND_OFFER is received") from our list.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
Rolf Neugebauer 2017-09-25 11:36:46 +01:00
parent c8f5d16a25
commit e75289e4e1
4 changed files with 88 additions and 51 deletions

View File

@ -1,49 +0,0 @@
From 9c999c9259ee29bbd2ed49c81465ea460ff4ea3a Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Tue, 29 Aug 2017 14:23:39 -0700
Subject: [PATCH 16/18] vmbus: destroy a hv_sock device only after the
RESCIND_OFFER is received
It looks the host/guest interactive protocol for hv_sock has been changed
since Windows Server TP5, and now Linux VM should only destroy the channel
after the host agrees: the host always sends a RESCIND_OFFER message to the
VM for this).
Without the patch, the host's recv() can return -1 when Linux closes a
hv_sock connection, and as a result, the host app can potentially lose the
last portion of the data transferred through the hv_sock connection.
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Origin: git@github.com:dcui/linux.git
(cherry picked from commit d6f7158fdbac10f9935a506451e3d54d2d50a7c7)
---
drivers/hv/channel_mgmt.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index a12b1eabc15e..83d4292e4351 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -905,6 +905,9 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr)
if (channel->device_obj) {
if (channel->chn_rescind_callback) {
channel->chn_rescind_callback(channel);
+
+ vmbus_device_unregister(channel->device_obj);
+
return;
}
/*
@@ -955,9 +958,6 @@ void vmbus_hvsock_device_unregister(struct vmbus_channel *channel)
vmbus_connection.work_queue_rescind, &work);
flush_work(&work);
- channel->rescind = true;
- vmbus_device_unregister(channel->device_obj);
-
/* Unblock the rescind handling */
atomic_dec(&vmbus_connection.offer_in_progress);
}
--
2.14.1

View File

@ -0,0 +1,86 @@
From 5dc143f0f2a3cc5f4d9f2d3a9b89e190dcdb7230 Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Tue, 19 Sep 2017 20:05:31 -0700
Subject: [PATCH 16/18] vmbus: hvsock: add proper sync for
vmbus_hvsock_device_unregister()
Without the patch, vmbus_hvsock_device_unregister() can destroy the device
prematurely.
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Origin: git@github.com:dcui/linux.git
(cherry picked from commit b6ffb4393fb266711b37ed056487665d8650f31a)
---
drivers/hv/channel_mgmt.c | 20 ++++++--------------
include/linux/hyperv.h | 2 ++
2 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index a12b1eabc15e..1c20d6afae59 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -559,6 +559,8 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
newchannel->device_obj = device_obj;
atomic_dec(&vmbus_connection.register_in_progress);
+ newchannel->probe_done = true;
+
return;
err_deq_chan:
@@ -905,6 +907,8 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr)
if (channel->device_obj) {
if (channel->chn_rescind_callback) {
channel->chn_rescind_callback(channel);
+ channel->rescind_done = true;
+
return;
}
/*
@@ -938,28 +942,16 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr)
}
}
-static void vmbus_stop_rescind_handling_work(struct work_struct *work)
-{
- atomic_inc(&vmbus_connection.offer_in_progress);
-}
-
void vmbus_hvsock_device_unregister(struct vmbus_channel *channel)
{
struct work_struct work;
BUG_ON(!is_hvsock_channel(channel));
- /* Prevent chn_rescind_callback from running in the rescind path */
- INIT_WORK(&work, vmbus_stop_rescind_handling_work);
- queue_work_on(vmbus_connection.connect_cpu,
- vmbus_connection.work_queue_rescind, &work);
- flush_work(&work);
+ while (!READ_ONCE(channel->probe_done) || !READ_ONCE(channel->rescind_done))
+ msleep(1);
- channel->rescind = true;
vmbus_device_unregister(channel->device_obj);
-
- /* Unblock the rescind handling */
- atomic_dec(&vmbus_connection.offer_in_progress);
}
EXPORT_SYMBOL_GPL(vmbus_hvsock_device_unregister);
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 511d47e3ee9d..5676f2a16531 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -896,6 +896,8 @@ struct vmbus_channel {
*/
enum hv_numa_policy affinity_policy;
+ bool probe_done;
+ bool rescind_done;
};
static inline bool is_hvsock_channel(const struct vmbus_channel *c)
--
2.14.1

View File

@ -1,4 +1,4 @@
From 40e4b5cacba06f888591fe81faac1dd4b3b4413c Mon Sep 17 00:00:00 2001
From 33f5b46c4e0e21b17a41dcfd181c95d9997b4436 Mon Sep 17 00:00:00 2001
From: Randy Dodgen <dodgen@google.com>
Date: Thu, 24 Aug 2017 15:26:01 -0400
Subject: [PATCH 17/18] ext4: fix fault handling when mounted with -o dax,ro

View File

@ -1,4 +1,4 @@
From e4e680592a9006069ae93b8d11b281d652152995 Mon Sep 17 00:00:00 2001
From 00c4be87968d1009795872f1fed2f854deabbeff Mon Sep 17 00:00:00 2001
From: Cheng-mean Liu <soccerl@microsoft.com>
Date: Tue, 11 Jul 2017 16:58:26 -0700
Subject: [PATCH 18/18] NVDIMM: reducded ND_MIN_NAMESPACE_SIZE from 4MB to 4KB