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


Groups > linux.kernel > #1729911

[PATCH 3/5] Drivers: hv: fcopy: restore correct transfer length

From kys@exchange.microsoft.com
Newsgroups linux.kernel
Subject [PATCH 3/5] Drivers: hv: fcopy: restore correct transfer length
Date 2017-09-10 08:20 +0200
Message-ID <uo3L4-89U-3@gated-at.bofh.it> (permalink)
References <uo3rJ-7MG-15@gated-at.bofh.it> <uo3L4-89U-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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: 'commit c7e490fc23eb ("Drivers: hv: fcopy: convert to hv_utils_transport")'
Fixes: 'commit 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>
---
 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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] Drivers: hv: Miscellaneous fixes  kys@exchange.microsoft.com - 2017-09-10 08:00 +0200
  [PATCH 3/5] Drivers: hv: fcopy: restore correct transfer length kys@exchange.microsoft.com - 2017-09-10 08:20 +0200
  [PATCH 2/5] vmbus: suppress uevents for hv_sock devices kys@exchange.microsoft.com - 2017-09-10 08:20 +0200
    Re: [PATCH 2/5] vmbus: suppress uevents for hv_sock devices Greg KH <gregkh@linuxfoundation.org> - 2017-09-10 11:30 +0200
      RE: [PATCH 2/5] vmbus: suppress uevents for hv_sock devices KY Srinivasan <kys@microsoft.com> - 2017-09-18 02:10 +0200
  [PATCH 4/5] vmbus: add per-channel sysfs info kys@exchange.microsoft.com - 2017-09-10 08:20 +0200
  [PATCH 1/5] vmbus: don't acquire the mutex in vmbus_hvsock_device_unregister() kys@exchange.microsoft.com - 2017-09-10 08:20 +0200
    [PATCH 5/5] Drivers: hv: vmbus: Expose per-channel event counters  kys@exchange.microsoft.com - 2017-09-10 08:20 +0200

csiph-web