Re: [PATCH] already removed obj is not allowed to acquire job

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

 



On Tue, Mar 30, 2021 at 04:36:41PM +0800, Hogan Wang wrote:
From: Zhuang Shengen <zhuangshengen@xxxxxxxxxx>

a removed vm begin a job may cause unanticipated results.so
add judgement in qemuDomainObjBeginJobInternal to forbid
a removed obj acquire the job


Actually what I meant was that there is some part of the code that probably is
not taking a job even though it should be. I see Michal replied to your other
post of the (same??) patch here:

  https://listman.redhat.com/archives/libvir-list/2021-March/msg00933.html

Suggesting what I meant. Have you tried that approach? The mails get confusing
with multiple postings.

Signed-off-by: Zhuang Shengen <zhuangshengen@xxxxxxxxxx>
Reviewed-by: Hogan Wang <hogan.wang@xxxxxxxxxx>
---
src/qemu/qemu_domainjob.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
index 50cfc45f5b..246c3208fc 100644
--- a/src/qemu/qemu_domainjob.c
+++ b/src/qemu/qemu_domainjob.c
@@ -880,6 +880,9 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver,
    if (!nested && !qemuDomainNestedJobAllowed(&priv->job, job))
        goto retry;

+    if (obj->removing == 1)
+        goto error;
+
    ignore_value(virTimeMillisNow(&now));

    if (job) {
@@ -1011,6 +1014,10 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver,
                             "due to max_queued limit"));
        }
        ret = -2;
+    } else if (obj->removing == 1) {
+        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                       _("cannot acquire job mutex for removed domain"));
+        ret = -2;
    } else {
        virReportSystemError(errno, "%s", _("cannot acquire job mutex"));
    }
--
2.23.0

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux