[PATCH 4/4] qemuMonitorOpen: Rework domain object refcounting
Ján Tomko
jtomko at redhat.com
Fri Nov 12 12:13:20 UTC 2021
On a Friday in 2021, Michal Privoznik wrote:
>Similarly to one of previous commits, there's no need to
>increment domain object refcounter before unlocking it. Any
>number of lock and unlock calls over domain object has no effect
>on the refcounter.
There is no need because the caller holds a reference. The locks having
no effect on the refcounter is not required, since they would be
balanced anyway.
Jano
>
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>---
> src/qemu/qemu_monitor.c | 5 -----
> 1 file changed, 5 deletions(-)
>
>diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
>index 908ee0d302..7559020001 100644
>--- a/src/qemu/qemu_monitor.c
>+++ b/src/qemu/qemu_monitor.c
>@@ -769,10 +769,6 @@ qemuMonitorOpen(virDomainObj *vm,
>
> timeout += QEMU_DEFAULT_MONITOR_WAIT;
>
>- /* Hold an extra reference because we can't allow 'vm' to be
>- * deleted until the monitor gets its own reference. */
>- virObjectRef(vm);
>-
> if (config->type != VIR_DOMAIN_CHR_TYPE_UNIX) {
> virReportError(VIR_ERR_INTERNAL_ERROR,
> _("unable to handle monitor type: %s"),
>@@ -798,7 +794,6 @@ qemuMonitorOpen(virDomainObj *vm,
> cleanup:
> if (!ret)
> VIR_FORCE_CLOSE(fd);
>- virObjectUnref(vm);
> return ret;
> }
>
>--
>2.32.0
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20211112/0276d6cf/attachment-0001.sig>
More information about the libvir-list
mailing list