Skip to content

Commit 549e658

Browse files
olafheringgregkh
authored andcommitted
Drivers: hv: fcopy: restore correct transfer length
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 <[email protected]> Signed-off-by: K. Y. Srinivasan <[email protected]> Cc: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 33c150c commit 549e658

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/hv/hv_fcopy.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ static void fcopy_send_data(struct work_struct *dummy)
170170
out_src = smsg_out;
171171
break;
172172

173+
case WRITE_TO_FILE:
174+
out_src = fcopy_transaction.fcopy_msg;
175+
out_len = sizeof(struct hv_do_fcopy);
176+
break;
173177
default:
174178
out_src = fcopy_transaction.fcopy_msg;
175179
out_len = fcopy_transaction.recv_len;

0 commit comments

Comments
 (0)