[libvirt] [PATCH 2/3] qemu: event: Don't fiddle with disk backing trees without a job

Michael Chapman mike at very.puzzling.org
Wed Apr 8 06:35:09 UTC 2015

On Fri, 13 Mar 2015, Peter Krempa wrote:
> Surprisingly we did not grab a VM job when a block job finished and we'd
> happily rewrite the backing chain data. This made it possible to crash
> libvirt when queueing two backing chains tightly and other badness.
> To fix it, add yet another handler to the helper thread that handles
> monitor events that require a job.

Hi Peter,

Unfortunately, I think this change has broken disk mirroring during 
migration. When a disk mirror is ready (or aborted), processBlockJobEvent 
blocks when beginning its MODIFY job because of the ongoing MIGRATION_OUT 
async job.

I'd like to solve this by making use of blockJobSync from within 
qemuMigrationDriveMirror. This is also going to fix another bug where 
libvirt doesn't wait for QEMU to complete the drive mirroring before 
migrating a VM (leading to disk corruption if there's ongoing writes!)

The plan would be to move qemuBlockJobEventProcess into a separate 
qemu_blockjob.c, so it can be used from both qemu_driver and 
qemu_migration, along with a few helper functions to set up blockJobSync 
and to wait for it to be notified. Do you think this would be a suitable 

- Michael

More information about the libvir-list mailing list