backup: follow AioContext change gracefully
commit5ab4b69ce29908b327a91966dc78ea0fd7424075
authorStefan Hajnoczi <stefanha@redhat.com>
Thu, 16 Jun 2016 16:56:29 +0000 (16 17:56 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 20 Jun 2016 13:25:41 +0000 (20 14:25 +0100)
treea7b7d329f19dc31dd39126b36798f4ad83b1e963
parent565ac01f8d35236844dd0257a185f81425cd4b6a
backup: follow AioContext change gracefully

Move s->target to the new AioContext when there is an AioContext change.

The backup_run() coroutine does not use asynchronous I/O so there is no
need to wait for in-flight requests in a BlockJobDriver->pause()
callback.

Guest writes are intercepted by the backup job.  Treat them as guest
activity and do it even while the job is paused.  This is necessary
since the only alternative would be to fail a job that experienced guest
writes during pause once the job is resumed.  In practice the guest
writes don't interfere with AioContext switching since bdrv_drain() is
used by bdrv_set_aio_context().

Loops already contain pause points because of block_job_sleep_ns() calls
in the yield_and_check() helper function.  It is necessary to convert a
raw qemu_coroutine_yield() to block_job_yield() so the
MIRROR_SYNC_MODE_NONE case can pause.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 1466096189-6477-9-git-send-email-stefanha@redhat.com
block/backup.c