Re: [Qemu-block] [PATCH 2/2] virtio-scsi/virtio-blk: Disable poll handlers when stopping vq handler

2018-09-11 Thread Fam Zheng
On Tue, 09/11 17:30, Paolo Bonzini wrote: > On 11/09/2018 16:12, Fam Zheng wrote: > > On Tue, 09/11 13:32, Paolo Bonzini wrote: > >> On 10/09/2018 16:56, Fam Zheng wrote: > >>> We have this unwanted call stack: > >>> > >>> > ... > >>> > #13 0x5586602b7793 in virtio_scsi_handle_cmd_vq > >>>

[Qemu-block] [PATCH v4 4/4] block/rbd: add deprecation documentation for filename keyvalue pairs

2018-09-11 Thread Jeff Cody
Signed-off-by: Jeff Cody --- qemu-deprecated.texi | 15 +++ 1 file changed, 15 insertions(+) diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 1b9c007f12..8d285b281e 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -190,6 +190,21 @@ used instead. In

[Qemu-block] [PATCH v4 3/4] block/rbd: add iotest for rbd legacy keyvalue filename parsing

2018-09-11 Thread Jeff Cody
This is a small test that will check for the ability to parse both legacy and modern options for rbd. The way the test is set up is for failure to occur, but without having to wait to timeout on a non-existent rbd server. The error messages in the success path show that the arguments were

[Qemu-block] [PATCH v4 0/4] block/rbd: enable filename parsing on open

2018-09-11 Thread Jeff Cody
Changes from v3: Patch 4: Typo fixed [Eric] Added examples [Eric] Changes from v2: = Patch 4: New, document deprecation. [Eric] Patch 3,2: Add r-b's Changes from v1: = Patch 1: Don't pass unused BlockDriverState to helper function

[Qemu-block] [PATCH v4 1/4] block/rbd: pull out qemu_rbd_convert_options

2018-09-11 Thread Jeff Cody
Code movement to pull the conversion from Qdict to BlockdevOptionsRbd into a helper function. Reviewed-by: Eric Blake Reviewed-by: John Snow Signed-off-by: Jeff Cody --- block/rbd.c | 36 1 file changed, 24 insertions(+), 12 deletions(-) diff --git

[Qemu-block] [PATCH v4 2/4] block/rbd: Attempt to parse legacy filenames

2018-09-11 Thread Jeff Cody
When we converted rbd to get rid of the older key/value-centric encoding format, we broke compatibility with image files with backing file strings encoded in the old format. This leaves a bit of an ugly conundrum, and a hacky solution. If the initial attempt to parse the "proper" options fails,

Re: [Qemu-block] [PATCH v3 4/4] block/rbd: add deprecation documenation for filename keyvalue pairs

2018-09-11 Thread Jeff Cody
On Tue, Sep 11, 2018 at 04:56:36PM -0500, Eric Blake wrote: > [MAINTAINERS says libvir-list should have been cc'd; not sure why that > didn't happen] > Thanks > On 9/11/18 4:34 PM, Jeff Cody wrote: > >Signed-off-by: Jeff Cody > > In the subject: s/documenation/documentation/ > > >--- > >

Re: [Qemu-block] [PATCH v3 4/4] block/rbd: add deprecation documenation for filename keyvalue pairs

2018-09-11 Thread Eric Blake
[MAINTAINERS says libvir-list should have been cc'd; not sure why that didn't happen] On 9/11/18 4:34 PM, Jeff Cody wrote: Signed-off-by: Jeff Cody In the subject: s/documenation/documentation/ --- qemu-deprecated.texi | 7 +++ 1 file changed, 7 insertions(+) diff --git

[Qemu-block] [PATCH v3 3/4] block/rbd: add iotest for rbd legacy keyvalue filename parsing

2018-09-11 Thread Jeff Cody
This is a small test that will check for the ability to parse both legacy and modern options for rbd. The way the test is set up is for failure to occur, but without having to wait to timeout on a non-existent rbd server. The error messages in the success path show that the arguments were

