From nobody Fri Mar 29 06:28:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=huawei.com ARC-Seal: i=1; a=rsa-sha256; t=1617093805; cv=none; d=zohomail.com; s=zohoarc; b=X++WOUKiYhwvAwSKhXZ73vALRq8qSRfUoFTDcAnuOZrUdupfcZz39ueHal2IHUryqfH+hmWZPSV/OKxdSzZDcPJZhFQlUKDPF0Rysb4jCdcEahWMZvcuPxfQfd2oYnFy7CezbsVPshXd4CiM2fAMg19xgoWhsbbIOt4NXB4u6O4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617093805; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0rcoDlpSN5I/G8dHs5rXqtF+llDrSrdj1Ldh6F5gm7M=; b=JY31hZEKQHfiK1DIdvP2yn9gpIg2KZcbJnmU7EluJ6Was66wRGPcW05dzoNk0F2q4gQzYwpKhL2MQMtPOg/eGZXt47TEQWE1K+qr1LnWfiQsgSrHqwvLmE7LYJ/wkOdlXy0OWy/9TiXO+itQb4LTpQ4eU0UyyULbrpx3RhxP+OE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1617093805932450.1467775145252; Tue, 30 Mar 2021 01:43:25 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-448-PF8RQi7vN8qhLihaxJ9ZuA-1; Tue, 30 Mar 2021 04:43:18 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 43DB3107ACCA; Tue, 30 Mar 2021 08:43:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B52DF5F9B8; Tue, 30 Mar 2021 08:43:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 85F271809C83; Tue, 30 Mar 2021 08:43:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12U8bJ0Z021004 for ; Tue, 30 Mar 2021 04:37:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 09AD8568E8; Tue, 30 Mar 2021 08:37:19 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 01F39568F9 for ; Tue, 30 Mar 2021 08:37:11 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1C90185A5A8 for ; Tue, 30 Mar 2021 08:37:11 +0000 (UTC) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-343-3yKJkLTNMZmfSlpdyNqxKA-1; Tue, 30 Mar 2021 04:37:05 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4F8jRt2kbjzyNGJ; Tue, 30 Mar 2021 16:34:50 +0800 (CST) Received: from localhost (10.174.149.172) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.498.0; Tue, 30 Mar 2021 16:36:48 +0800 X-MC-Unique: PF8RQi7vN8qhLihaxJ9ZuA-1 X-MC-Unique: 3yKJkLTNMZmfSlpdyNqxKA-1 From: Hogan Wang To: , , Subject: [PATCH] already removed obj is not allowed to acquire job Date: Tue, 30 Mar 2021 16:36:41 +0800 Message-ID: <20210330083641.2303-1-hogan.wang@huawei.com> In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.174.149.172] X-CFilter-Loop: Reflected X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 12U8bJ0Z021004 X-loop: libvir-list@redhat.com Cc: zhuangshengen@huawei.com, wangxinxin.wang@huawei.com, weidong.huang@huawei.com, hogan.wang@huawei.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zhuang Shengen a removed vm begin a job may cause unanticipated results.so add judgement in qemuDomainObjBeginJobInternal to forbid a removed obj acquire the job Signed-off-by: Zhuang Shengen Reviewed-by: Hogan Wang --- 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; =20 + if (obj->removing =3D=3D 1) + goto error; + ignore_value(virTimeMillisNow(&now)); =20 if (job) { @@ -1011,6 +1014,10 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr drive= r, "due to max_queued limit")); } ret =3D -2; + } else if (obj->removing =3D=3D 1) { + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("cannot acquire job mutex for removed domain")); + ret =3D -2; } else { virReportSystemError(errno, "%s", _("cannot acquire job mutex")); } --=20 2.23.0