[libvirt] PATCH: 12/28: Thread safety for UML driver
Daniel Veillard
veillard at redhat.com
Tue Dec 2 11:05:10 UTC 2008
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 at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list