[libvirt] [PATCH v3 04/11] qemu: remove nested job usage from qemuProcessStop

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Thu Nov 9 13:18:50 UTC 2017


81f50cb92 added getting nested job on stopping domain to prevent leaking of
monitor object on race between aborting job and stopping domain cased by that
abort.

One of the causes of this problem is that async job and concurrent regular job
were not fully isolated and async job can continue to run when concurrent job
is not finished yet. Now this is not possible and we can safely remove getting
nested job condition in qemuProcessStop as stopping always done within context
of some job.
---
 src/qemu/qemu_process.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 24b7ba1..7eaeeaa 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -6296,19 +6296,9 @@ void qemuProcessStop(virQEMUDriverPtr driver,
      * reporting so we don't squash a legit error. */
     orig_err = virSaveLastError();
 
-    if (asyncJob != QEMU_ASYNC_JOB_NONE) {
-        if (qemuDomainObjBeginNestedJob(driver, vm, asyncJob) < 0)
-            goto cleanup;
-    } else if (priv->job.asyncJob != QEMU_ASYNC_JOB_NONE &&
-               priv->job.asyncOwner == virThreadSelfID() &&
-               priv->job.active != QEMU_JOB_ASYNC_NESTED) {
-        VIR_WARN("qemuProcessStop called without a nested job (async=%s)",
-                 qemuDomainAsyncJobTypeToString(asyncJob));
-    }
-
     if (!virDomainObjIsActive(vm)) {
         VIR_DEBUG("VM '%s' not active", vm->def->name);
-        goto endjob;
+        goto cleanup;
     }
 
     qemuProcessBuildDestroyMemoryPaths(driver, vm, NULL, false);
@@ -6565,10 +6555,6 @@ void qemuProcessStop(virQEMUDriverPtr driver,
 
     virDomainObjRemoveTransientDef(vm);
 
- endjob:
-    if (asyncJob != QEMU_ASYNC_JOB_NONE)
-        qemuDomainObjEndJob(driver, vm);
-
  cleanup:
     if (orig_err) {
         virSetError(orig_err);
-- 
1.8.3.1




More information about the libvir-list mailing list