Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1737214 > unrolled thread

[PATCH 0/2] Drivers: hv: Miscellaneous fixes

Started bykys@exchange.microsoft.com
First post2017-09-22 08:50 +0200
Last post2017-09-22 08:50 +0200
Articles 3 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2] Drivers: hv: Miscellaneous fixes  kys@exchange.microsoft.com - 2017-09-22 08:50 +0200
    [PATCH 2/2] Drivers: hv: fcopy: restore correct transfer length kys@exchange.microsoft.com - 2017-09-22 08:50 +0200
    [PATCH 1/2] vmbus: don't acquire the mutex in vmbus_hvsock_device_unregister() kys@exchange.microsoft.com - 2017-09-22 08:50 +0200

#1737214 — [PATCH 0/2] Drivers: hv: Miscellaneous fixes

Fromkys@exchange.microsoft.com
Date2017-09-22 08:50 +0200
Subject[PATCH 0/2] Drivers: hv: Miscellaneous fixes
Message-ID<uspWF-2Qj-9@gated-at.bofh.it>
From: "K. Y. Srinivasan" <kys@microsoft.com>

Miscellaneous fixes. Greg, please apply these to 4.14-final.

Dexuan Cui (1):
  vmbus: don't acquire the mutex in vmbus_hvsock_device_unregister()

Olaf Hering (1):
  Drivers: hv: fcopy: restore correct transfer length

 drivers/hv/channel_mgmt.c | 4 ----
 drivers/hv/hv_fcopy.c     | 4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.14.1

[toc] | [next] | [standalone]


#1737215 — [PATCH 2/2] Drivers: hv: fcopy: restore correct transfer length

Fromkys@exchange.microsoft.com
Date2017-09-22 08:50 +0200
Subject[PATCH 2/2] Drivers: hv: fcopy: restore correct transfer length
Message-ID<uspWF-2Qj-7@gated-at.bofh.it>
In reply to#1737214
From: Olaf Hering <olaf@aepfle.de>

Till recently the expected length of bytes read by the
daemon did depend on the context. It was either hv_start_fcopy or
hv_do_fcopy. The daemon had a buffer size of two pages, which was much
larger than needed.

Now the expected length of bytes read by the
daemon changed slightly. For START_FILE_COPY it is still the size of
hv_start_fcopy.  But for WRITE_TO_FILE and the other operations it is as
large as the buffer that arrived via vmbus. In case of WRITE_TO_FILE
that is slightly larger than a struct hv_do_fcopy. Since the buffer in
the daemon was still larger everything was fine.

Currently, the daemon reads only what is actually needed.
The new buffer layout is as large as a struct hv_do_fcopy, for the
WRITE_TO_FILE operation. Since the kernel expects a slightly larger
size, hvt_op_read will return -EINVAL because the daemon will read
slightly less than expected. Address this by restoring the expected
buffer size in case of WRITE_TO_FILE.

Fixes: 'c7e490fc23eb ("Drivers: hv: fcopy: convert to hv_utils_transport")'
Fixes: '3f2baa8a7d2e ("Tools: hv: update buffer handling in hv_fcopy_daemon")'

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Cc: stable@vger.kernel.org
---
 drivers/hv/hv_fcopy.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/hv/hv_fcopy.c b/drivers/hv/hv_fcopy.c
index daa75bd41f86..2364281d8593 100644
--- a/drivers/hv/hv_fcopy.c
+++ b/drivers/hv/hv_fcopy.c
@@ -170,6 +170,10 @@ static void fcopy_send_data(struct work_struct *dummy)
 		out_src = smsg_out;
 		break;
 
+	case WRITE_TO_FILE:
+		out_src = fcopy_transaction.fcopy_msg;
+		out_len = sizeof(struct hv_do_fcopy);
+		break;
 	default:
 		out_src = fcopy_transaction.fcopy_msg;
 		out_len = fcopy_transaction.recv_len;
-- 
2.14.1

[toc] | [prev] | [next] | [standalone]


#1737217 — [PATCH 1/2] vmbus: don't acquire the mutex in vmbus_hvsock_device_unregister()

Fromkys@exchange.microsoft.com
Date2017-09-22 08:50 +0200
Subject[PATCH 1/2] vmbus: don't acquire the mutex in vmbus_hvsock_device_unregister()
Message-ID<uspWF-2Qj-11@gated-at.bofh.it>
In reply to#1737214
From: Dexuan Cui <decui@microsoft.com>

Due to commit 54a66265d675 ("Drivers: hv: vmbus: Fix rescind handling"),
we need this patch to resolve the below deadlock:

after we get the mutex in vmbus_hvsock_device_unregister() and call
vmbus_device_unregister() -> device_unregister() -> ... -> device_release()
-> vmbus_device_release(), we'll get a deadlock, because
vmbus_device_release() tries to get the same mutex.

Signed-off-by: Dexuan Cui <decui@microsoft.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Cc: stable@vger.kernel.org (4.13 and above)
---
 drivers/hv/channel_mgmt.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 968af173c4c1..624d815745e4 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -945,14 +945,10 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr)
 
 void vmbus_hvsock_device_unregister(struct vmbus_channel *channel)
 {
-	mutex_lock(&vmbus_connection.channel_mutex);
-
 	BUG_ON(!is_hvsock_channel(channel));
 
 	channel->rescind = true;
 	vmbus_device_unregister(channel->device_obj);
-
-	mutex_unlock(&vmbus_connection.channel_mutex);
 }
 EXPORT_SYMBOL_GPL(vmbus_hvsock_device_unregister);
 
-- 
2.14.1

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web