[libvirt] [PATCH v2 05/10] utils: util functions for scsi hostdev
Han Cheng
hanc.fnst at cn.fujitsu.com
Fri Apr 5 02:55:32 UTC 2013
On 04/03/2013 01:06 PM, Hu Tao wrote:
> On Mon, Apr 01, 2013 at 08:00:57PM +0800, Han Cheng wrote:
>> +int
>> +virSCSIDeviceListAdd(virSCSIDeviceListPtr list,
>> + virSCSIDevicePtr dev)
>> +{
>> + if (virSCSIDeviceListFind(list, dev)) {
>> + virReportError(VIR_ERR_INTERNAL_ERROR,
>> + _("Device %s is already in use"),
>> + dev->name);
>> + return -1;
>> + }
>> +
>> + if (VIR_REALLOC_N(list->devs, list->count+1)< 0) {
>> + virReportOOMError();
>> + return -1;
>> + }
>> +
>> + list->devs[list->count++] = dev;
>
> The list is lockable, but you're not protecting it with lock.
Yes.
But for most time, we are manipulating a local list. There is no
concurrency problem.
The only concurrency problem is about driver->activeScsiHostdevs(type of
virSCSIDeviceListPtr). We'll hold the lock if we want manipulate that.
Cheng
More information about the libvir-list
mailing list