Re: [Qemu-devel] [PATCH 1/2] block/file-posix: Fix fully preallocated truncate

2018-02-28 Thread Eric Blake
On 02/28/2018 07:53 AM, Daniel P. Berrangé wrote: @@ -1711,8 +1712,8 @@ static int raw_regular_truncate(int fd, int64_t offset, PreallocMode prealloc, buf = g_malloc0(65536); -result = lseek(fd, current_length, SEEK_SET); -if (result < 0) { +seek_result

Re: [Qemu-devel] [PATCH 1/2] block/file-posix: Fix fully preallocated truncate

2018-02-28 Thread Daniel P . Berrangé
On Wed, Feb 28, 2018 at 02:55:22PM +0100, Max Reitz wrote: > On 2018-02-28 14:53, Daniel P. Berrangé wrote: > > On Wed, Feb 28, 2018 at 02:45:49PM +0100, Max Reitz wrote: > >> On 2018-02-28 14:34, Daniel P. Berrangé wrote: > >>> On Wed, Feb 28, 2018 at 02:13:14PM +0100, Max Reitz wrote: > Stor

Re: [Qemu-devel] [PATCH 1/2] block/file-posix: Fix fully preallocated truncate

2018-02-28 Thread Daniel P . Berrangé
On Wed, Feb 28, 2018 at 02:13:14PM +0100, Max Reitz wrote: > Storing the lseek() result in an int results in it overflowing when the > file is at least 2 GB big. Then, we have a 50 % chance of the result > being "negative" and thus thinking an error occurred when actually > everything went just fi

Re: [Qemu-devel] [PATCH 1/2] block/file-posix: Fix fully preallocated truncate

2018-02-28 Thread Max Reitz
On 2018-02-28 14:53, Daniel P. Berrangé wrote: > On Wed, Feb 28, 2018 at 02:45:49PM +0100, Max Reitz wrote: >> On 2018-02-28 14:34, Daniel P. Berrangé wrote: >>> On Wed, Feb 28, 2018 at 02:13:14PM +0100, Max Reitz wrote: Storing the lseek() result in an int results in it overflowing when the >

Re: [Qemu-devel] [PATCH 1/2] block/file-posix: Fix fully preallocated truncate

2018-02-28 Thread Daniel P . Berrangé
On Wed, Feb 28, 2018 at 02:45:49PM +0100, Max Reitz wrote: > On 2018-02-28 14:34, Daniel P. Berrangé wrote: > > On Wed, Feb 28, 2018 at 02:13:14PM +0100, Max Reitz wrote: > >> Storing the lseek() result in an int results in it overflowing when the > >> file is at least 2 GB big. Then, we have a 50

Re: [Qemu-devel] [PATCH 1/2] block/file-posix: Fix fully preallocated truncate

2018-02-28 Thread Max Reitz
On 2018-02-28 14:34, Daniel P. Berrangé wrote: > On Wed, Feb 28, 2018 at 02:13:14PM +0100, Max Reitz wrote: >> Storing the lseek() result in an int results in it overflowing when the >> file is at least 2 GB big. Then, we have a 50 % chance of the result >> being "negative" and thus thinking an er

Re: [Qemu-devel] [PATCH 1/2] block/file-posix: Fix fully preallocated truncate

2018-02-28 Thread Daniel P . Berrangé
On Wed, Feb 28, 2018 at 02:13:14PM +0100, Max Reitz wrote: > Storing the lseek() result in an int results in it overflowing when the > file is at least 2 GB big. Then, we have a 50 % chance of the result > being "negative" and thus thinking an error occurred when actually > everything went just fi