[libvirt] [PATCH RESEND] qemu: Do not free the device from activePciHostdevs if it's in use
Eric Blake
eblake at redhat.com
Wed Dec 14 22:57:06 UTC 2011
On 11/29/2011 03:23 AM, Osier Yang wrote:
> * src/qemu/qemu_hostdev.c (qemuDomainReAttachHostdevDevices):
> pciDeviceListFree(pcidevs) in the end free()s the device even if
> it's in use by other domain, which can cause rase.
s/rase/a race/
...
>
> The patch also fixes another problem, there won't be error like
> "qemuDomainReAttachHostdevDevices: Not reattaching active
> device 0000:00:19.0" in daemon log if some device is in active.
> As pciResetDevice and pciReattachDevice won't be called for
> the device anymore. This is sensiable as we already reported
s/sensiable/sensible/
> error when preparing the device if it's active. Blindly trying
> to pciResetDevice & pciReattachDevice on the device and getting
> an error is just redundant.
> ---
> src/qemu/qemu_hostdev.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
> index 9137388..60401f0 100644
> --- a/src/qemu/qemu_hostdev.c
> +++ b/src/qemu/qemu_hostdev.c
> @@ -414,8 +414,10 @@ void qemuDomainReAttachHostdevDevices(struct qemud_driver *driver,
> */
> activeDev = pciDeviceListFind(driver->activePciHostdevs, dev);
> if (activeDev &&
> - STRNEQ_NULLABLE(name, pciDeviceGetUsedBy(activeDev)))
> + STRNEQ_NULLABLE(name, pciDeviceGetUsedBy(activeDev))) {
> + pciDeviceListSteal(pcidevs, dev);
> continue;
> + }
Awfully short patch compared to the commit message :)
Sorry for taking so long to review, and:
ACK.
--
Eric Blake eblake at redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111214/034b5fb6/attachment-0001.sig>
More information about the libvir-list
mailing list