[libvirt] [PATCHv3 3/6] virsh: Unregister the connection close notifier upon termination

Eric Blake eblake at redhat.com
Mon Apr 1 23:07:13 UTC 2013


On 03/31/2013 10:20 AM, Peter Krempa wrote:
> From: Viktor Mihajlovski <mihajlov at linux.vnet.ibm.com>
> 
> Before closing the connection we unregister the close callback
> to prevent a reference leak.
> 
> Further, the messages on virConnectClose != 0 are a bit more specific
> now.
> 
> Signed-off-by: Viktor Mihajlovski <mihajlov at linux.vnet.ibm.com>
> ---
>  tools/virsh.c | 23 ++++++++++++++++++-----
>  1 file changed, 18 insertions(+), 5 deletions(-)

ACK.

Thanks to patch 2/6, you could now technically close the connection
first, then unregister the callback, and the reference held by the
callback will ensure that the connection lives long enough to let that
work even after things were "closed".  Most likely to happen if things
are multithreaded, where one thread is unregistering while another
thread is closing the connection.  But given that earlier libvirt had
problems, we obviously don't want to advertise that "backwards" approach
to cleanup.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130401/e9e02494/attachment-0001.sig>


More information about the libvir-list mailing list