xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libxl: do not fail device removal if backend domain is gone
@ 2018-02-08 23:22 Marek Marczykowski-Górecki
  2018-02-09 11:27 ` Roger Pau Monné
  2018-02-23 18:51 ` Wei Liu
  0 siblings, 2 replies; 11+ messages in thread
From: Marek Marczykowski-Górecki @ 2018-02-08 23:22 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, Marek Marczykowski-Górecki

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 of the 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 <marmarek@invisiblethingslab.com>
---
 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 1b796bd392..1f58a99a23 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -997,6 +997,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


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-02-23 18:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-08 23:22 [PATCH] libxl: do not fail device removal if backend domain is gone Marek Marczykowski-Górecki
2018-02-09 11:27 ` Roger Pau Monné
2018-02-09 11:41   ` Marek Marczykowski-Górecki
2018-02-09 12:10     ` Roger Pau Monné
2018-02-09 13:08       ` Marek Marczykowski-Górecki
2018-02-09 14:39         ` Roger Pau Monné
2018-02-09 15:11           ` Marek Marczykowski-Górecki
2018-02-09 15:33             ` Roger Pau Monné
2018-02-09 16:32               ` Marek Marczykowski-Górecki
2018-02-09 16:43                 ` Roger Pau Monné
2018-02-23 18:51 ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).