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

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

 



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@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
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]