blockjob: Wake up BDS when job becomes idle
commit34dc97b9a0e592bc466bdb0bbfe45d77304a72b6
authorKevin Wolf <kwolf@redhat.com>
Fri, 17 Aug 2018 12:53:05 +0000 (17 14:53 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 25 Sep 2018 13:50:15 +0000 (25 15:50 +0200)
tree3edd653e46d14ca5fb2e1551a4cb3427875e6865
parentd1756c780b7879fb64e41135feac781d84a1f995
blockjob: Wake up BDS when job becomes idle

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 the pending activity is completed and the job finally arrives
in a quiescent state (i.e. its coroutine either yields with busy=false
or terminates), the block job must notify the aio_poll() loop to wake
up, otherwise we get a deadlock if both are running in different
threads.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
blockjob.c
include/block/blockjob.h
include/qemu/job.h
job.c