Blame SOURCES/libvirt-remote-Move-the-call-to-remoteClientFreePrivateCallbacks-from-FreeFunc-to-CloseFunc.patch

60e713
From e58f9ff38cdf81aec5cb627575b0203ce41ab29b Mon Sep 17 00:00:00 2001
60e713
Message-Id: <e58f9ff38cdf81aec5cb627575b0203ce41ab29b@dist-git>
60e713
From: "xinhua.Cao" <caoxinhua@huawei.com>
60e713
Date: Mon, 20 Aug 2018 10:09:00 -0400
60e713
Subject: [PATCH] remote: Move the call to remoteClientFreePrivateCallbacks
60e713
 from FreeFunc to CloseFunc
60e713
60e713
RHEL 7.6 https://bugzilla.redhat.com/show_bug.cgi?id=1610612
60e713
RHEL 7.5.z https://bugzilla.redhat.com/show_bug.cgi?id=1619206
60e713
60e713
Still because of commit id 'fe8f1c8b' where we generate a REF for the
60e713
Register and that's transparent to the consumer (e.g. how would they
60e713
know they need to ensure that Deregister is called), thus the purpose of
60e713
this patch is to find a way to Deregister if it's determined that the
60e713
consumer hasn't by the time of the "last" REF we'd have.
60e713
60e713
This solution to this problem is to alter the processing to have the
60e713
remoteClientCloseFunc handle performing the Deregister calls instead of
60e713
the remoteClientFreeFunc because there's no way FreeFunc would be called
60e713
unless the Deregister was already called.
60e713
60e713
(cherry picked from commit 1fd1b7661055577071aab36653eb8f2c2ddda804)
60e713
Signed-off-by: John Ferlan <jferlan@redhat.com>
60e713
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
60e713
---
60e713
 daemon/remote.c | 10 ++++++----
60e713
 1 file changed, 6 insertions(+), 4 deletions(-)
60e713
60e713
diff --git a/daemon/remote.c b/daemon/remote.c
60e713
index 70e1227f13..eb2f95f375 100644
60e713
--- a/daemon/remote.c
60e713
+++ b/daemon/remote.c
60e713
@@ -1737,11 +1737,9 @@ void remoteClientFreeFunc(void *data)
60e713
 {
60e713
     struct daemonClientPrivate *priv = data;
60e713
 
60e713
-    /* Deregister event delivery callback */
60e713
-    if (priv->conn) {
60e713
-        remoteClientFreePrivateCallbacks(priv);
60e713
+    if (priv->conn)
60e713
         virConnectClose(priv->conn);
60e713
-    }
60e713
+
60e713
     VIR_FREE(priv);
60e713
 }
60e713
 
60e713
@@ -1751,6 +1749,10 @@ static void remoteClientCloseFunc(virNetServerClientPtr client)
60e713
     struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
60e713
 
60e713
     daemonRemoveAllClientStreams(priv->streams);
60e713
+
60e713
+    /* Deregister event delivery callback */
60e713
+    if (priv->conn)
60e713
+        remoteClientFreePrivateCallbacks(priv);
60e713
 }
60e713
 
60e713
 
60e713
-- 
60e713
2.18.0
60e713