From: Ian Jackson Date: Tue, 17 Mar 2015 15:30:58 +0000 (-0600) Subject: libxl: Domain destroy: unlock userdata earlier X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~3564 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1c91d6fba20c1517d78076d412d33cb41f501be5;p=xen.git libxl: Domain destroy: unlock userdata earlier Unlock the userdata before we actually call xc_domain_destroy. This leaves open the possibility that other libxl callers will see the half-destroyed domain (with no devices, paused), but this is fine. Signed-off-by: Ian Jackson CC: Wei Liu Reviewed-by: Jim Fehlig Tested-by: Jim Fehlig Acked-by: Wei Liu Acked-by: Ian Campbell --- diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index c904e71cfa..70505677d3 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -1636,7 +1636,7 @@ static void devices_destroy_cb(libxl__egc *egc, uint32_t domid = dis->domid; char *dom_path; char *vm_path; - libxl__domain_userdata_lock *lock = NULL; + libxl__domain_userdata_lock *lock; dom_path = libxl__xs_get_dompath(gc, domid); if (!dom_path) { @@ -1670,6 +1670,8 @@ static void devices_destroy_cb(libxl__egc *egc, } libxl__userdata_destroyall(gc, domid); + libxl__unlock_domain_userdata(lock); + rc = xc_domain_destroy(ctx->xch, domid); if (rc < 0) { LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_domain_destroy failed for %d", domid); @@ -1679,7 +1681,6 @@ static void devices_destroy_cb(libxl__egc *egc, rc = 0; out: - if (lock) libxl__unlock_domain_userdata(lock); dis->callback(egc, dis, rc); return; }