Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751648AbdIRDzY (ORCPT ); Sun, 17 Sep 2017 23:55:24 -0400 Received: from a2nlsmtp01-05.prod.iad2.secureserver.net ([198.71.225.49]:36450 "EHLO a2nlsmtp01-05.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751343AbdIRDzW (ORCPT ); Sun, 17 Sep 2017 23:55:22 -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 V2 2/4] Drivers: hv: fcopy: restore correct transfer length Date: Sun, 17 Sep 2017 20:54:17 -0700 Message-Id: <20170918035419.11062-2-kys@exchange.microsoft.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170918035419.11062-1-kys@exchange.microsoft.com> References: <20170918034955.10913-1-kys@exchange.microsoft.com> <20170918035419.11062-1-kys@exchange.microsoft.com> Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfGRgUMq8HrqUV6QHfygc25oglHE30+lgwlpD8Mq8cpY2STb4ER5zJRMW8uPRuJz1/mCmDdfWxWVfIgbH/vki/Ic7NWhVAgcw3NCgS7P3+/h6rA+DXPcg EOTeWjmvK6300w1APUJPte6DdKL2mjPcV39rAwFkD1N11tSWUFplGD0InoxGy+mWYRXOLqTdewNrzHEgeFIL0HbWsFy2yg0UHt7oX5s4tWkBQC/LUeKiej2n p2a0zCkwnrkSuOpBrcZ9EqTKh+pp+h1hKfQGRAO56riSSNJOOXOj6jZpQrKxC9rK+3BuNjCOB5bDgEvyz5QQ/UL6LgrR9VdAvrIzmm6UbBfQ1flpvMizZgIi e/vjlLwaQx2nVlzzFErD/I8pUHpmY4l5cBn3XaWJ71vYVt2+6sfIz0w1374pMK2W4WB8qlGZcJdoYQxt4XtFPL8NvStwdwvKK5O5ku9TiWMbFzDd9A3L3VT4 wOrPjZ6KdRgnw65A3cPvzZXMF2l5CqnzET15n+0wp/vRypWcFE2Eu8hGQdnJ4xZdKxVYb/KtBfAiUPkv 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