diff options
author | Bogdan Purcareata <bogdan.purcareata@freescale.net> | 2013-05-24 17:24:36 +0300 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2013-05-24 21:01:50 -0700 |
commit | c817a8b660b15825ede58c45da5f60a8e0db24c3 (patch) | |
tree | b6c0d07d4fe36e5c3cff6774ab8b9ab784e16293 | |
parent | 69a10f062a0cd8c054b495ccb303fea50e4c592d (diff) | |
download | meta-virtualization-c817a8b660b15825ede58c45da5f60a8e0db24c3.tar.gz |
libvirt: add patch to fix thread safety in lxc callback
Patch has been submitted upstream (22 mar 2013) after the release of
Libvirt 1.0.3 (5 mar 2013). Updated to work against libvirt 1.0.3.
Please see http://www.redhat.com/archives/libvir-list/2013-March/msg01353.html
for original patch.
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.net>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
-rw-r--r-- | recipes-extended/libvirt/libvirt/libvirt-1.0.3-fix-thread-safety-in-lxc-callback-handling.patch | 63 | ||||
-rw-r--r-- | recipes-extended/libvirt/libvirt_1.0.3.bb | 1 |
2 files changed, 64 insertions, 0 deletions
diff --git a/recipes-extended/libvirt/libvirt/libvirt-1.0.3-fix-thread-safety-in-lxc-callback-handling.patch b/recipes-extended/libvirt/libvirt/libvirt-1.0.3-fix-thread-safety-in-lxc-callback-handling.patch new file mode 100644 index 00000000..558d5ef6 --- /dev/null +++ b/recipes-extended/libvirt/libvirt/libvirt-1.0.3-fix-thread-safety-in-lxc-callback-handling.patch | |||
@@ -0,0 +1,63 @@ | |||
1 | From ad5d9cee87357f9f38f62583119606ef95ba10df Mon Sep 17 00:00:00 2001 | ||
2 | From: Bogdan Purcareata <bogdan.purcareata@freescale.com> | ||
3 | Date: Fri, 24 May 2013 16:46:00 +0300 | ||
4 | Subject: [PATCH] Fix thread safety in LXC callback handling | ||
5 | |||
6 | Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com> | ||
7 | --- | ||
8 | src/lxc/lxc_process.c | 18 +++++++++++++++++- | ||
9 | 1 file changed, 17 insertions(+), 1 deletion(-) | ||
10 | |||
11 | diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c | ||
12 | index aaa81a7..0eadc67 100644 | ||
13 | --- a/src/lxc/lxc_process.c | ||
14 | +++ b/src/lxc/lxc_process.c | ||
15 | @@ -609,8 +609,13 @@ static void virLXCProcessMonitorExitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED | ||
16 | virLXCProtocolExitStatus status, | ||
17 | virDomainObjPtr vm) | ||
18 | { | ||
19 | + virLXCDriverPtr driver = lxc_driver; | ||
20 | virLXCDomainObjPrivatePtr priv = vm->privateData; | ||
21 | |||
22 | + lxcDriverLock(driver); | ||
23 | + virObjectLock(vm); | ||
24 | + lxcDriverUnlock(driver); | ||
25 | + | ||
26 | switch (status) { | ||
27 | case VIR_LXC_PROTOCOL_EXIT_STATUS_SHUTDOWN: | ||
28 | priv->stopReason = VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN; | ||
29 | @@ -628,6 +633,8 @@ static void virLXCProcessMonitorExitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED | ||
30 | } | ||
31 | VIR_DEBUG("Domain shutoff reason %d (from status %d)", | ||
32 | priv->stopReason, status); | ||
33 | + | ||
34 | + virObjectUnlock(vm); | ||
35 | } | ||
36 | |||
37 | /* XXX a little evil */ | ||
38 | @@ -636,12 +643,21 @@ static void virLXCProcessMonitorInitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED | ||
39 | pid_t initpid, | ||
40 | virDomainObjPtr vm) | ||
41 | { | ||
42 | - virLXCDomainObjPrivatePtr priv = vm->privateData; | ||
43 | + virLXCDriverPtr driver = lxc_driver; | ||
44 | + virLXCDomainObjPrivatePtr priv; | ||
45 | + | ||
46 | + lxcDriverLock(driver); | ||
47 | + virObjectLock(vm); | ||
48 | + lxcDriverUnlock(driver); | ||
49 | + | ||
50 | + priv = vm->privateData; | ||
51 | priv->initpid = initpid; | ||
52 | virDomainAuditInit(vm, initpid); | ||
53 | |||
54 | if (virDomainSaveStatus(lxc_driver->caps, lxc_driver->stateDir, vm) < 0) | ||
55 | VIR_WARN("Cannot update XML with PID for LXC %s", vm->def->name); | ||
56 | + | ||
57 | + virObjectUnlock(vm); | ||
58 | } | ||
59 | |||
60 | static virLXCMonitorCallbacks monitorCallbacks = { | ||
61 | -- | ||
62 | 1.7.11.7 | ||
63 | |||
diff --git a/recipes-extended/libvirt/libvirt_1.0.3.bb b/recipes-extended/libvirt/libvirt_1.0.3.bb index 049166d2..989b8b12 100644 --- a/recipes-extended/libvirt/libvirt_1.0.3.bb +++ b/recipes-extended/libvirt/libvirt_1.0.3.bb | |||
@@ -23,6 +23,7 @@ RDEPENDS_libvirt-libvirtd_append_x86 = " dmidecode" | |||
23 | RCONFLICTS_${PN}_libvirtd = "connman" | 23 | RCONFLICTS_${PN}_libvirtd = "connman" |
24 | 24 | ||
25 | SRC_URI = "http://libvirt.org/sources/libvirt-${PV}.tar.gz \ | 25 | SRC_URI = "http://libvirt.org/sources/libvirt-${PV}.tar.gz \ |
26 | file://libvirt-1.0.3-fix-thread-safety-in-lxc-callback-handling.patch \ | ||
26 | file://libvirtd.sh \ | 27 | file://libvirtd.sh \ |
27 | file://libvirtd.conf" | 28 | file://libvirtd.conf" |
28 | 29 | ||