[PATCH 08/11] qemuhotplugtest: Fix misleading comment on monitor unlock

Michal Privoznik posted 11 patches 1 year, 7 months ago
[PATCH 08/11] qemuhotplugtest: Fix misleading comment on monitor unlock
Posted by Michal Privoznik 1 year, 7 months ago
There's a comment in testQemuHotplug() trying to explain why we
need to unlock the monitor object. Well, while it might have been
correct when being introduced, it's no long factually correct as
just any function (attach/detach/update) might talk to the
monitor and it expects the monitor to be unlocked (as it calls
qemuDomainObjEnterMonitor() + qemuDomainObjExitMonitor()).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 tests/qemuhotplugtest.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index b4c03d5374..9a1cf8ab2f 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -223,9 +223,8 @@ testQemuHotplug(const void *data)
     priv = vm->privateData;
     priv->mon = qemuMonitorTestGetMonitor(test_mon);
 
-    /* XXX We need to unlock the monitor here, as
-     * qemuDomainObjEnterMonitorInternal (called from qemuDomainChangeGraphics)
-     * tries to lock it again */
+    /* We need to unlock the monitor here, as any function below talks
+     * (transitively) on the monitor. */
     virObjectUnlock(priv->mon);
 
     switch (test->action) {
-- 
2.39.2
Re: [PATCH 08/11] qemuhotplugtest: Fix misleading comment on monitor unlock
Posted by Kristina Hanicova 1 year, 7 months ago
On Fri, Apr 21, 2023 at 10:25 AM Michal Privoznik <mprivozn@redhat.com>
wrote:

> There's a comment in testQemuHotplug() trying to explain why we
> need to unlock the monitor object. Well, while it might have been
> correct when being introduced, it's no long factually correct as
>
*no longer

> just any function (attach/detach/update) might talk to the
> monitor and it expects the monitor to be unlocked (as it calls
> qemuDomainObjEnterMonitor() + qemuDomainObjExitMonitor()).
>
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  tests/qemuhotplugtest.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> Reviewed-by: Kristina Hanicova <khanicov@redhat.com>

Kristina