[PATCH 0/9] More truncate improvements

Eric Blake posted 9 patches 4 years ago
Test docker-mingw@fedora failed
Test docker-quick@centos7 failed
Test checkpatch passed
Test FreeBSD passed
Test asan passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200428202905.770727-1-eblake@redhat.com
Maintainers: Peter Lieven <pl@kamp.de>, "Denis V. Lunev" <den@openvz.org>, Stefan Weil <sw@weilnetz.de>, Jason Dillaman <dillaman@redhat.com>, Max Reitz <mreitz@redhat.com>, Jeff Cody <codyprime@gmail.com>, Kevin Wolf <kwolf@redhat.com>, Liu Yuan <namei.unix@gmail.com>, "Richard W.M. Jones" <rjones@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>
include/block/block.h     |  1 -
include/block/block_int.h |  7 ---
block.c                   | 21 ---------
block/file-posix.c        |  1 -
block/file-win32.c        |  4 +-
block/gluster.c           | 14 ------
block/nfs.c               |  4 +-
block/parallels.c         | 23 ++++++----
block/qcow2.c             |  1 -
block/qed.c               |  1 -
block/raw-format.c        |  6 ---
block/rbd.c               |  4 +-
block/sheepdog.c          |  4 +-
block/ssh.c               |  5 ++-
block/vhdx.c              | 89 ++++++++++++++++++++++-----------------
15 files changed, 80 insertions(+), 105 deletions(-)
[PATCH 0/9] More truncate improvements
Posted by Eric Blake 4 years ago
Based-on: <20200424125448.63318-1-kwolf@redhat.com>
[PATCH v7 00/10] block: Fix resize (extending) of short overlays

After reviewing Kevin's work, I questioned if we had a redundancy with
bdrv_has_zero_init_truncate.  It turns out we do, and this is the result.

Patch 1 has been previously posted [1] and reviewed, the rest is new.
I did not address Neils' comment that modern gluster also always
0-initializes [2], as I am not set up to verify it (my changes to the
other drivers are semantic no-ops, so I don't feel as bad about
posting them with less rigourous testing).

[1] https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg08070.html
[2] https://lists.gnu.org/archive/html/qemu-devel/2020-02/msg04266.html

Eric Blake (9):
  gluster: Drop useless has_zero_init callback
  file-win32: Support BDRV_REQ_ZERO_WRITE for truncate
  nfs: Support BDRV_REQ_ZERO_WRITE for truncate
  rbd: Support BDRV_REQ_ZERO_WRITE for truncate
  sheepdog: Support BDRV_REQ_ZERO_WRITE for truncate
  ssh: Support BDRV_REQ_ZERO_WRITE for truncate
  parallels: Rework truncation logic
  vhdx: Rework truncation logic
  block: Drop unused .bdrv_has_zero_init_truncate

 include/block/block.h     |  1 -
 include/block/block_int.h |  7 ---
 block.c                   | 21 ---------
 block/file-posix.c        |  1 -
 block/file-win32.c        |  4 +-
 block/gluster.c           | 14 ------
 block/nfs.c               |  4 +-
 block/parallels.c         | 23 ++++++----
 block/qcow2.c             |  1 -
 block/qed.c               |  1 -
 block/raw-format.c        |  6 ---
 block/rbd.c               |  4 +-
 block/sheepdog.c          |  4 +-
 block/ssh.c               |  5 ++-
 block/vhdx.c              | 89 ++++++++++++++++++++++-----------------
 15 files changed, 80 insertions(+), 105 deletions(-)

-- 
2.26.2


Re: [PATCH 0/9] More truncate improvements
Posted by Kevin Wolf 3 years, 12 months ago
Am 28.04.2020 um 22:28 hat Eric Blake geschrieben:
> Based-on: <20200424125448.63318-1-kwolf@redhat.com>
> [PATCH v7 00/10] block: Fix resize (extending) of short overlays
> 
> After reviewing Kevin's work, I questioned if we had a redundancy with
> bdrv_has_zero_init_truncate.  It turns out we do, and this is the result.
> 
> Patch 1 has been previously posted [1] and reviewed, the rest is new.
> I did not address Neils' comment that modern gluster also always
> 0-initializes [2], as I am not set up to verify it (my changes to the
> other drivers are semantic no-ops, so I don't feel as bad about
> posting them with less rigourous testing).
> 
> [1] https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg08070.html
> [2] https://lists.gnu.org/archive/html/qemu-devel/2020-02/msg04266.html