[Qemu-block] [PATCH v3 0/4] block/rbd: enable filename parsing on open

2018-09-11 Thread Jeff Cody
Changes from v2: = Patch 4: New, document deprecation. [Eric] Patch 3,2: Add r-b's Changes from v1: = Patch 1: Don't pass unused BlockDriverState to helper function Patch 2: Do not allow mixed usage; fail if keyvalue is present [Eric] Add deprecation

[Qemu-block] [PATCH v3 2/4] block/rbd: Attempt to parse legacy filenames

2018-09-11 Thread Jeff Cody
When we converted rbd to get rid of the older key/value-centric encoding format, we broke compatibility with image files with backing file strings encoded in the old format. This leaves a bit of an ugly conundrum, and a hacky solution. If the initial attempt to parse the "proper" options fails,

[Qemu-block] [PATCH v3 4/4] block/rbd: add deprecation documenation for filename keyvalue pairs

2018-09-11 Thread Jeff Cody
Signed-off-by: Jeff Cody --- qemu-deprecated.texi | 7 +++ 1 file changed, 7 insertions(+) diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 1b9c007f12..4df8ac442d 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -190,6 +190,13 @@ used instead. In order to

[Qemu-block] [PATCH v3 1/4] block/rbd: pull out qemu_rbd_convert_options

2018-09-11 Thread Jeff Cody
Code movement to pull the conversion from Qdict to BlockdevOptionsRbd into a helper function. Reviewed-by: Eric Blake Reviewed-by: John Snow Signed-off-by: Jeff Cody --- block/rbd.c | 36 1 file changed, 24 insertions(+), 12 deletions(-) diff --git

Re: [Qemu-block] [PATCH v2 3/3] block/rbd: add iotest for rbd legacy keyvalue filename parsing

2018-09-11 Thread Eric Blake
On 9/11/18 3:43 PM, Jeff Cody wrote: This is a small test that will check for the ability to parse both legacy and modern options for rbd. The way the test is set up is for failure to occur, but without having to wait to timeout on a non-existent rbd server. The error messages in the success

Re: [Qemu-block] [PATCH v2 2/3] block/rbd: Attempt to parse legacy filenames

2018-09-11 Thread Jeff Cody
On Tue, Sep 11, 2018 at 04:05:45PM -0500, Eric Blake wrote: > On 9/11/18 3:43 PM, Jeff Cody wrote: > >When we converted rbd to get rid of the older key/value-centric > >encoding format, we broke compatibility with image files with backing > >file strings encoded in the old format. > > > >This

Re: [Qemu-block] [PATCH v2 2/3] block/rbd: Attempt to parse legacy filenames

2018-09-11 Thread Eric Blake
On 9/11/18 3:43 PM, Jeff Cody wrote: When we converted rbd to get rid of the older key/value-centric encoding format, we broke compatibility with image files with backing file strings encoded in the old format. This leaves a bit of an ugly conundrum, and a hacky solution. If the initial

[Qemu-block] [PATCH v2 3/3] block/rbd: add iotest for rbd legacy keyvalue filename parsing

2018-09-11 Thread Jeff Cody
This is a small test that will check for the ability to parse both legacy and modern options for rbd. The way the test is set up is for failure to occur, but without having to wait to timeout on a non-existent rbd server. The error messages in the success path show that the arguments were

[Qemu-block] [PATCH v2 1/3] block/rbd: pull out qemu_rbd_convert_options

2018-09-11 Thread Jeff Cody
Code movement to pull the conversion from Qdict to BlockdevOptionsRbd into a helper function. Reviewed-by: Eric Blake Reviewed-by: John Snow Signed-off-by: Jeff Cody --- block/rbd.c | 36 1 file changed, 24 insertions(+), 12 deletions(-) diff --git

[Qemu-block] [PATCH v2 0/3] block/rbd: enable filename parsing on open

