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

Re: [libvirt] PATCH: 12/28: Thread safety for UML driver



On Sun, Nov 30, 2008 at 11:53:17PM +0000, Daniel P. Berrange wrote:
> This patch makes the UML driver thread safe

[...]
> @@ -1395,21 +1485,27 @@ static int umlListDefinedDomains(virConn
>      struct uml_driver *driver = conn->privateData;
>      int got = 0, i;
>  
> +    umlDriverLock(driver);
>      for (i = 0 ; i < driver->domains.count && got < nnames ; i++) {
> +        virDomainObjLock(driver->domains.objs[i]);
>          if (!virDomainIsActive(driver->domains.objs[i])) {
>              if (!(names[got++] = strdup(driver->domains.objs[i]->def->name))) {
>                  umlReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
>                                   "%s", _("failed to allocate space for VM name string"));
> +                virDomainObjUnlock(driver->domains.objs[i]);
>                  goto cleanup;
>              }
>          }
> +        virDomainObjUnlock(driver->domains.objs[i]);
>      }
> +    umlDriverUnlock(driver);
>  
>      return got;
>  
>   cleanup:

  since this is an error code path, I would rather change the label to
error: ...

  Okay otherwise nothing spotted, +1

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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