block/parallels.c: In function 'parallels_co_writev':
block/parallels.c:218:12: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  218 |         if (ret < 0) {
      |            ^
block/parallels.c:169:9: note: 'ret' was declared here
  169 |     int ret;
      |         ^~~
cc1: all warnings being treated as errors

Apart from that, you can add:

Reviewed-by: Kevin Wolf <kwolf@redhat.com>


Re: [PATCH 0/9] More truncate improvements
Posted by Eric Blake 3 years, 12 months ago
On 5/7/20 5:15 AM, Kevin Wolf wrote:
> Am 28.04.2020 um 22:28 hat Eric Blake geschrieben:
>> Based-on: <20200424125448.63318-1-kwolf@redhat.com>
>> [PATCH v7 00/10] block: Fix resize (extending) of short overlays
>>
>> After reviewing Kevin's work, I questioned if we had a redundancy with
>> bdrv_has_zero_init_truncate.  It turns out we do, and this is the result.
>>
>> Patch 1 has been previously posted [1] and reviewed, the rest is new.
>> I did not address Neils' comment that modern gluster also always
>> 0-initializes [2], as I am not set up to verify it (my changes to the
>> other drivers are semantic no-ops, so I don't feel as bad about
>> posting them with less rigourous testing).
>>
>> [1] https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg08070.html
>> [2] https://lists.gnu.org/archive/html/qemu-devel/2020-02/msg04266.html
> 
> block/parallels.c: In function 'parallels_co_writev':
> block/parallels.c:218:12: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>    218 |         if (ret < 0) {
>        |            ^
> block/parallels.c:169:9: note: 'ret' was declared here
>    169 |     int ret;
>        |         ^~~
> cc1: all warnings being treated as errors

Yep, fixup posted here:
https://lists.gnu.org/archive/html/qemu-devel/2020-04/msg05199.html

> 
> Apart from that, you can add:
> 
> Reviewed-by: Kevin Wolf <kwolf@redhat.com>

Do you need me to send a v2?

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


Re: [PATCH 0/9] More truncate improvements
Posted by Kevin Wolf 3 years, 12 months ago
Am 07.05.2020 um 16:29 hat Eric Blake geschrieben:
> On 5/7/20 5:15 AM, Kevin Wolf wrote:
> > Am 28.04.2020 um 22:28 hat Eric Blake geschrieben:
> > > Based-on: <20200424125448.63318-1-kwolf@redhat.com>
> > > [PATCH v7 00/10] block: Fix resize (extending) of short overlays
> > > 
> > > After reviewing Kevin's work, I questioned if we had a redundancy with
> > > bdrv_has_zero_init_truncate.  It turns out we do, and this is the result.
> > > 
> > > Patch 1 has been previously posted [1] and reviewed, the rest is new.
> > > I did not address Neils' comment that modern gluster also always
> > > 0-initializes [2], as I am not set up to verify it (my changes to the
> > > other drivers are semantic no-ops, so I don't feel as bad about
> > > posting them with less rigourous testing).
> > > 
> > > [1] https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg08070.html
> > > [2] https://lists.gnu.org/archive/html/qemu-devel/2020-02/msg04266.html
> > 
> > block/parallels.c: In function 'parallels_co_writev':
> > block/parallels.c:218:12: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> >    218 |         if (ret < 0) {
> >        |            ^
> > block/parallels.c:169:9: note: 'ret' was declared here
> >    169 |     int ret;
> >        |         ^~~
> > cc1: all warnings being treated as errors
> 
> Yep, fixup posted here:
> https://lists.gnu.org/archive/html/qemu-devel/2020-04/msg05199.html
> 
> > 
> > Apart from that, you can add:
> > 
> > Reviewed-by: Kevin Wolf <kwolf@redhat.com>
> 
> Do you need me to send a v2?

Ah, sorry, I missed that you had already sent a fixup. I'll squash it
in.

Kevin


Re: [PATCH 0/9] More truncate improvements
Posted by no-reply@patchew.org 4 years ago
Patchew URL: https://patchew.org/QEMU/20200428202905.770727-1-eblake@redhat.com/



Hi,

This series failed the docker-quick@centos7 build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
make docker-image-centos7 V=1 NETWORK=1
time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1
=== TEST SCRIPT END ===

  CC      block/file-posix.o
  CC      block/linux-aio.o
/tmp/qemu-test/src/block/parallels.c: In function 'parallels_co_writev':
/tmp/qemu-test/src/block/parallels.c:218:12: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
         if (ret < 0) {
            ^
/tmp/qemu-test/src/block/parallels.c:169:9: note: 'ret' was declared here
     int ret;
         ^
cc1: all warnings being treated as errors
make: *** [block/parallels.o] Error 1
make: *** Waiting for unfinished jobs....
Traceback (most recent call last):
  File "./tests/docker/docker.py", line 664, in <module>
---
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=17b76be9fd0a432985a07807c0fce033', '-u', '1001', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=1', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-_1eoo1y7/src/docker-src.2020-04-28-22.22.17.10859:/var/tmp/qemu:z,ro', 'qemu:centos7', '/var/tmp/qemu/run', 'test-quick']' returned non-zero exit status 2.
filter=--filter=label=com.qemu.instance.uuid=17b76be9fd0a432985a07807c0fce033
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-_1eoo1y7/src'
make: *** [docker-run-test-quick@centos7] Error 2

real    2m2.980s
user    0m8.950s


The full log is available at
http://patchew.org/logs/20200428202905.770727-1-eblake@redhat.com/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Re: [PATCH 0/9] More truncate improvements
Posted by Eric Blake 4 years ago
On 4/28/20 9:24 PM, no-reply@patchew.org wrote:
> Patchew URL: https://patchew.org/QEMU/20200428202905.770727-1-eblake@redhat.com/
> 

> /tmp/qemu-test/src/block/parallels.c: In function 'parallels_co_writev':
> /tmp/qemu-test/src/block/parallels.c:218:12: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>           if (ret < 0) {
>              ^
> /tmp/qemu-test/src/block/parallels.c:169:9: note: 'ret' was declared here
>       int ret;
>           ^

False positive: the code is roughly:

int ret;
if (cond1) {
   ret = ...;
}
if (cond2) {
   ret = ...;
}
if (ret < 0)

but the compiler can't prove that cond1 + cond2 covers all 
possibilities.  The obvious fix is to initialize ret; squash this into 7/9:

diff --git i/block/parallels.c w/block/parallels.c
index eb6c6c01b998..e7717c508e62 100644
--- i/block/parallels.c
+++ w/block/parallels.c
@@ -166,7 +166,7 @@ static int64_t block_status(BDRVParallelsState *s, 
int64_t sector_num,
  static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num,
                                   int nb_sectors, int *pnum)
  {
-    int ret;
+    int ret = 0;
      BDRVParallelsState *s = bs->opaque;
      int64_t pos, space, idx, to_allocate, i, len;





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


Re: [PATCH 0/9] More truncate improvements
Posted by no-reply@patchew.org 4 years ago
Patchew URL: https://patchew.org/QEMU/20200428202905.770727-1-eblake@redhat.com/



Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#! /bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-mingw@fedora J=14 NETWORK=1
=== TEST SCRIPT END ===

  CC      block/io.o
  CC      block/create.o
/tmp/qemu-test/src/block/parallels.c: In function 'parallels_co_writev':
/tmp/qemu-test/src/block/parallels.c:218:12: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
         if (ret < 0) {
            ^
/tmp/qemu-test/src/block/parallels.c:169:9: note: 'ret' was declared here
     int ret;
         ^~~
cc1: all warnings being treated as errors
make: *** [/tmp/qemu-test/src/rules.mak:69: block/parallels.o] Error 1
make: *** Waiting for unfinished jobs....
Traceback (most recent call last):
  File "./tests/docker/docker.py", line 664, in <module>
---
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=b6fe059fceb24ee6af44e5ec70624428', '-u', '1003', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew2/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-3enfstzu/src/docker-src.2020-04-28-22.21.44.9392:/var/tmp/qemu:z,ro', 'qemu:fedora', '/var/tmp/qemu/run', 'test-mingw']' returned non-zero exit status 2.
filter=--filter=label=com.qemu.instance.uuid=b6fe059fceb24ee6af44e5ec70624428
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-3enfstzu/src'
make: *** [docker-run-test-mingw@fedora] Error 2

real    2m45.121s
user    0m8.436s


The full log is available at
http://patchew.org/logs/20200428202905.770727-1-eblake@redhat.com/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Re: [PATCH 0/9] More truncate improvements
Posted by Eric Blake 4 years ago
On 4/28/20 3:28 PM, Eric Blake wrote:
> Based-on: <20200424125448.63318-1-kwolf@redhat.com>
> [PATCH v7 00/10] block: Fix resize (extending) of short overlays
> 
> After reviewing Kevin's work, I questioned if we had a redundancy with
> bdrv_has_zero_init_truncate.  It turns out we do, and this is the result.
> 
> Patch 1 has been previously posted [1] and reviewed, the rest is new.
> I did not address Neils' comment that modern gluster also always
> 0-initializes [2], as I am not set up to verify it (my changes to the
> other drivers are semantic no-ops, so I don't feel as bad about
> posting them with less rigourous testing).
> 
> [1] https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg08070.html
> [2] https://lists.gnu.org/archive/html/qemu-devel/2020-02/msg04266.html
> 
> Eric Blake (9):
>    gluster: Drop useless has_zero_init callback
>    file-win32: Support BDRV_REQ_ZERO_WRITE for truncate
>    nfs: Support BDRV_REQ_ZERO_WRITE for truncate
>    rbd: Support BDRV_REQ_ZERO_WRITE for truncate
>    sheepdog: Support BDRV_REQ_ZERO_WRITE for truncate
>    ssh: Support BDRV_REQ_ZERO_WRITE for truncate
>    parallels: Rework truncation logic
>    vhdx: Rework truncation logic
>    block: Drop unused .bdrv_has_zero_init_truncate
> 

Ping.

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