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

Max Reitz posted 2 patches 7 years, 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180228131315.30194-1-mreitz@redhat.com
Test checkpatch passed
Test docker-build@min-glib passed
Test docker-mingw@fedora passed
Test docker-quick@centos6 passed
Test ppcbe passed
Test ppcle passed
Test s390x passed
block/file-posix.c         |  5 +++--
tests/qemu-iotests/106     | 24 ++++++++++++++++++++++++
tests/qemu-iotests/106.out | 10 ++++++++++
3 files changed, 37 insertions(+), 2 deletions(-)
[Qemu-devel] [PATCH 0/2] block/file-posix: Fix fully preallocated truncate
Posted by Max Reitz 7 years, 7 months ago
Fully preallocated truncation has a 50 % chance of working on images
files over file-posix.  It works if $SIZE % 4G < 2G, and it fails
otherwise.  To make things even more interesting, often you would not
even notice because qemu reported success even though it did nothing
(because after the successful lseek(), errno was still 0, so when the
file-posix driver tried to return a negative error code, it actually
reported success).

This issue is fixed by patch 1 in this series.  Thanks to Daniel for
reporting!


Max Reitz (2):
  block/file-posix: Fix fully preallocated truncate
  iotests: Test preallocated truncate of 2G image

 block/file-posix.c         |  5 +++--
 tests/qemu-iotests/106     | 24 ++++++++++++++++++++++++
 tests/qemu-iotests/106.out | 10 ++++++++++
 3 files changed, 37 insertions(+), 2 deletions(-)

-- 
2.14.3


Re: [Qemu-devel] [PATCH 0/2] block/file-posix: Fix fully preallocated truncate
Posted by Eric Blake 7 years, 7 months ago
On 02/28/2018 07:13 AM, Max Reitz wrote:
> Fully preallocated truncation has a 50 % chance of working on images
> files over file-posix.  It works if $SIZE % 4G < 2G, and it fails
> otherwise.  To make things even more interesting, often you would not
> even notice because qemu reported success even though it did nothing
> (because after the successful lseek(), errno was still 0, so when the
> file-posix driver tried to return a negative error code, it actually
> reported success).
> 
> This issue is fixed by patch 1 in this series.  Thanks to Daniel for
> reporting!
> 
> 
> Max Reitz (2):
>    block/file-posix: Fix fully preallocated truncate
>    iotests: Test preallocated truncate of 2G image

Good catch.  Series:
Reviewed-by: Eric Blake <eblake@redhat.com>

gluster.c has similar code, but it assigns glfs_lseek() to an int64_t, 
so it does not have the bug.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Re: [Qemu-devel] [PATCH 0/2] block/file-posix: Fix fully preallocated truncate
Posted by Max Reitz 7 years, 6 months ago
On 2018-02-28 14:13, Max Reitz wrote:
> Fully preallocated truncation has a 50 % chance of working on images
> files over file-posix.  It works if $SIZE % 4G < 2G, and it fails
> otherwise.  To make things even more interesting, often you would not
> even notice because qemu reported success even though it did nothing
> (because after the successful lseek(), errno was still 0, so when the
> file-posix driver tried to return a negative error code, it actually
> reported success).
> 
> This issue is fixed by patch 1 in this series.  Thanks to Daniel for
> reporting!
> 
> 
> Max Reitz (2):
>   block/file-posix: Fix fully preallocated truncate
>   iotests: Test preallocated truncate of 2G image
> 
>  block/file-posix.c         |  5 +++--
>  tests/qemu-iotests/106     | 24 ++++++++++++++++++++++++
>  tests/qemu-iotests/106.out | 10 ++++++++++
>  3 files changed, 37 insertions(+), 2 deletions(-)

Applied to my block tree...  (*cough* *cough* -- I'm the worst when it
comes to keeping track of my own patches.)

Max