mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
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@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
1 parent
8d90cbb135
commit
e8ebc71c68
1 file changed
-27
@@ -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);
|
||||
}
|
||||
|
||||
|
||||