[PATCH 1/1] qemu_domain: fix vcpu hotunplug race by locking vcpupriv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



multiple parallel timedout vcpu hotunplug requests coming from qemu handled
asynchronously by libvirt can cause data corruption as they modify
vcpu data during refresh by libvirt.

Lock each vcpu before modification and then release the lock

Signed-off-by: Shaleen Bathla <shaleen.bathla@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 3469f0d40c59..15ec1b0a771a 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -10084,6 +10084,7 @@ qemuDomainRefreshVcpuInfo(virDomainObj *vm,
     for (i = 0; i < maxvcpus; i++) {
         vcpu = virDomainDefGetVcpu(vm->def, i);
         vcpupriv = QEMU_DOMAIN_VCPU_PRIVATE(vcpu);
+        virObjectLock(vcpupriv);
 
         if (validTIDs)
             vcpupriv->tid = info[i].tid;
@@ -10113,6 +10114,7 @@ qemuDomainRefreshVcpuInfo(virDomainObj *vm,
             else
                 vcpu->hotpluggable = VIR_TRISTATE_BOOL_NO;
         }
+        virObjectUnlock(vcpupriv);
     }
 
     ret = 0;
-- 
2.39.3
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux