[PATCH] qemu-iotest: Test NBD hole reporting for qcow2

2021-04-13 Thread Nir Soffer
In commit commit 0da9856851dcca09222a1467e16ddd05dc66e460 nbd: server: Report holes for raw images we changed the way holes are reported for raw images, but also how known-zero portions of qcow2 files are reported. This was not covered by iotests, and revealed recently by libnbd tests[1]. Ad

Re: [PULL 0/1] Block patch for 6.0-rc3

2021-04-13 Thread Peter Maydell
On Tue, 13 Apr 2021 at 14:39, Max Reitz wrote: > > The following changes since commit dce628a97fde2594f99d738883a157f05aa0a14f: > > Merge remote-tracking branch 'remotes/dg-gitlab/tags/ppc-for-6.0-20210412' > into staging (2021-04-13 13:05:07 +0100) > > are available in the Git repository at: >

Re: [PATCH v2] vhost-user-blk: Fail gracefully on too large queue size

2021-04-13 Thread Raphael Norwitz
On Tue, Apr 13, 2021 at 06:56:54PM +0200, Kevin Wolf wrote: > virtio_add_queue() aborts when queue_size > VIRTQUEUE_MAX_SIZE, so > vhost_user_blk_device_realize() should check this before calling it. > > Simple reproducer: > > qemu-system-x86_64 \ > -chardev null,id=foo \ > -device vhost-

Re: [PATCH v2] vhost-user-blk: Fail gracefully on too large queue size

2021-04-13 Thread Philippe Mathieu-Daudé
On 4/13/21 6:56 PM, Kevin Wolf wrote: > virtio_add_queue() aborts when queue_size > VIRTQUEUE_MAX_SIZE, so > vhost_user_blk_device_realize() should check this before calling it. > > Simple reproducer: > > qemu-system-x86_64 \ > -chardev null,id=foo \ > -device vhost-user-blk-pci,queue-siz

Re: [PATCH] vhost-user-blk: Fail gracefully on too large queue size

2021-04-13 Thread Kevin Wolf
Am 13.04.2021 um 18:52 hat Kevin Wolf geschrieben: > virtio_add_queue() aborts when queue_size > VIRTQUEUE_MAX_SIZE, so > vhost_user_blk_device_realize() should check this before calling it. > > Simple reproducer: > > qemu-system-x86_64 \ > -chardev null,id=foo \ > -device vhost-user-blk-

[PATCH v2] vhost-user-blk: Fail gracefully on too large queue size

2021-04-13 Thread Kevin Wolf
virtio_add_queue() aborts when queue_size > VIRTQUEUE_MAX_SIZE, so vhost_user_blk_device_realize() should check this before calling it. Simple reproducer: qemu-system-x86_64 \ -chardev null,id=foo \ -device vhost-user-blk-pci,queue-size=4096,chardev=foo Fixes: https://bugzilla.redhat.com

[PATCH] vhost-user-blk: Fail gracefully on too large queue size

2021-04-13 Thread Kevin Wolf
virtio_add_queue() aborts when queue_size > VIRTQUEUE_MAX_SIZE, so vhost_user_blk_device_realize() should check this before calling it. Simple reproducer: qemu-system-x86_64 \ -chardev null,id=foo \ -device vhost-user-blk-pci,queue-size=4096,chardev=foo Fixes: https://bugzilla.redhat.com

Re: [PATCH 1/2] block: Add BDRV_O_NO_SHARE for blk_new_open()

2021-04-13 Thread Eric Blake
On 4/13/21 8:23 AM, Kevin Wolf wrote: > Normally, blk_new_open() just shares all permissions. This was fine > originally when permissions only protected against uses in the same > process because no other part of the code would actually get to access > the block nodes opened with blk_new_open(). Ho

Re: [PATCH 2/2] qemu-img convert: Unshare write permission for source

2021-04-13 Thread Eric Blake
On 4/13/21 8:23 AM, Kevin Wolf wrote: > For a successful conversion of an image, we must make sure that its > content doesn't change during the conversion. > > A special case of this is using the same image file both as the source > and as the destination. If both input and output format are raw,

[PULL 1/1] block/nbd: fix possible use after free of s->connect_thread

2021-04-13 Thread Max Reitz
From: Vladimir Sementsov-Ogievskiy If on nbd_close() we detach the thread (in nbd_co_establish_connection_cancel() thr->state becomes CONNECT_THREAD_RUNNING_DETACHED), after that point we should not use s->connect_thread (which is set to NULL), as running thread may free it at any time. Still nb

[PULL 0/1] Block patch for 6.0-rc3

