From: Nikolay Shirokovskiy Date: Tue, 24 Oct 2017 10:47:36 +0000 (+0300) Subject: rpc,lockd: Add missing netserver refcount increment on reload X-Git-Tag: v3.10.0-rc1~227 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47eb77fb33b3b2c1485cafb606402826169b42fa;p=thirdparty%2Flibvirt.git 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. --- 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);