forked from QubesOS/qubes-vmm-xen
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpatch-0001-libxl-do-not-fail-device-removal-if-backend-domain-i.patch
48 lines (43 loc) · 1.83 KB
/
patch-0001-libxl-do-not-fail-device-removal-if-backend-domain-i.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From da3d4f87265079182f049cbeb2fc1fc2e6209922 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
Date: Sun, 28 Jan 2018 03:46:47 +0100
Subject: [PATCH] libxl: do not fail device removal if backend domain is gone
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Invisible Things Lab
Cc: Marek Marczykowski-Górecki <[email protected]>
Backend domain may be independently destroyed - there is no
synchronization of libxl structures (including /libxl tree) elsewhere.
Backend might also remove the device info from its backend xenstore
subtree on its own.
If such situation is detected, do not fail the removal, but finish the
cleanup on frontend side.
This is just workaround, the real fix should watch when the device
backend is removed (including backend domain destruction) and remove
frontend at that time. And report such event to higher layer code, so
for example libvirt could synchronize its state.
Signed-off-by: Marek Marczykowski-Górecki <[email protected]>
---
tools/libxl/libxl_device.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index 3e7a1026c4..2b99cfa97f 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -959,6 +959,13 @@ void libxl__initiate_device_generic_remove(libxl__egc *egc,
goto out;
}
+ /* if state_path is empty, assume backend is gone (backend domain
+ * shutdown?), cleanup frontend only; rc=0 */
+ if (!state) {
+ LOG(WARN, "backend %s already removed, cleanup frontend only", be_path);
+ goto out;
+ }
+
rc = libxl__xs_write_checked(gc, t, online_path, "0");
if (rc)
goto out;
--
2.13.6