2018-09-11 Thread Jeff Cody
Changes from v1: Patch 1: Don't pass unused BlockDriverState to helper function Patch 2: Do not allow mixed usage; fail if keyvalue is present [Eric] Add deprecation warning [John] Pull legacy parsing code into function [John] Fixed filename leak Patch 3: New; iotest

[Qemu-block] [PATCH v2 2/3] block/rbd: Attempt to parse legacy filenames

2018-09-11 Thread Jeff Cody
When we converted rbd to get rid of the older key/value-centric encoding format, we broke compatibility with image files with backing file strings encoded in the old format. This leaves a bit of an ugly conundrum, and a hacky solution. If the initial attempt to parse the "proper" options fails,

Re: [Qemu-block] [Qemu-devel] [PATCH v2 4/4] qapi: add transaction support for x-block-dirty-bitmap-merge

2018-09-11 Thread John Snow
On 07/06/2018 07:36 AM, Vladimir Sementsov-Ogievskiy wrote: > New action is like clean action: do the whole thing in .prepare and > undo in .abort. This behavior for bitmap-changing actions is needed > because backup job actions use bitmap in .prepare. > > Signed-off-by: Vladimir

Re: [Qemu-block] [Qemu-devel] [PATCH 2/2] block/rbd: Attempt to parse legacy filenames

2018-09-11 Thread John Snow
On 09/11/2018 02:37 PM, Jeff Cody wrote: > On Tue, Sep 11, 2018 at 02:22:31PM -0400, John Snow wrote: >> >> >> On 09/11/2018 01:15 AM, Jeff Cody wrote: >>> When we converted rbd to get rid of the older key/value-centric >>> encoding format, we broke compatibility with image files with backing

Re: [Qemu-block] [Qemu-devel] [PATCH 2/2] block/rbd: Attempt to parse legacy filenames

2018-09-11 Thread Jeff Cody
On Tue, Sep 11, 2018 at 02:22:31PM -0400, John Snow wrote: > > > On 09/11/2018 01:15 AM, Jeff Cody wrote: > > When we converted rbd to get rid of the older key/value-centric > > encoding format, we broke compatibility with image files with backing > > file strings encoded in the old format. > >

Re: [Qemu-block] [Qemu-devel] [PATCH 2/2] block/rbd: Attempt to parse legacy filenames

2018-09-11 Thread Jeff Cody
On Tue, Sep 11, 2018 at 01:03:44PM -0500, Eric Blake wrote: > On 9/11/18 12:15 AM, Jeff Cody wrote: > >When we converted rbd to get rid of the older key/value-centric > >encoding format, we broke compatibility with image files with backing > >file strings encoded in the old format. > > > >This

Re: [Qemu-block] [Qemu-devel] [PATCH 2/2] block/rbd: Attempt to parse legacy filenames

2018-09-11 Thread John Snow
On 09/11/2018 01:15 AM, Jeff Cody wrote: > When we converted rbd to get rid of the older key/value-centric > encoding format, we broke compatibility with image files with backing > file strings encoded in the old format. > > This leaves a bit of an ugly conundrum, and a hacky solution. > > If

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] block/rbd: pull out qemu_rbd_convert_options

2018-09-11 Thread John Snow
On 09/11/2018 01:15 AM, Jeff Cody wrote: > Code movement to pull the conversion from Qdict to BlockdevOptionsRbd > into a helper function. > > Signed-off-by: Jeff Cody > --- > block/rbd.c | 36 > 1 file changed, 24 insertions(+), 12 deletions(-) > > diff

Re: [Qemu-block] [Qemu-devel] [PATCH 2/2] block/rbd: Attempt to parse legacy filenames

2018-09-11 Thread Eric Blake
On 9/11/18 12:15 AM, Jeff Cody wrote: When we converted rbd to get rid of the older key/value-centric encoding format, we broke compatibility with image files with backing file strings encoded in the old format. This leaves a bit of an ugly conundrum, and a hacky solution. If the initial

Re: [Qemu-block] [PATCH 2/2] block/rbd: Attempt to parse legacy filenames

