[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 12/14] blockjob: Lie better in child_job_drained
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [PATCH 12/14] blockjob: Lie better in child_job_drained_poll() |
Date: |
Tue, 11 Sep 2018 16:34:49 +0800 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
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 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.
>
> Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
- Re: [Qemu-devel] [PATCH 11/14] mirror: Fix potential use-after-free in active commit, (continued)
- [Qemu-devel] [PATCH 08/14] block-backend: Add .drained_poll callback, Kevin Wolf, 2018/09/07
- [Qemu-devel] [PATCH 10/14] block-backend: Decrease in_flight only after callback, Kevin Wolf, 2018/09/07
- [Qemu-devel] [PATCH 13/14] block: Remove aio_poll() in bdrv_drain_poll variants, Kevin Wolf, 2018/09/07
- [Qemu-devel] [PATCH 09/14] block-backend: Fix potential double blk_delete(), Kevin Wolf, 2018/09/07
- [Qemu-devel] [PATCH 12/14] blockjob: Lie better in child_job_drained_poll(), Kevin Wolf, 2018/09/07
- Re: [Qemu-devel] [PATCH 12/14] blockjob: Lie better in child_job_drained_poll(),
Fam Zheng <=
- [Qemu-devel] [PATCH 14/14] test-bdrv-drain: Test nested poll in bdrv_drain_poll_top_level(), Kevin Wolf, 2018/09/07