]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: refactor blockinfo job handling
authorEric Blake <eblake@redhat.com>
Fri, 14 Nov 2014 16:44:40 +0000 (09:44 -0700)
committerEric Blake <eblake@redhat.com>
Tue, 16 Dec 2014 21:12:24 +0000 (14:12 -0700)
commita20c3aafbe501cc1756341e82d33728a4d9c5b8f
tree1cc70264516e91baa6f2964ec4ddb85050ddd1d6
parent9d128a203b2e88ec8f2d31ae56540139ea9173a4
qemu: refactor blockinfo job handling

In order for a future patch to virDomainListGetStats to reuse
some code for determining disk usage of offline domains, we
need to make it easier to pull out part of the guts of grabbing
blockinfo.  The current implementation grabs a job fairly late
in the game, while getstats will already own a job; reordering
things so that the job is always grabbed up front in both
functions will make it easier to pull out the common code.
This patch results in grabbing a job in cases where one was not
previously needed, but as it is a query job, it should not be
noticeably slower.

This patch touches the same code as the fix for CVE-2014-6458
(commit b799259); in that patch, we avoided hotplug changing
a disk reference during the time of obtaining a monitor lock
by copying all data we needed and no longer referencing disk;
this patch goes the other way and ensures that by holding the
job, the disk cannot be changed so we no longer need to worry
about the disk being invalidated across the monitor lock.

* src/qemu/qemu_driver.c (qemuDomainGetBlockInfo): Rearrange job
control to be outside of disk information.

Signed-off-by: Eric Blake <eblake@redhat.com>
src/qemu/qemu_driver.c