[libvirt] [PATCH 3/4] vbox: change API (un)initialization logic.

Martin Kletzander mkletzan at redhat.com
Tue Oct 11 15:27:59 UTC 2016


On Tue, Oct 11, 2016 at 11:23:13AM -0400, Dawid Zamirski wrote:
>On Tue, 2016-10-11 at 16:22 +0200, Martin Kletzander wrote:
>> On Wed, Sep 28, 2016 at 01:41:35PM -0400, Dawid Zamirski wrote:
>> >
>> > * _pfnUnitilalize decrements connectionCount in g_pVBoxGlobalData
>> > and
>> >  once it is down to 0, it calls pfnComUnitialize and
>> >  g_pVBoxGlobalData if free'd. This ensures that pfnComInitialize
>> > and
>> >  pfnComUnitialize pair is called only once, even when multiple
>> >  concurrent connections are in use.
>>
>> That's not true if there is a connection being made while it is being
>> free()d or it's being allocated in two threads, etc.  Unless I missed
>> something, that is.
>
>On a second thought, seeing how both _pfnInitialize and _pfnUnintialize
>(each called in virConnectOpen/Close respectively) obtain a mutex on
>g_pVBoxGlobalData, I think my original statement holds true, that is,
>ignoring the unsafe allocation of the global as you pointed out
>earlier.
>

They can't take mutex on g_pVBoxGlobalData if it is not initialized
(allocated) yet.  Or is there another one?

>--
>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: 801 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20161011/6ac021bd/attachment-0001.sig>


More information about the libvir-list mailing list