[libvirt] [PATCH v4 2/2] remote: Move the call to remoteClientFreePrivateCallbacks from FreeFunc to CloseFunc

Martin Kletzander mkletzan at redhat.com
Mon Nov 13 14:31:12 UTC 2017


On Mon, Nov 13, 2017 at 09:07:58PM +0800, xinhua.Cao wrote:
>Still because of commit id 'fe8f1c8b' where we generate a REF for the
>Register and that's transparent to the consumer (e.g. how would they
>know they need to ensure that Deregister is called), thus the purpose of
>this patch is to find a way to Deregister if it's determined that the
>consumer hasn't by the time of the "last" REF we'd have.
>This solution to this problem is to alter the processing to have the
>remoteClientCloseFunc handle performing the Deregister calls instead of
>the remoteClientFreeFunc because there's no way FreeFunc would be called
>unless the Deregister was already called.

Oh, this would explain the missing bit that I was probably missing.  This patch
looks like what I really wanted this to be handled as, but still, would you be
able to sketch out a reproducer for the unlucky ones, like me?  Thanks a lot.

>---
> daemon/remote.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
>diff --git a/daemon/remote.c b/daemon/remote.c
>index 2dcec1e..c2111ae 100644
>--- a/daemon/remote.c
>+++ b/daemon/remote.c
>@@ -1738,11 +1738,9 @@ void remoteClientFreeFunc(void *data)
> {
>     struct daemonClientPrivate *priv = data;
>
>-    /* Deregister event delivery callback */
>-    if (priv->conn) {
>-        remoteClientFreePrivateCallbacks(priv);
>+    if (priv->conn)
>         virConnectClose(priv->conn);
>-    }
>+
>     VIR_FREE(priv);
> }
>
>@@ -1752,6 +1750,10 @@ static void remoteClientCloseFunc(virNetServerClientPtr client)
>     struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
>
>     daemonRemoveAllClientStreams(priv->streams);
>+
>+    /* Deregister event delivery callback */
>+    if (priv->conn)
>+        remoteClientFreePrivateCallbacks(priv);
> }
>
>
>-- 
>2.8.3
>
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20171113/d64e1262/attachment-0001.sig>


More information about the libvir-list mailing list