rpc,lockd: Add missing netserver refcount increment on reload

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.
This commit is contained in:
Nikolay Shirokovskiy 2017-10-24 13:47:36 +03:00 committed by John Ferlan
parent 82fa7fc3ab
commit 47eb77fb33
2 changed files with 2 additions and 0 deletions

View File

@ -278,6 +278,7 @@ virLockDaemonNewPostExecRestart(virJSONValuePtr object, bool privileged)
virLockDaemonClientFree,
(void*)(intptr_t)(privileged ? 0x1 : 0x0))))
goto error;
virObjectUnref(srv);
return lockd;

View File

@ -312,6 +312,7 @@ virNetDaemonAddServerPostExec(virNetDaemonPtr dmn,
if (virHashAddEntry(dmn->servers, serverName, srv) < 0)
goto error;
virObjectRef(srv);
virJSONValueFree(object);
virObjectUnlock(dmn);