[Libvirt-cim] [PATCH V3 04/11] CSI, add lock to protect shared data

Wenchao Xia xiawenc at linux.vnet.ibm.com
Tue Mar 19 06:40:58 UTC 2013


于 2013-3-12 13:10, Wenchao Xia 写道:
> 于 2013-3-11 22:41, John Ferlan 写道:
>>
>> Since I don't have the email to reply-to, here is a link:
>>
>> https://www.redhat.com/archives/libvirt-cim/2012-December/msg00026.html
>>
>>
>> Why was the decision to reuse the lifecycle_mutex rather than generating
>> a data specific mutex?  Seems like that mutex is used for other
>> operations to protect filters and indications.  Thus unless the two are
>> somehow tied, I really think it'd be better to create/use a data
>> specific mutex.
>>
>> Furthermore, there's a few mutex adds around thread mgmt that probably
>> should be a separate patch. That is - the non "dom_list" protection
>> additions appear to be different.
>>
>> John
>>
>    It is just the quickest way to fix bug, it should be a separate lock
> just as mentioned in the commit message for performance, you can form a
> patch to fix it above or replace this patch.
>
>
>> _______________________________________________
>> Libvirt-cim mailing list
>> Libvirt-cim at redhat.com
>> https://www.redhat.com/mailman/listinfo/libvirt-cim
>>
>
>
   Rechecked the code, the lifecycle_mutex is original meant to protect
global variables, actually it should be declared as:
struct CSI_gloable_data {
     pthread_mutex_t lifecycle_mutex,
     bool lifecycle_enabled,
     csi_thread_data_t csi_thread_data[CSI_NUM_PLATFORMS],
};
   Since above is a pure code structure improve and need quite a change,
I hope to leave it untouched with a commit message, and rebase become
easier. So this patch will only fix lock missing problem, if worthy,
later we can send a patch fix the code struture problem as "CSI: folder
global lock and structure ", and a patch improves lock as "CSI: use
smaller lock".

-- 
Best Regards

Wenchao Xia




More information about the Libvirt-cim mailing list