2018-09-11 Thread Jeff Cody
On Tue, Sep 11, 2018 at 01:15:49AM -0400, Jeff Cody wrote: > When we converted rbd to get rid of the older key/value-centric > encoding format, we broke compatibility with image files with backing > file strings encoded in the old format. > > This leaves a bit of an ugly conundrum, and a hacky

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] block/rbd: pull out qemu_rbd_convert_options

2018-09-11 Thread Eric Blake
On 9/11/18 12:15 AM, Jeff Cody wrote: Code movement to pull the conversion from Qdict to BlockdevOptionsRbd into a helper function. Signed-off-by: Jeff Cody --- block/rbd.c | 36 1 file changed, 24 insertions(+), 12 deletions(-) - +r =

Re: [Qemu-block] [PATCH 2/2] virtio-scsi/virtio-blk: Disable poll handlers when stopping vq handler

2018-09-11 Thread Paolo Bonzini
On 11/09/2018 16:12, Fam Zheng wrote: > On Tue, 09/11 13:32, Paolo Bonzini wrote: >> On 10/09/2018 16:56, Fam Zheng wrote: >>> We have this unwanted call stack: >>> >>> > ... >>> > #13 0x5586602b7793 in virtio_scsi_handle_cmd_vq >>> > #14 0x5586602b8d66 in

Re: [Qemu-block] [PATCH 2/2] virtio-scsi/virtio-blk: Disable poll handlers when stopping vq handler

2018-09-11 Thread Fam Zheng
On Tue, 09/11 13:32, Paolo Bonzini wrote: > On 10/09/2018 16:56, Fam Zheng wrote: > > We have this unwanted call stack: > > > > > ... > > > #13 0x5586602b7793 in virtio_scsi_handle_cmd_vq > > > #14 0x5586602b8d66 in virtio_scsi_data_plane_handle_cmd > > > #15 0x5586602ddab7 in

Re: [Qemu-block] [Qemu-devel] [PATCH v1 1/1] qemu-img: add new function to remove bitmap in image

