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.bat...@oracle.com>
---
 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@lists.libvirt.org
To unsubscribe send an email to devel-le...@lists.libvirt.org

Reply via email to