Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751167AbdIJGJ6 (ORCPT ); Sun, 10 Sep 2017 02:09:58 -0400 Received: from a2nlsmtp01-05.prod.iad2.secureserver.net ([198.71.225.49]:44390 "EHLO a2nlsmtp01-05.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751087AbdIJGJz (ORCPT ); Sun, 10 Sep 2017 02:09:55 -0400 x-originating-ip: 107.180.71.197 From: kys@exchange.microsoft.com To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com, leann.ogasawara@canonical.com, marcelo.cerri@canonical.com, sthemmin@microsoft.com Cc: "K . Y . Srinivasan" Subject: [PATCH 3/5] Drivers: hv: fcopy: restore correct transfer length Date: Sat, 9 Sep 2017 23:08:47 -0700 Message-Id: <20170910060849.31898-3-kys@exchange.microsoft.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170910060849.31898-1-kys@exchange.microsoft.com> References: <20170910055318.31655-1-kys@exchange.microsoft.com> <20170910060849.31898-1-kys@exchange.microsoft.com> Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfIhQlSqd2EBQ+sdebqDnhB5tjQKh0ivzC2HNAtSa1lTdubPzSDGOYbseEwEZ9s/IqzYezj5taOQJB7tAl1iu0D60I9kU/o7Jg5LUntDdVBB1yEP/hKG2 iqacpJLuHheL7FUl3Jt6JzbTU3YFsn8bTD1HNrD9zNoR7pX8jhUb/qf/upODblNIOdDAN9qAXOxJY0pHM3R5n4SakckMlF9rRYLl10TEOXhGSpPO5no+ljBG Uhx2ygRO2UJzdPh0UYX0Kqv7eUXvmAVsGnF92o8uF7Ea9xGIuZP1+sjv95A5JRHFC/VWt2sYDcy5s2l2KAhv8WW+zk95d2UA+qijVPMIjQUp7AMaTc547QBa JeR+7p4bTIPcueOYudfXWFhk2pwB3f6NuiInM31SUZnkMmxmtwy4idaPumb1cxI4ws5mARp9G7bvywTJuLyUf8lERyLIQsH/22SJ+Bf1yoYKC3NalipZuadv wPYOsKNBA19xkTU/0BasAECHgqJkBHWr6sRgxGxcAge75+vXBT4fqCkXU0QOhYP1lNZOnFnSRX4qTtGR Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1815 Lines: 47 From: Olaf Hering 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 Signed-off-by: K. Y. Srinivasan --- 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