[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1/2] libxl: remove code in stubdom creation failure path and callback
The snippet to destroy stubdom and the callback were added in 1fc3aeb3 ("libxl: use new QEMU xenstore protocol"). The intention was to destroy stubdom when it is not responsive. That approach is problematic because rc is not propagate back to sdss->callback, hence the guest is leaked. The solution is simple. The destruction of stubdom can be done later in sdss->callback. That code path already does the right thing to destroy both the guest and the stubdom that serves the guest. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxl/libxl_dm.c | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 3dd7c04..33f9ce6 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -1036,9 +1036,6 @@ static void stubdom_pvqemu_cb(libxl__egc *egc, libxl__multidev *aodevs, int rc); -static void spawn_stubdom_pvqemu_destroy_cb(libxl__egc *egc, - libxl__destroy_domid_state *dis, - int rc); static void stubdom_xswait_cb(libxl__egc *egc, libxl__xswait_state *xswait, int rc, const char *p); @@ -1353,7 +1350,6 @@ static void stubdom_xswait_cb(libxl__egc *egc, libxl__xswait_state *xswait, { EGC_GC; libxl__stub_dm_spawn_state *sdss = CONTAINER_OF(xswait, *sdss, xswait); - uint32_t dm_domid = sdss->pvqemu.guest_domid; if (rc) { if (rc == ERROR_TIMEDOUT) @@ -1367,29 +1363,6 @@ static void stubdom_xswait_cb(libxl__egc *egc, libxl__xswait_state *xswait, return; out: libxl__xswait_stop(gc, xswait); - if (rc) { - if (dm_domid) { - sdss->dis.ao = sdss->dm.spawn.ao; - sdss->dis.domid = dm_domid; - sdss->dis.callback = spawn_stubdom_pvqemu_destroy_cb; - libxl__destroy_domid(egc, &sdss->dis); - return; - } - } - sdss->callback(egc, &sdss->dm, rc); -} - -static void spawn_stubdom_pvqemu_destroy_cb(libxl__egc *egc, - libxl__destroy_domid_state *dis, - int rc) -{ - libxl__stub_dm_spawn_state *sdss = CONTAINER_OF(dis, *sdss, dis); - STATE_AO_GC(sdss->dis.ao); - - if (rc) - LOG(ERROR, "destruction of domain %u after failed creation failed", - sdss->pvqemu.guest_domid); - sdss->callback(egc, &sdss->dm, rc); } -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |