[Qemu-block] [PATCH v2] migration: disallow migrate_add_blocker during migration

2015-10-01 Thread John Snow
If a migration is already in progress and somebody attempts to add a migration blocker, this should rightly fail. Add an errp parameter and a retcode return value to migrate_add_blocker. This is part one of two for a solution to prohibit e.g. block jobs from running concurrently with migration.

Re: [Qemu-block] [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-10-01 Thread Paolo Bonzini
On 30/09/2015 18:02, Jeff Cody wrote: > As a general rule for blockjobs, I disagree. > > Right away, there is a key difference: we don't know that the image is > (or should be) empty. Not necessarily empty. sync='top' && mode='existing' && !target->backing_file, for example, makes sense if

Re: [Qemu-block] [PATCH] migration: disallow migrate_add_blocker during migration

2015-10-01 Thread John Snow
On 09/30/2015 06:08 AM, Kevin Wolf wrote: > Am 29.09.2015 um 22:20 hat John Snow geschrieben: >> If a migration is already in progress and somebody attempts >> to add a migration blocker, this should rightly fail. >> >> Add an errp parameter and a retcode return value to migrate_add_blocker. >>

Re: [Qemu-block] [PATCH] block/raw-posix: Open file descriptor O_RDWR to work around glibc posix_fallocate emulation issue.

2015-10-01 Thread Jeff Cody
On Tue, Sep 29, 2015 at 04:54:10PM +0100, Richard W.M. Jones wrote: > https://bugzilla.redhat.com/show_bug.cgi?id=1265196 > > The following command fails on an NFS mountpoint: > > $ qemu-img create -f qcow2 -o preallocation=falloc disk.img 262144 > Formatting 'disk.img', fmt=qcow2

Re: [Qemu-block] [Qemu-devel] [PATCH] block/raw-posix: Open file descriptor O_RDWR to work around glibc posix_fallocate emulation issue.

2015-10-01 Thread Eric Blake
On 09/29/2015 09:54 AM, Richard W.M. Jones wrote: > https://bugzilla.redhat.com/show_bug.cgi?id=1265196 > > The following command fails on an NFS mountpoint: > > $ qemu-img create -f qcow2 -o preallocation=falloc disk.img 262144 > Formatting 'disk.img', fmt=qcow2 size=262144 encryption=off

[Qemu-block] [PATCH] gluster: allocate GlusterAIOCBs on the stack

2015-10-01 Thread Paolo Bonzini
This is simpler now that the driver has been converted to coroutines. Signed-off-by: Paolo Bonzini --- block/gluster.c | 86 ++--- 1 file changed, 33 insertions(+), 53 deletions(-) diff --git a/block/gluster.c

[Qemu-block] [PATCH] scsi: switch from g_slice allocator to malloc

2015-10-01 Thread Paolo Bonzini
Simplify memory allocation by sticking with a single API. GSlice is not that fast anyway (tcmalloc/jemalloc are better). Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-bus.c | 4 ++-- hw/scsi/virtio-scsi-dataplane.c | 10 +- hw/scsi/virtio-scsi.c

Re: [Qemu-block] [Qemu-devel] [PATCH] migration: disallow migrate_add_blocker during migration

2015-10-01 Thread Markus Armbruster
Kevin Wolf writes: > Am 29.09.2015 um 22:20 hat John Snow geschrieben: >> If a migration is already in progress and somebody attempts >> to add a migration blocker, this should rightly fail. >> >> Add an errp parameter and a retcode return value to migrate_add_blocker. >> >>

Re: [Qemu-block] [PATCH] iotests: Fix test 128 for password-less sudo

2015-10-01 Thread Kevin Wolf
Am 25.09.2015 um 19:19 hat Max Reitz geschrieben: > As of 934659c460d46c948cf348822fda1d38556ed9a4, $QEMU_IO is generally no > longer a program name, and therefore "sudo -n $QEMU_IO" will no longer > work. > > Fix this by copying the qemu-io invocation function from common.config, > making it use

Re: [Qemu-block] [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-10-01 Thread Kevin Wolf
Am 30.09.2015 um 18:06 hat Paolo Bonzini geschrieben: > > > On 30/09/2015 18:02, Jeff Cody wrote: > > As a general rule for blockjobs, I disagree. > > > > Right away, there is a key difference: we don't know that the image is > > (or should be) empty. > > Not necessarily empty. sync='top' &&

[Qemu-block] [PATCH] block: switch from g_slice allocator to malloc

2015-10-01 Thread Paolo Bonzini
Simplify memory allocation by sticking with a single API. GSlice is not that fast anyway (tcmalloc/jemalloc are better). Signed-off-by: Paolo Bonzini --- block/io.c| 4 ++-- block/mirror.c| 4 ++-- block/raw-posix.c | 8 block/raw-win32.c

[Qemu-block] [PATCH] nbd: switch from g_slice allocator to malloc

2015-10-01 Thread Paolo Bonzini
Simplify memory allocation by sticking with a single API. GSlice is not that fast anyway (tcmalloc/jemalloc are better). Signed-off-by: Paolo Bonzini --- nbd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nbd.c b/nbd.c index 07240bd..74859cb

[Qemu-block] [PATCH v2 15/16] block: Add and use bdrv_replace_in_backing_chain()

2015-10-01 Thread Kevin Wolf
This cleans up the mess we left behind in the mirror code after the previous patch. Instead of using bdrv_swap(), just change pointers. The interface change of the mirror job that callers must consider is that after job completion, their local BDS pointers still point to the same node now.

[Qemu-block] [PATCH v2 14/16] blockjob: Store device name at job creation

2015-10-01 Thread Kevin Wolf
Some block jobs change the block device graph on completion. This means that the device that owns the job and originally was addressed with its device name may no longer be what the corresponding BlockBackend points to. Previously, the effects of bdrv_swap() ensured that the job was (at least

[Qemu-block] [PATCH v2 11/16] block-backend: Add blk_set_bs()

2015-10-01 Thread Kevin Wolf
It allows changing the BlockDriverState that a BlockBackend points to. Signed-off-by: Kevin Wolf --- block/block-backend.c | 17 + include/block/block_int.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/block/block-backend.c

[Qemu-block] [PATCH v2 12/16] block: Introduce parents list

2015-10-01 Thread Kevin Wolf
Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- block.c | 3 +++ include/block/block_int.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/block.c b/block.c index f8e4631..9ff2b64 100644 --- a/block.c +++ b/block.c @@ -1090,6

[Qemu-block] [PATCH v2 09/16] block: Split bdrv_move_feature_fields()

2015-10-01 Thread Kevin Wolf
After bdrv_swap(), some fields must be moved back to their original BDS to compensate for the effects that a swap of the contents of the objects has while keeping the old addresses. Other fields must be moved back because they should logically be moved and must stay on top When replacing

[Qemu-block] [PATCH v2 10/16] block/io: Make bdrv_requests_pending() public

2015-10-01 Thread Kevin Wolf
Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Alberto Garcia --- block/io.c| 2 +- include/block/block_int.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/block/io.c b/block/io.c index

[Qemu-block] [PATCH v2 06/16] block: Remove bdrv_open_image()

2015-10-01 Thread Kevin Wolf
It is unused now. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Alberto Garcia --- block.c | 34 -- include/block/block.h | 4 2 files changed, 38 deletions(-) diff

[Qemu-block] [PATCH v2 13/16] block: Implement bdrv_append() without bdrv_swap()

2015-10-01 Thread Kevin Wolf
Remember all parent nodes and just change the pointers there instead of swapping the contents of the BlockDriverState. Handling of snapshot=on must be moved further down in bdrv_open() because *pbs (which is the bs pointer in the BlockBackend) must already be set before bdrv_append() is called.

[Qemu-block] [PATCH v2 05/16] block: Convert bs->file to BdrvChild

2015-10-01 Thread Kevin Wolf
This patch removes the temporary duplication between bs->file and bs->file_child by converting everything to BdrvChild. Signed-off-by: Kevin Wolf --- block.c | 63 ++- block/blkdebug.c | 32

[Qemu-block] [PATCH v2 00/16] block: Get rid of bdrv_swap()

2015-10-01 Thread Kevin Wolf
bdrv_swap() has always been an ugly hack that we would rather have avoided. When it was introduced, we simply didn't have the infrastructure to update pointers instead of transplanting the contents of BDS object, so we grudgingly added bdrv_swap() as a quick solution. Meanwhile, most of the

[Qemu-block] [PATCH v2 03/16] blkverify: Convert s->test_file to BdrvChild

2015-10-01 Thread Kevin Wolf
Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- block/blkverify.c | 41 + 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/block/blkverify.c b/block/blkverify.c index d277e63..6b71622 100644 ---

Re: [Qemu-block] [PATCH v3] block: mirror - fix full sync mode when target does not support zero init

2015-10-01 Thread Jeff Cody
On Thu, Oct 01, 2015 at 03:35:15PM +0200, Paolo Bonzini wrote: > > > On 01/10/2015 15:14, Jeff Cody wrote: > > During mirror, if the target device does not support zero init, a > > mirror may result in a corrupted image for sync="full" mode. > > > > This is due to how the initial dirty bitmap

[Qemu-block] [PATCH v2 02/16] vmdk: Use BdrvChild instead of BDS for references to extents

2015-10-01 Thread Kevin Wolf
Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Alberto Garcia --- block/vmdk.c | 99 +++- 1 file changed, 51 insertions(+), 48 deletions(-) diff --git a/block/vmdk.c

[Qemu-block] [PATCH v2 07/16] block: Convert bs->backing_hd to BdrvChild

2015-10-01 Thread Kevin Wolf
This is the final step in converting all of the BlockDriverState pointers that block drivers use to BdrvChild. After this patch, bs->children contains the full list of child nodes that are referenced by a given BDS, and these children are only referenced through BdrvChild, so that updating the

[Qemu-block] [PATCH v3] block: mirror - fix full sync mode when target does not support zero init

2015-10-01 Thread Jeff Cody
During mirror, if the target device does not support zero init, a mirror may result in a corrupted image for sync="full" mode. This is due to how the initial dirty bitmap is set up prior to copying data - we did not mark sectors as dirty that are unallocated. This means those unallocated sectors

Re: [Qemu-block] [PATCH v3] block: mirror - fix full sync mode when target does not support zero init

2015-10-01 Thread Paolo Bonzini
On 01/10/2015 15:14, Jeff Cody wrote: > During mirror, if the target device does not support zero init, a > mirror may result in a corrupted image for sync="full" mode. > > This is due to how the initial dirty bitmap is set up prior to copying > data - we did not mark sectors as dirty that are

[Qemu-block] [PATCH v2 04/16] quorum: Convert to BdrvChild

2015-10-01 Thread Kevin Wolf
Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Alberto Garcia --- block/quorum.c | 63 ++ 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/block/quorum.c

[Qemu-block] [PATCH v2 01/16] block: Introduce BDS.file_child

2015-10-01 Thread Kevin Wolf
Store the BdrvChild for bs->file. At this point, bs->file_child->bs just duplicates the bs->file pointer. Later, it will completely replace it. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Alberto Garcia --- block.c

[Qemu-block] [PATCH 3/3] block: prohibit migration during transactions

2015-10-01 Thread John Snow
Similarly to BlockJobs, prohibit migration at least during the synchronous phase of a transaction. In particular, this guards internal and external snapshots, which are implemented via transaction actions through blockdev_do_action. Signed-off-by: John Snow --- blockdev.c |

[Qemu-block] [PATCH 0/3] block: prohibit migrations during tasks

2015-10-01 Thread John Snow
requires: [PATCH v2] migration: disallow migrate_add_blocker during migration We don't want to allow migrations during sensitive operations such as snapshots or mirroring. In conjunction with the previous patch, we will also prohibit the user from starting any block jobs while migrations are

Re: [Qemu-block] [Qemu-devel] [PATCH] qtest/ide-test: ppc64be correction for ATAPI tests

2015-10-01 Thread John Snow
On 09/28/2015 01:38 PM, John Snow wrote: > the 16bit ide data register is LE by definition. > > Signed-off-by: John Snow > --- > tests/ide-test.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tests/ide-test.c b/tests/ide-test.c > index

[Qemu-block] [PATCH 2/3] block/mirror: allow migration after sync

2015-10-01 Thread John Snow
After the mirroring blockjob reaches synchronization, allow migration to resume. Signed-off-by: John Snow --- block/mirror.c | 2 ++ blockjob.c | 5 + include/block/blockjob.h | 8 3 files changed, 15 insertions(+) diff --git

[Qemu-block] [PATCH 1/3] block: prohibit migration during BlockJobs

2015-10-01 Thread John Snow
Unless we can prove this to be safe for specific cases, the default should be to prohibit migration during BlockJobs. In conjunction with "migration: disallow_migrate_add_blocker during migration", this should be sufficient to disallow the blockjob from starting in the event of an in-progress

Re: [Qemu-block] [PATCH 3/3] block: prohibit migration during transactions

2015-10-01 Thread Paolo Bonzini
On 01/10/2015 18:34, John Snow wrote: > + > +error_setg(, "Block device(s) are in use by a Block > Transaction"); s/Block Transaction/transaction command/ But how can migration start during a transaction? > +ret = migrate_add_blocker(blocker, errp); > +if (ret < 0) { > +

[Qemu-block] [PULL 0/1] Block job patches

2015-10-01 Thread Jeff Cody
The following changes since commit fa500928ad9da6dd570918e3dfca13c029af07a8: Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20150930' into staging (2015-10-01 10:49:38 +0100) are available in the git repository at: g...@github.com:codyprime/qemu-kvm-jtc.git

[Qemu-block] [PULL 1/1] block: mirror - fix full sync mode when target does not support zero init

2015-10-01 Thread Jeff Cody
During mirror, if the target device does not support zero init, a mirror may result in a corrupted image for sync="full" mode. This is due to how the initial dirty bitmap is set up prior to copying data - we did not mark sectors as dirty that are unallocated. This means those unallocated sectors

Re: [Qemu-block] [PATCH v3] block: mirror - fix full sync mode when target does not support zero init

2015-10-01 Thread Jeff Cody
On Thu, Oct 01, 2015 at 09:14:51AM -0400, Jeff Cody wrote: > During mirror, if the target device does not support zero init, a > mirror may result in a corrupted image for sync="full" mode. > > This is due to how the initial dirty bitmap is set up prior to copying > data - we did not mark sectors

Re: [Qemu-block] [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-10-01 Thread Kevin Wolf
Am 30.09.2015 um 16:43 hat Jeff Cody geschrieben: > On Tue, Sep 29, 2015 at 12:52:33PM +0200, Paolo Bonzini wrote: > > > > > > On 29/09/2015 11:35, Kevin Wolf wrote: > > > The caller could be copying the backing file in the background and it > > > may not yet be finished. > > > > Yes, and this

Re: [Qemu-block] [PATCH 09/16] block: Split bdrv_move_feature_fields()

2015-10-01 Thread Max Reitz
On 17.09.2015 15:48, Kevin Wolf wrote: > After bdrv_swap(), some fields must be moved back to their original BDS > to compensate for the effects that a swap of the contents of the objects > has while keeping the old addresses. Other fields must be moved back > because they should logically be

Re: [Qemu-block] [PATCH 13/16] block: Implement bdrv_append() without bdrv_swap()

2015-10-01 Thread Kevin Wolf
Am 30.09.2015 um 16:45 hat Max Reitz geschrieben: > On 29.09.2015 15:51, Kevin Wolf wrote: > > Am 23.09.2015 um 18:36 hat Max Reitz geschrieben: > >> On 17.09.2015 15:48, Kevin Wolf wrote: > >>> void bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top) > >>> { > >>> -

Re: [Qemu-block] [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-10-01 Thread Jeff Cody
On Wed, Sep 30, 2015 at 05:26:28PM +0200, Kevin Wolf wrote: > Am 30.09.2015 um 16:43 hat Jeff Cody geschrieben: > > On Tue, Sep 29, 2015 at 12:52:33PM +0200, Paolo Bonzini wrote: > > > > > > > > > On 29/09/2015 11:35, Kevin Wolf wrote: > > > > The caller could be copying the backing file in the

Re: [Qemu-block] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-10-01 Thread Kevin Wolf
Am 30.09.2015 um 17:11 hat Jeff Cody geschrieben: > On Mon, Sep 28, 2015 at 04:23:16PM +0100, Stefan Hajnoczi wrote: > > On Sun, Sep 27, 2015 at 11:29:18PM -0400, Jeff Cody wrote: > > > +if (s->zero_cycle) { > > > +ret = bdrv_get_block_status(s->target, sector_num, nb_sectors, > > >

Re: [Qemu-block] [PATCH] migration: disallow migrate_add_blocker during migration

2015-10-01 Thread Kevin Wolf
Am 29.09.2015 um 22:20 hat John Snow geschrieben: > If a migration is already in progress and somebody attempts > to add a migration blocker, this should rightly fail. > > Add an errp parameter and a retcode return value to migrate_add_blocker. > > This is part one of two for a solution to

Re: [Qemu-block] [PATCH] block/raw-posix: Open file descriptor O_RDWR to work around glibc posix_fallocate emulation issue.

2015-10-01 Thread Kevin Wolf
Am 29.09.2015 um 17:54 hat Richard W.M. Jones geschrieben: > https://bugzilla.redhat.com/show_bug.cgi?id=1265196 > > The following command fails on an NFS mountpoint: > > $ qemu-img create -f qcow2 -o preallocation=falloc disk.img 262144 > Formatting 'disk.img', fmt=qcow2 size=262144

Re: [Qemu-block] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-10-01 Thread Jeff Cody
On Mon, Sep 28, 2015 at 04:23:16PM +0100, Stefan Hajnoczi wrote: > On Sun, Sep 27, 2015 at 11:29:18PM -0400, Jeff Cody wrote: > > +if (s->zero_cycle) { > > +ret = bdrv_get_block_status(s->target, sector_num, nb_sectors, > > ); > > +if (!(ret & BDRV_BLOCK_ZERO)) { > > +

Re: [Qemu-block] [PATCH 15/16] block: Add and use bdrv_replace_in_backing_chain()

2015-10-01 Thread Max Reitz
On 17.09.2015 15:48, Kevin Wolf wrote: > This cleans up the mess we left behind in the mirror code after the > previous patch. Instead of using bdrv_swap(), just change pointers. > > The interface change of the mirror job that callers must consider is > that after job completion, their local BDS

Re: [Qemu-block] [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-10-01 Thread Jeff Cody
On Tue, Sep 29, 2015 at 12:52:33PM +0200, Paolo Bonzini wrote: > > > On 29/09/2015 11:35, Kevin Wolf wrote: > > The caller could be copying the backing file in the background and it > > may not yet be finished. > > Yes, and this is permitted (the destination file of mirroring is opened > with

Re: [Qemu-block] [PATCH v5 24/38] blockdev: Pull out blockdev option extraction

2015-10-01 Thread Alberto Garcia
On Fri 18 Sep 2015 05:22:59 PM CEST, Max Reitz wrote: > Extract some of the blockdev option extraction code from blockdev_init() > into its own function. This simplifies blockdev_init() and will allow > reusing the code in a different function added in a follow-up patch. > >

Re: [Qemu-block] [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-10-01 Thread Paolo Bonzini
On 30/09/2015 16:43, Jeff Cody wrote: > One issue is that QEMU will do mode!='existing' && sync!='full' for > drivers that do not support backing files (raw host devices, for > instance). Yup, this can be used to get a mirror of future operations (the idea was to support things such as

Re: [Qemu-block] [PATCH 13/16] block: Implement bdrv_append() without bdrv_swap()

2015-10-01 Thread Max Reitz
On 29.09.2015 15:51, Kevin Wolf wrote: > Am 23.09.2015 um 18:36 hat Max Reitz geschrieben: >> On 17.09.2015 15:48, Kevin Wolf wrote: >>> Remember all parent nodes and just change the pointers there instead of >>> swapping the contents of the BlockDriverState. >>> >>> Handling of snapshot=on must

Re: [Qemu-block] [PATCH v5 07/38] block: Make bdrv_is_inserted() recursive

2015-10-01 Thread Max Reitz
On 29.09.2015 11:15, Alberto Garcia wrote: > On Fri 18 Sep 2015 05:22:42 PM CEST, Max Reitz wrote: >> If bdrv_is_inserted() is called on the top level BDS, it should make >> sure all nodes in the BDS tree are actually inserted. >> >> Signed-off-by: Max Reitz >> --- >> block.c

Re: [Qemu-block] [PATCH 15/16] block: Add and use bdrv_replace_in_backing_chain()

2015-10-01 Thread Max Reitz
On 29.09.2015 17:22, Kevin Wolf wrote: > Am 23.09.2015 um 19:08 hat Max Reitz geschrieben: >> On 17.09.2015 15:48, Kevin Wolf wrote: >>> This cleans up the mess we left behind in the mirror code after the >>> previous patch. Instead of using bdrv_swap(), just change pointers. >>> >>> The interface