[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH v2 RFC 3/4] qemu: remove nesting job usage from qemuProcessStop



81f50cb92 adds 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 | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 87a9511..d9f4af7 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -6149,7 +6149,7 @@ qemuProcessBeginStopJob(virQEMUDriverPtr driver,
 void qemuProcessStop(virQEMUDriverPtr driver,
                      virDomainObjPtr vm,
                      virDomainShutoffReason reason,
-                     qemuDomainAsyncJob asyncJob,
+                     qemuDomainAsyncJob asyncJob ATTRIBUTE_UNUSED,
                      unsigned int flags)
 {
     int ret;
@@ -6163,30 +6163,19 @@ void qemuProcessStop(virQEMUDriverPtr driver,
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
 
     VIR_DEBUG("Shutting down vm=%p name=%s id=%d pid=%lld, "
-              "reason=%s, asyncJob=%s, flags=%x",
+              "reason=%s, flags=%x",
               vm, vm->def->name, vm->def->id,
               (long long) vm->pid,
               virDomainShutoffReasonTypeToString(reason),
-              qemuDomainAsyncJobTypeToString(asyncJob),
               flags);
 
     /* This method is routinely used in clean up paths. Disable error
      * 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;
     }
 
     qemuProcessBuildDestroyHugepagesPath(driver, vm, false);
@@ -6467,10 +6456,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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]