Re: [PATCH v1 27/31] virNetworkObjListPtr: Make APIs self-locking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 26, 2015 at 15:17:36 +0100, Michal Privoznik wrote:
> Every API that touches internal structure of the object must lock
> the object first. Not every API that has the object as an
> argument needs to do that though. Some APIs just pass the object
> to lower layers, which, however, must lock the object then. Look

Too, many, commas.

> at the code, you'll get my meaning soon.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/conf/network_conf.c | 39 +++++++++++++++++++++++++++++++++------
>  1 file changed, 33 insertions(+), 6 deletions(-)
> 


> @@ -631,6 +644,7 @@ void virNetworkRemoveInactive(virNetworkObjListPtr nets,
>      size_t i;
>  
>      virObjectUnlock(net);
> +    virObjectLock(nets);

Hmm, okay. My comment to the previous patch is invalid as this would
actually introduce a lock ordering problem.

>      for (i = 0; i < nets->count; i++) {
>          virObjectLock(nets->objs[i]);
>          if (nets->objs[i] == net) {
> @@ -642,6 +656,7 @@ void virNetworkRemoveInactive(virNetworkObjListPtr nets,
>          }
>          virObjectUnlock(nets->objs[i]);
>      }
> +    virObjectUnlock(nets);
>  }
>  
>  /* return ips[index], or NULL if there aren't enough ips */

ACK

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]