libvirt/4e6fcdb6-libxl-libxlDomObjFromDomain-cleanup.patch
James Fehlig 1ea77165a0 Accepting request 589839 from home:jfehlig:branches:Virtualization
- libxl: don't hardcode scheduler weight
  83edaf44-libxl-dont-hardcode-sched-weight.patch
  bsc#1086377

- libxl: fixes and improvements in migration APIs
  64370c4b-libxl-MigrateBegin.patch,
  99486799-libxl-MigrateConfirm.patch,
  f5eacf2a-libxl-MigratePerform.patch,
  4e6fcdb6-libxl-libxlDomObjFromDomain-cleanup.patch,
  fe51dbda-libxl-use-FindByRef.patch,
  60b3fcd9-libxl-MigratePrepare.patch,
  3c89868c-libxl-lock-after-ListRemove.patch,
  13e81fc6-libxl-EndJob-on-error.patch,
  594b8b99-libxl-DefineXMLFlags-API-pattern.patch,
  c66e344e-libxl-dont-deref-NULL.patch
  bsc#1080957

OBS-URL: https://build.opensuse.org/request/show/589839
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=681
2018-03-22 00:33:49 +00:00

270 lines
6.0 KiB
Diff

commit 4e6fcdb6fa838d57a278dacd21bc6932edabec67
Author: John Ferlan <jferlan@redhat.com>
Date: Fri Mar 9 11:47:59 2018 -0500
libxl: Properly cleanup after libxlDomObjFromDomain
Commit id '9ac945078' altered libxlDomObjFromDomain to return
a locked *and* ref counted object for some specific purposes;
however, it neglected to alter all the consumers of the helper
to use virDomainObjEndAPI thus leaving many objects with extra
ref counts.
Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Index: libvirt-4.1.0/src/libxl/libxl_driver.c
===================================================================
--- libvirt-4.1.0.orig/src/libxl/libxl_driver.c
+++ libvirt-4.1.0/src/libxl/libxl_driver.c
@@ -1322,8 +1322,7 @@ libxlDomainShutdownFlags(virDomainPtr do
}
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
virObjectUnref(cfg);
return ret;
}
@@ -1373,8 +1372,7 @@ libxlDomainReboot(virDomainPtr dom, unsi
}
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
virObjectUnref(cfg);
return ret;
}
@@ -1459,8 +1457,7 @@ libxlDomainGetOSType(virDomainPtr dom)
goto cleanup;
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
return type;
}
@@ -1479,8 +1476,7 @@ libxlDomainGetMaxMemory(virDomainPtr dom
ret = virDomainDefGetMemoryTotal(vm->def);
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
return ret;
}
@@ -1658,8 +1654,7 @@ libxlDomainGetInfo(virDomainPtr dom, vir
ret = 0;
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
virObjectUnref(cfg);
return ret;
}
@@ -1685,8 +1680,7 @@ libxlDomainGetState(virDomainPtr dom,
ret = 0;
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
return ret;
}
@@ -2110,8 +2104,7 @@ libxlDomainHasManagedSaveImage(virDomain
ret = vm->hasManagedSave;
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
return ret;
}
@@ -2140,8 +2133,7 @@ libxlDomainManagedSaveRemove(virDomainPt
cleanup:
VIR_FREE(name);
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
return ret;
}
@@ -2352,8 +2344,7 @@ libxlDomainGetVcpusFlags(virDomainPtr do
ret = virDomainDefGetVcpus(def);
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
return ret;
}
@@ -2484,8 +2475,7 @@ libxlDomainGetVcpuPinInfo(virDomainPtr d
libxl_get_max_cpus(cfg->ctx), NULL);
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
virObjectUnref(cfg);
return ret;
}
@@ -2548,8 +2538,7 @@ libxlDomainGetVcpus(virDomainPtr dom, vi
ret = maxinfo;
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
virObjectUnref(cfg);
return ret;
}
@@ -2580,8 +2569,7 @@ libxlDomainGetXMLDesc(virDomainPtr dom,
virDomainDefFormatConvertXMLFlags(flags));
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
virObjectUnref(cfg);
return ret;
}
@@ -2901,8 +2889,7 @@ libxlDomainUndefineFlags(virDomainPtr do
cleanup:
VIR_FREE(name);
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
if (event)
libxlDomainEventQueue(driver, event);
virObjectUnref(cfg);
@@ -4261,8 +4248,7 @@ libxlDomainUpdateDeviceFlags(virDomainPt
cleanup:
virDomainDefFree(vmdef);
virDomainDeviceDefFree(dev);
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
virObjectUnref(cfg);
return ret;
}
@@ -4394,8 +4380,7 @@ libxlDomainGetAutostart(virDomainPtr dom
ret = 0;
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
return ret;
}
@@ -4521,8 +4506,7 @@ libxlDomainGetSchedulerType(virDomainPtr
ignore_value(VIR_STRDUP(ret, name));
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
virObjectUnref(cfg);
return ret;
}
@@ -4587,8 +4571,7 @@ libxlDomainGetSchedulerParametersFlags(v
ret = 0;
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
virObjectUnref(cfg);
return ret;
}
@@ -4750,8 +4733,7 @@ libxlDomainOpenConsole(virDomainPtr dom,
}
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
return ret;
}
@@ -4886,8 +4868,7 @@ libxlDomainGetNumaParameters(virDomainPt
VIR_FREE(nodeset);
virBitmapFree(nodes);
libxl_bitmap_dispose(&nodemap);
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
virObjectUnref(cfg);
return ret;
}
@@ -4908,8 +4889,7 @@ libxlDomainIsActive(virDomainPtr dom)
ret = virDomainObjIsActive(obj);
cleanup:
- if (obj)
- virObjectUnlock(obj);
+ virDomainObjEndAPI(&obj);
return ret;
}
@@ -4928,8 +4908,7 @@ libxlDomainIsPersistent(virDomainPtr dom
ret = obj->persistent;
cleanup:
- if (obj)
- virObjectUnlock(obj);
+ virDomainObjEndAPI(&obj);
return ret;
}
@@ -4948,8 +4927,7 @@ libxlDomainIsUpdated(virDomainPtr dom)
ret = vm->updated;
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
return ret;
}
@@ -5107,8 +5085,7 @@ libxlDomainGetCPUStats(virDomainPtr dom,
start_cpu, ncpus);
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
return ret;
}
@@ -5211,8 +5188,7 @@ libxlDomainGetJobInfo(virDomainPtr dom,
ret = 0;
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
return ret;
}
@@ -5263,8 +5239,7 @@ libxlDomainGetJobStats(virDomainPtr dom,
ret = 0;
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
return ret;
}