DB> @@ -104,8 +117,12 @@ static virDomainPtr lxcDomainLookupByID(
DB> int id)
DB> {
DB> lxc_driver_t *driver = (lxc_driver_t *)conn->privateData;
DB> - virDomainObjPtr vm = virDomainFindByID(&driver->domains, id);
DB> + virDomainObjPtr vm;
DB> virDomainPtr dom;
DB> +
DB> + lxcDriverLock(driver);
DB> + vm = virDomainFindByID(&driver->domains, id);
DB> + lxcDriverUnlock(driver);
DB> if (!vm) {
DB> lxcError(conn, NULL, VIR_ERR_NO_DOMAIN, NULL);
DB> @@ -117,6 +134,7 @@ static virDomainPtr lxcDomainLookupByID(
dom-> id = vm->def->id;
DB> }
DB> + virDomainUnlock(vm);
DB> return dom;
DB> }
Can you explain why you're unlocking the vm in all of these functions
without first the corresponding lock operation?
DB> @@ -1091,17 +1230,20 @@ static int lxcShutdown(void)
DB> */
DB> static int
DB> lxcActive(void) {
DB> - unsigned int i;
DB> + unsigned int i, active = 0;
DB> if (lxc_driver == NULL)
DB> return(0);
DB> - for (i = 0 ; i < lxc_driver->domains.count ; i++)
DB> + lxcDriverLock(lxc_driver);
DB> + for (i = 0 ; i < lxc_driver->domains.count ; i++) {
DB> + virDomainLock(lxc_driver->domains.objs[i]);
DB> if (virDomainIsActive(lxc_driver->domains.objs[i]))
DB> - return 1;
DB> + active = 1;
DB> + virDomainUnlock(lxc_driver->domains.objs[i]);
DB> + }
DB> - /* Otherwise we're happy to deal with a shutdown */
DB> - return 0;
DB> + return active;
DB> }
It looks to me like you're taking the driver lock and not releasing it
on exit.
--
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms(a)us.ibm.com