[libvirt] [PATCH v5 2/3] virtlogd: add missing netserver refcount increment on reload

John Ferlan posted 3 patches 7 years, 6 months ago
[libvirt] [PATCH v5 2/3] virtlogd: add missing netserver refcount increment on reload
Posted by John Ferlan 7 years, 6 months ago
From: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>

After virNetDaemonAddServerPostExec call in virtlogd we should have
netserver refcount set to 2. One goes to netdaemon servers hashtable
and one goes to virtlogd own reference to netserver. Let's add
missing increment in virNetDaemonAddServerPostExec itself while holding
daemon lock.

We also have to unref new extra ref after virtlockd call to
virNetDaemonAddServerPostExec since it mgmt of the @srv would
be assumed to be handled by the Hash Table.

Signed-off-by: John Ferlan <jferlan@redhat.com>
---
 src/locking/lock_daemon.c | 1 +
 src/rpc/virnetdaemon.c    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index 1b7fd86b3a..0d5e999ef4 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -278,6 +278,7 @@ virLockDaemonNewPostExecRestart(virJSONValuePtr object, bool privileged)
                                               virLockDaemonClientFree,
                                               (void*)(intptr_t)(privileged ? 0x1 : 0x0))))
         goto error;
+    virObjectUnref(srv);
 
     return lockd;
 
diff --git a/src/rpc/virnetdaemon.c b/src/rpc/virnetdaemon.c
index e3b9390af2..8c21414897 100644
--- a/src/rpc/virnetdaemon.c
+++ b/src/rpc/virnetdaemon.c
@@ -312,6 +312,7 @@ virNetDaemonAddServerPostExec(virNetDaemonPtr dmn,
 
     if (virHashAddEntry(dmn->servers, serverName, srv) < 0)
         goto error;
+    virObjectRef(srv);
 
     virJSONValueFree(object);
     virObjectUnlock(dmn);
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v5 2/3] virtlogd: add missing netserver refcount increment on reload
Posted by Martin Kletzander 7 years, 6 months ago
On Mon, Oct 30, 2017 at 07:14:38AM -0400, John Ferlan wrote:
>From: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
>
>After virNetDaemonAddServerPostExec call in virtlogd we should have
>netserver refcount set to 2. One goes to netdaemon servers hashtable
>and one goes to virtlogd own reference to netserver. Let's add
>missing increment in virNetDaemonAddServerPostExec itself while holding
>daemon lock.
>
>We also have to unref new extra ref after virtlockd call to
>virNetDaemonAddServerPostExec since it mgmt of the @srv would
>be assumed to be handled by the Hash Table.
>
>Signed-off-by: John Ferlan <jferlan@redhat.com>
>---
> src/locking/lock_daemon.c | 1 +
> src/rpc/virnetdaemon.c    | 1 +
> 2 files changed, 2 insertions(+)
>

ACK to this one as well.--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list