2018-09-11 Thread Eric Blake
On 9/11/18 8:56 AM, Eric Blake wrote: +    bitmap = bdrv_find_dirty_bitmap(bs, bitmapname); + +    /* + * Dirty bitmap may not be load if the 'IN_USE' flag is set (e.g. the + * qemu thread is corrupted and the 'IN_USE' flag is not be cleared), + * so the result of

Re: [Qemu-block] [Qemu-devel] [PATCH v1 0/1] qemu-img: add new function to remove bitmap in image

2018-09-11 Thread Eric Blake
On 9/11/18 3:37 AM, Ma Haocong wrote: Hello, In our scene, we need to delete dirty-bitmap created by using qmp command 'block-dirty-bitmap-add'. we can use qmp command 'block-dirty-bitmap-remove' to remove bitmap. Then I think that we should add a new function in qemu-img to do the same work.

Re: [Qemu-block] [Qemu-devel] [PATCH v1 1/1] qemu-img: add new function to remove bitmap in image

2018-09-11 Thread Eric Blake
On 9/11/18 3:37 AM, Ma Haocong wrote: Signed-off-by: Ma Haocong --- qemu-img-cmds.hx | 6 +++ qemu-img.c | 119 +++ 2 files changed, 125 insertions(+) diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx index 1526f327a5..cc397b64e4

Re: [Qemu-block] [PATCH v2 3/3] Delete PID file on exit

2018-09-11 Thread Paolo Bonzini
On 07/09/2018 14:13, Marc-André Lureau wrote: > Register an exit notifier to remove the PID file. By the time atexit() > is called, qemu_write_pidfile() guarantees QEMU owns the PID file, > thus we could safely remove it when exiting. > > Signed-off-by: Marc-André Lureau Queued this one, too.

Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/3] util: add qemu_write_pidfile()

2018-09-11 Thread Paolo Bonzini
On 07/09/2018 16:03, Eric Blake wrote: > On 09/07/2018 07:13 AM, Marc-André Lureau wrote: >> There are variants of qemu_create_pidfile() in qemu-pr-helper and >> qemu-ga. Let's have a common implementation in libqemuutil. >> > > Unrelated to this patch, but a question that this raises: should >

Re: [Qemu-block] [PATCH 0/3] util: add qemu_write_pidfile()

2018-09-11 Thread Paolo Bonzini
On 31/08/2018 16:53, Marc-André Lureau wrote: > Hi, > > Here are a few PID file related patches extracted from "[PATCH v4 > 00/29] vhost-user for input & GPU" series, with suggestions from > Daniel Berrangé. > > thanks > > Marc-André Lureau (3): > util: add qemu_write_pidfile() > util: use

[Qemu-block] [PATCH v1 0/1] qemu-img: add new function to remove bitmap in image

2018-09-11 Thread Ma Haocong
Hello, In our scene, we need to delete dirty-bitmap created by using qmp command 'block-dirty-bitmap-add'. we can use qmp command 'block-dirty-bitmap-remove' to remove bitmap. Then I think that we should add a new function in qemu-img to do the same work. The command format is: qemu-img

[Qemu-block] [PATCH v1 1/1] qemu-img: add new function to remove bitmap in image

2018-09-11 Thread Ma Haocong
Signed-off-by: Ma Haocong --- qemu-img-cmds.hx | 6 +++ qemu-img.c | 119 +++ 2 files changed, 125 insertions(+) diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx index 1526f327a5..cc397b64e4 100644 --- a/qemu-img-cmds.hx +++

Re: [Qemu-block] [PATCH 2/2] virtio-scsi/virtio-blk: Disable poll handlers when stopping vq handler

2018-09-11 Thread Paolo Bonzini
On 10/09/2018 16:56, Fam Zheng wrote: > We have this unwanted call stack: > > > ... > > #13 0x5586602b7793 in virtio_scsi_handle_cmd_vq > > #14 0x5586602b8d66 in virtio_scsi_data_plane_handle_cmd > > #15 0x5586602ddab7 in virtio_queue_notify_aio_vq > > #16 0x5586602dfc9f

Re: [Qemu-block] [PATCH 06/14] block: Add missing locking in bdrv_co_drain_bh_cb()

2018-09-11 Thread Kevin Wolf
Am 11.09.2018 um 11:28 hat Sergio Lopez geschrieben: > On Tue, Sep 11, 2018 at 11:17:20AM +0200, Kevin Wolf wrote: > > Am 11.09.2018 um 10:23 hat Fam Zheng geschrieben: > > > On Fri, 09/07 18:15, Kevin Wolf wrote: > > > > bdrv_do_drained_begin/end() assume that they are called with the > > > >

Re: [Qemu-block] [PATCH 06/14] block: Add missing locking in bdrv_co_drain_bh_cb()

2018-09-11 Thread Sergio Lopez
On Tue, Sep 11, 2018 at 11:17:20AM +0200, Kevin Wolf wrote: > Am 11.09.2018 um 10:23 hat Fam Zheng geschrieben: > > On Fri, 09/07 18:15, Kevin Wolf wrote: > > > bdrv_do_drained_begin/end() assume that they are called with the > > > AioContext lock of bs held. If we call drain functions from a

Re: [Qemu-block] [PATCH 11/14] mirror: Fix potential use-after-free in active commit

2018-09-11 Thread Kevin Wolf
Am 11.09.2018 um 10:31 hat Fam Zheng geschrieben: > On Fri, 09/07 18:15, Kevin Wolf wrote: > > When starting an active commit job, other callbacks can run before > > mirror_start_job() calls bdrv_ref() where needed and cause the nodes to > > go away. Add another pair of bdrv_ref/unref() around it

Re: [Qemu-block] [PATCH 06/14] block: Add missing locking in bdrv_co_drain_bh_cb()

2018-09-11 Thread Kevin Wolf
Am 11.09.2018 um 10:23 hat Fam Zheng geschrieben: > On Fri, 09/07 18:15, Kevin Wolf wrote: > > bdrv_do_drained_begin/end() assume that they are called with the > > AioContext lock of bs held. If we call drain functions from a coroutine > > with the AioContext lock held, we yield and schedule a BH

Re: [Qemu-block] [PATCH for-3.1 v10 00/31] block: Fix some filename generation issues

2018-09-11 Thread Kevin Wolf
Am 10.09.2018 um 18:51 hat Max Reitz geschrieben: > On 10.09.18 17:18, Kevin Wolf wrote: > > Am 09.08.2018 um 23:34 hat Max Reitz geschrieben: > >> Once more, I’ll spare both me and you another iteration of the cover > >> letter, so see here: > >> > >>

Re: [Qemu-block] [PATCH for-3.1 v10 04/31] block: Add BDS.auto_backing_file

2018-09-11 Thread Alberto Garcia
On Thu 09 Aug 2018 11:35:01 PM CEST, Max Reitz wrote: > @@ -295,11 +296,13 @@ static int qcow_open(BlockDriverState *bs, QDict > *options, int flags, > goto fail; > } > ret = bdrv_pread(bs->file, header.backing_file_offset, > - bs->backing_file,

Re: [Qemu-block] [PATCH 14/14] test-bdrv-drain: Test nested poll in bdrv_drain_poll_top_level()

2018-09-11 Thread Fam Zheng
On Fri, 09/07 18:15, Kevin Wolf wrote: > This is a regression test for a deadlock that could occur in callbacks > called from the aio_poll() in bdrv_drain_poll_top_level(). The > AioContext lock wasn't released and therefore would be taken a second > time in the callback. This would cause a

Re: [Qemu-block] [PATCH 13/14] block: Remove aio_poll() in bdrv_drain_poll variants

2018-09-11 Thread Fam Zheng
On Fri, 09/07 18:15, Kevin Wolf wrote: > bdrv_drain_poll_top_level() was buggy because it didn't release the > AioContext lock of the node to be drained before calling aio_poll(). > This way, callbacks called by aio_poll() would possibly take the lock a > second time and run into a deadlock with a

Re: [Qemu-block] [PATCH 12/14] blockjob: Lie better in child_job_drained_poll()

2018-09-11 Thread Fam Zheng
On Fri, 09/07 18:15, Kevin Wolf wrote: > Block jobs claim in .drained_poll() that they are in a quiescent state > as soon as job->deferred_to_main_loop is true. This is obviously wrong, > they still have a completion BH to run. We only get away with this > because commit 91af091f923 added an

Re: [Qemu-block] [PATCH 11/14] mirror: Fix potential use-after-free in active commit

2018-09-11 Thread Fam Zheng
On Fri, 09/07 18:15, Kevin Wolf wrote: > When starting an active commit job, other callbacks can run before > mirror_start_job() calls bdrv_ref() where needed and cause the nodes to > go away. Add another pair of bdrv_ref/unref() around it to protect > against this case. > > Signed-off-by: Kevin

Re: [Qemu-block] [PATCH 10/14] block-backend: Decrease in_flight only after callback

2018-09-11 Thread Fam Zheng
On Fri, 09/07 18:15, Kevin Wolf wrote: > Request callbacks can do pretty much anything, including operations that > will yield from the coroutine (such as draining the backend). In that > case, a decreased in_flight would be visible to other code and could > lead to a drain completing while the

Re: [Qemu-block] [PATCH 09/14] block-backend: Fix potential double blk_delete()

2018-09-11 Thread Fam Zheng
On Fri, 09/07 18:15, Kevin Wolf wrote: > blk_unref() first decreases the refcount of the BlockBackend and calls > blk_delete() if the refcount reaches zero. Requests can still be in > flight at this point, they are only drained during blk_delete(): > > At this point, arbitrary callbacks can run.

Re: [Qemu-block] [PATCH 08/14] block-backend: Add .drained_poll callback

2018-09-11 Thread Fam Zheng
On Fri, 09/07 18:15, Kevin Wolf wrote: > A bdrv_drain operation must ensure that all parents are quiesced, this > includes BlockBackends. Otherwise, callbacks called by requests that are > completed on the BDS layer, but not quite yet on the BlockBackend layer > could still create new requests. >

Re: [Qemu-block] [PATCH 07/14] aio-wait: Increase num_waiters even in home thread

2018-09-11 Thread Fam Zheng
On Fri, 09/07 18:15, Kevin Wolf wrote: > Even if AIO_WAIT_WHILE() is called in the home context of the > AioContext, we still want to allow the condition to change depending on > other threads as long as they kick the AioWait. Specfically block jobs > can be running in an I/O thread and should

Re: [Qemu-block] [PATCH v2] qcow2: Release dirty entries with cache-clean-interval

2018-09-11 Thread Alberto Garcia
On Mon 10 Sep 2018 09:22:01 PM CEST, John Snow wrote: > On 08/09/2018 09:44 AM, Alberto Garcia wrote: >> The cache-clean-interval option is used to periodically release unused >> entries from the L2 and refcount caches. Dirty cache entries are left >> untouched, even if they are otherwise valid

Re: [Qemu-block] [PATCH 06/14] block: Add missing locking in bdrv_co_drain_bh_cb()

2018-09-11 Thread Fam Zheng
On Fri, 09/07 18:15, Kevin Wolf wrote: > bdrv_do_drained_begin/end() assume that they are called with the > AioContext lock of bs held. If we call drain functions from a coroutine > with the AioContext lock held, we yield and schedule a BH to move out of > coroutine context. This means that the

Re: [Qemu-block] [PATCH 05/14] test-bdrv-drain: Test AIO_WAIT_WHILE() in completion callback

2018-09-11 Thread Fam Zheng
On Fri, 09/07 18:15, Kevin Wolf wrote: > This is a regression test for a deadlock that occurred in block job > completion callbacks (via job_defer_to_main_loop) because the AioContext > lock was taken twice: once in job_finish_sync() and then again in > job_defer_to_main_loop_bh(). This would

Re: [Qemu-block] [PATCH 04/14] job: Use AIO_WAIT_WHILE() in job_finish_sync()

2018-09-11 Thread Fam Zheng
On Fri, 09/07 18:15, Kevin Wolf wrote: > job_finish_sync() needs to release the AioContext lock of the job before > calling aio_poll(). Otherwise, callbacks called by aio_poll() would > possibly take the lock a second time and run into a deadlock with a > nested AIO_WAIT_WHILE() call. > > Also,

Re: [Qemu-block] [PATCH 03/14] test-blockjob: Acquire AioContext around job_finish_sync()

2018-09-11 Thread Fam Zheng
On Fri, 09/07 18:15, Kevin Wolf wrote: > All callers in QEMU proper hold the AioContext lock when calling > job_finish_sync(). test-blockjob should do the same. I think s/job_finish_sync/job_cancel_sync/ in the subject is more accurate? Reviewed-by: Fam Zheng > > Signed-off-by: Kevin Wolf >

Re: [Qemu-block] [PATCH 02/14] test-bdrv-drain: Drain with block jobs in an I/O thread

2018-09-11 Thread Fam Zheng
On Fri, 09/07 18:15, Kevin Wolf wrote: > This extends the existing drain test with a block job to include > variants where the block job runs in a different AioContext. > > Signed-off-by: Kevin Wolf Reviewed-by: Fam Zheng

Re: [Qemu-block] [PATCH 01/14] blockjob: Wake up BDS when job becomes idle

2018-09-11 Thread Fam Zheng
On Fri, 09/07 18:15, Kevin Wolf wrote: > In the context of draining a BDS, the .drained_poll callback of block > jobs is called. If this returns true (i.e. there is still some activity > pending), the drain operation may call aio_poll() with blocking=true to > wait for completion. > > As soon as