Re: [PATCH 4.4 035/192] [PATCH 036/135] tools: hv: report ENOSPC errors in hv_fcopy_daemon

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2016-09-12 at 18:59 +0200, Greg Kroah-Hartman wrote:
> 4.4-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> [ Upstream commit b4ed5d1682c6613988c2eb1de55df5ac9988afcc ]
> 
> Currently some "Unspecified error 0x80004005" is reported on the Windows
> side if something fails. Handle the ENOSPC case and return
> ERROR_DISK_FULL, which allows at least Copy-VMFile to report a meaning
> full error.
[...]
> @@ -98,14 +100,26 @@ done:
>  static int hv_copy_data(struct hv_do_fcopy *cpmsg)
>  {
>  	ssize_t bytes_written;
> +	int ret = 0;
>  
>  	bytes_written = pwrite(target_fd, cpmsg->data, cpmsg->size,
>  				cpmsg->offset);
>  
> -	if (bytes_written != cpmsg->size)
> -		return HV_E_FAIL;
> +	filesize += cpmsg->size;
> +	if (bytes_written != cpmsg->size) {
> +		switch (errno) {
[...]

If pwrite() returns a non-negative value less than the requested size,
errno is undefined.  You need to keep trying to write the remaining
bytes until it returns -1.

Ben.

-- 
Ben Hutchings
Software Developer, Codethink Ltd.


--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]