2021-04-13 Thread Max Reitz
The following changes since commit dce628a97fde2594f99d738883a157f05aa0a14f: Merge remote-tracking branch 'remotes/dg-gitlab/tags/ppc-for-6.0-20210412' into staging (2021-04-13 13:05:07 +0100) are available in the Git repository at: https://github.com/XanClic/qemu.git tags/pull-block-2021-0

Re: [PATCH for-6.0] block/nbd: fix possible use after free of s->connect_thread

2021-04-13 Thread Max Reitz
On 13.04.21 14:19, Vladimir Sementsov-Ogievskiy wrote: 13.04.2021 14:53, Max Reitz wrote: On 06.04.21 17:51, Vladimir Sementsov-Ogievskiy wrote: If on nbd_close() we detach the thread (in nbd_co_establish_connection_cancel() thr->state becomes CONNECT_THREAD_RUNNING_DETACHED), after that point

[PATCH 2/2] qemu-img convert: Unshare write permission for source

2021-04-13 Thread Kevin Wolf
For a successful conversion of an image, we must make sure that its content doesn't change during the conversion. A special case of this is using the same image file both as the source and as the destination. If both input and output format are raw, the operation would just be useless work, with o

[PATCH 1/2] block: Add BDRV_O_NO_SHARE for blk_new_open()

2021-04-13 Thread Kevin Wolf
Normally, blk_new_open() just shares all permissions. This was fine originally when permissions only protected against uses in the same process because no other part of the code would actually get to access the block nodes opened with blk_new_open(). However, since we use it for file locking now, u

[PATCH 0/2] qemu-img convert: Unshare write permission for source

2021-04-13 Thread Kevin Wolf
Kevin Wolf (2): block: Add BDRV_O_NO_SHARE for blk_new_open() qemu-img convert: Unshare write permission for source include/block/block.h | 1 + block/block-backend.c | 19 +-- qemu-img.c| 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) -- 2.30.2

[PATCH] ratelimit: protect with a mutex

2021-04-13 Thread Paolo Bonzini
Right now, rate limiting is protected by the AioContext mutex, which is taken for example both by the block jobs and by qmp_block_job_set_speed (via find_block_job). We would like to remove the dependency of block layer code on the AioContext mutex, since most drivers and the core I/O code are alr

Re: [PATCH for-6.0] block/nbd: fix possible use after free of s->connect_thread

2021-04-13 Thread Vladimir Sementsov-Ogievskiy
13.04.2021 14:53, Max Reitz wrote: On 06.04.21 17:51, Vladimir Sementsov-Ogievskiy wrote: If on nbd_close() we detach the thread (in nbd_co_establish_connection_cancel() thr->state becomes CONNECT_THREAD_RUNNING_DETACHED), after that point we should not use s->connect_thread (which is set to NUL

Re: [PATCH for-6.0] block/nbd: fix possible use after free of s->connect_thread

2021-04-13 Thread Max Reitz
On 06.04.21 17:51, Vladimir Sementsov-Ogievskiy wrote: If on nbd_close() we detach the thread (in nbd_co_establish_connection_cancel() thr->state becomes CONNECT_THREAD_RUNNING_DETACHED), after that point we should not use s->connect_thread (which is set to NULL), as running thread may free it at

Re: [PULL 0/1] NBD fix for 6.0-rc3

2021-04-13 Thread Peter Maydell
On Tue, 13 Apr 2021 at 07:47, Vladimir Sementsov-Ogievskiy wrote: > > 12.04.2021 18:48, Peter Maydell wrote: > > On Mon, 12 Apr 2021 at 13:19, Vladimir Sementsov-Ogievskiy > > wrote: > >> > >> The following changes since commit > >> 555249a59e9cdd6b58da103aba5cf3a2d45c899f: > >> > >>Merge re

Re: [PATCH 0/5] blkdebug: fix racing condition when iterating on

2021-04-13 Thread Paolo Bonzini
On 08/04/21 17:59, Emanuele Giuseppe Esposito wrote: When qemu_coroutine_enter is executed in a loop (even QEMU_FOREACH_SAFE), the new routine can modify the list, for example removing an element, causing problem when control is given back to the caller that continues iterating on the same list.

Re: [PATCH 4/5] blkdebug: do not suspend in the middle of QLIST_FOREACH_SAFE

2021-04-13 Thread Paolo Bonzini
On 08/04/21 17:59, Emanuele Giuseppe Esposito wrote: Perhaps insert here: That would be unsafe in case a rule other than the current one is removed while the coroutine has yielded. Keep FOREACH_SAFE because suspend_request deletes the current rule. After this patch, *all* matching rules are