diff options
Diffstat (limited to 'recipes-extended/libvirt/libvirt/libvirt-1.0.3-fix-thread-safety-in-lxc-callback-handling.patch')
-rw-r--r-- | recipes-extended/libvirt/libvirt/libvirt-1.0.3-fix-thread-safety-in-lxc-callback-handling.patch | 63 |
1 files changed, 63 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 | |||