]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
rpc,lockd: Add missing netserver refcount increment on reload
authorNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Tue, 24 Oct 2017 10:47:36 +0000 (13:47 +0300)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 6 Nov 2017 21:19:11 +0000 (16:19 -0500)
After the virNetDaemonAddServerPostExec call in virtlogd we should have
netserver refcount set to 2. One goes to netdaemon servers hashtable
and one goes to virt{logd,lock} own reference to netserver. Let's add
the missing increment in virNetDaemonAddServerPostExec itself while
holding the daemon lock.

Since lockd defers management of the @srv object by the presence
in the hash table, virLockDaemonNewPostExecRestart must Unref the
alloc'd Ref on the @srv object done as part of virNetDaemonAddServerPostExec
and virNetServerNewPostExecRestart processing. The virNetDaemonGetServer
in lock_daemon main will also take a reference which is Unref'd during
main cleanup.

src/locking/lock_daemon.c
src/rpc/virnetdaemon.c

index 1b7fd86b3ab11b9f02fc255e9170fc2ddbc0534d..0d5e999ef4a9c66f5c3a1e0454f46ae95dd13703 100644 (file)
@@ -278,6 +278,7 @@ virLockDaemonNewPostExecRestart(virJSONValuePtr object, bool privileged)
                                               virLockDaemonClientFree,
                                               (void*)(intptr_t)(privileged ? 0x1 : 0x0))))
         goto error;
+    virObjectUnref(srv);
 
     return lockd;
 
index e3b9390af2e45d44cac22e7c6b4924fdd72ff621..8c2141489710b16a114937bf8ec74d52de8c7a94 100644 (file)
@@ -312,6 +312,7 @@ virNetDaemonAddServerPostExec(virNetDaemonPtr dmn,
 
     if (virHashAddEntry(dmn->servers, serverName, srv) < 0)
         goto error;
+    virObjectRef(srv);
 
     virJSONValueFree(object);
     virObjectUnlock(dmn);