Skip to content
  • Olaf Hering's avatar
    Drivers: hv: fcopy: restore correct transfer length · 549e658a
    Olaf Hering authored
    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: 'c7e490fc ("Drivers: hv: fcopy: convert to hv_utils_transport")'
    Fixes: '3f2baa8a
    
     ("Tools: hv: update buffer handling in hv_fcopy_daemon")'
    
    Signed-off-by: default avatarOlaf Hering <olaf@aepfle.de>
    Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    549e658a