[libvirt] [PATCH] daemon: Move TLS initialization to virInitialize
Eric Blake
eblake at redhat.com
Wed Aug 24 15:05:48 UTC 2011
On 08/24/2011 08:58 AM, Daniel P. Berrange wrote:
>> Either we need a virDeinitialize which does the virNetTLSDeinit, and
>> libvirtd calls virDeinitialize; or you can just drop all calls to
>> virNetTLSDeinit.
>
> deinitialize is really a waste of time, or even wrong. Some
> other libraries libvirt links to might also use TLS, so we
> can't ever be sure it is safe to deinitialize. Even in the
> daemon i think it is pretty pointless.
If init and deinit are reference counted, then deinit makes sense -
reduce the reference count when our library is done using it without
unloading it from any other library, and if our library was the last
client, then reclaim the resources. But if this is the case, then the
client that is using us as a library has to have symmetric access points
- if virInitialize added a reference count to tls, then virDeinitialize
needs to reduce it.
But I don't know if tls deinit is reference counted - if it is not
counted in a thread-safe manner, then I agree that the only safe course
of action is to never deinit tls. And even if tls deinit is safe, it is
a waste of time to deinit in libvirtd, when we know we are about to
exit(), except in the case where we are trying to silence valgrind.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
More information about the libvir-list
mailing list