[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 13/17] blockjob: Lie better in child_job_drai
From: |
Max Reitz |
Subject: |
Re: [Qemu-devel] [PATCH v2 13/17] blockjob: Lie better in child_job_drained_poll() |
Date: |
Thu, 13 Sep 2018 23:52:36 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
On 13.09.18 14:52, 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 unconditional aio_poll(false) to the
> drain functions, but this is bypassing the regular drain mechanisms.
>
> However, just removing this and telling that the job is still active
> doesn't work either: The completion callbacks themselves call drain
> functions (directly, or indirectly with bdrv_reopen), so they would
> deadlock then.
>
> As a better lie, tell that the job is active as long as the BH is
> pending, but falsely call it quiescent from the point in the BH when the
> completion callback is called. At this point, nested drain calls won't
> deadlock because they ignore the job, and outer drains will wait for the
> job to really reach a quiescent state because the callback is already
> running.
...because it's running in the main loop, so it's impossible for another
drain to run there concurrently. I suppose.
At least that's what makes this patch make sense to me.
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
> include/qemu/job.h | 3 +++
> blockjob.c | 2 +-
> job.c | 11 ++++++++++-
> 3 files changed, 14 insertions(+), 2 deletions(-)
Reviewed-by: Max Reitz <address@hidden>
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v2 12/17] mirror: Fix potential use-after-free in active commit, (continued)
- Re: [Qemu-devel] [PATCH v2 12/17] mirror: Fix potential use-after-free in active commit, Max Reitz, 2018/09/13
- Re: [Qemu-devel] [PATCH v2 12/17] mirror: Fix potential use-after-free in active commit, Max Reitz, 2018/09/13
- Re: [Qemu-devel] [PATCH v2 12/17] mirror: Fix potential use-after-free in active commit, Kevin Wolf, 2018/09/14
- Re: [Qemu-devel] [PATCH v2 12/17] mirror: Fix potential use-after-free in active commit, Max Reitz, 2018/09/16
- Re: [Qemu-devel] [PATCH v2 12/17] mirror: Fix potential use-after-free in active commit, Kevin Wolf, 2018/09/17
- Re: [Qemu-devel] [PATCH v2 12/17] mirror: Fix potential use-after-free in active commit, Max Reitz, 2018/09/18
- Re: [Qemu-devel] [PATCH v2 12/17] mirror: Fix potential use-after-free in active commit, Kevin Wolf, 2018/09/18
- Re: [Qemu-devel] [PATCH v2 12/17] mirror: Fix potential use-after-free in active commit, Max Reitz, 2018/09/18
[Qemu-devel] [PATCH v2 15/17] test-bdrv-drain: Test nested poll in bdrv_drain_poll_top_level(), Kevin Wolf, 2018/09/13
[Qemu-devel] [PATCH v2 13/17] blockjob: Lie better in child_job_drained_poll(), Kevin Wolf, 2018/09/13
- Re: [Qemu-devel] [PATCH v2 13/17] blockjob: Lie better in child_job_drained_poll(),
Max Reitz <=
[Qemu-devel] [PATCH v2 14/17] block: Remove aio_poll() in bdrv_drain_poll variants, Kevin Wolf, 2018/09/13
[Qemu-devel] [PATCH v2 16/17] job: Avoid deadlocks in job_completed_txn_abort(), Kevin Wolf, 2018/09/13
[Qemu-devel] [PATCH v2 17/17] test-bdrv-drain: AIO_WAIT_WHILE() in job .commit/.abort, Kevin Wolf, 2018/09/13