From nobody Fri Apr 19 16:38:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584702928; cv=none; d=zohomail.com; s=zohoarc; b=kz0/TM6/vIp+2xkk/CJTwzMmkZK8yAytexlWtGYsrSYKtCz8fWZU3obu/ZzzCPPLqBzlO6VS6sC65tF6S9+imLnWNCh59uG/kKnLYS160Vyodtt9VmhdsJzR5w3sheTjARpK3Ehv1t+soWJzfospxBsQ8sjbwbbEJEE90JdMcpE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584702928; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=47AHVhMeLD6igMlaGoPZRyehRTja1BoCa3JPHx34uJU=; b=SA02itL2XLQ/QH0rws/il/24DJtJe2R2y/IYPUh7qcH/UhMngiadfi6KtT+dVH7vHdHE7gveMw/VOWQqqQFvWGqO4CNgXAISz8LfpV935abrL0ma+vUfsC5/cvrf8V4owwMfYCjXlravfmCxxXa2N6y3eXsmDoH76edH5GJ8loo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1584702928512256.45986656429886; Fri, 20 Mar 2020 04:15:28 -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-318--PWMEaKKNqmZA2laCdxrdA-1; Fri, 20 Mar 2020 07:15:23 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C6C2D149C0; Fri, 20 Mar 2020 11:15:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C77BF5D9E2; Fri, 20 Mar 2020 11:15:15 +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 5FDB2942A6; Fri, 20 Mar 2020 11:15:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02KBFAPh014576 for ; Fri, 20 Mar 2020 07:15:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id B61CC60C81; Fri, 20 Mar 2020 11:15:10 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-114-3.ams2.redhat.com [10.36.114.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id D162860C63; Fri, 20 Mar 2020 11:15:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584702926; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=47AHVhMeLD6igMlaGoPZRyehRTja1BoCa3JPHx34uJU=; b=CjwRt4mU9p9l2UKnsYTcRKjug2bnjfsFXJiHxp8CE/3PxVLhOp1hZN37mRoMmUmb8D5Pob oKRPP3Pn/Ipno01dXY/WWxkuL/6UgrQoXQhkAo6uE/gb+jVUN6cXXEC5HXiy5icgJvBgAy gzzkGUeKmTYYro0/uPhblJizbyGMJGQ= X-MC-Unique: -PWMEaKKNqmZA2laCdxrdA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH] qemu: ensure domain event thread is always stopped Date: Fri, 20 Mar 2020 11:14:54 +0000 Message-Id: <20200320111454.2701635-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Peter Krempa 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.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In previous commit: commit e6afacb0feabd9bf58331aa0e5259a35378be74e Author: Daniel P. Berrang=C3=A9 Date: Wed Feb 12 12:26:11 2020 +0000 qemu: start/stop an event loop thread for domains A bogus comment was added claiming we didn't need to shutdown the event thread in the qemuProcessStop method, because this would be done in the monitor EOF callback. This was wrong because the EOF callback only runs in the case of a QEMU crash or a guest initiated clean shutdown & poweroff. In the case where the libvirt admin calls virDomainDestroy, the EOF callback never fires because we have already unregistered the event callbacks. We must thus always attempt to stop the event thread in qemuProcessStop. Reported-by: Peter Krempa Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_process.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index e8401030a2..fcdde76aaa 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7398,17 +7398,7 @@ void qemuProcessStop(virQEMUDriverPtr driver, priv->monConfig =3D NULL; } =20 - /* - * We cannot stop the event thread at this time. When - * we are in this code, we may not yet have processed the - * STOP event or EOF from the monitor. So the event loop - * may have pending input that we need to process still. - * The qemuProcessHandleMonitorEOF method will kill - * the event thread because at that point we don't - * expect any more I/O from the QEMU monitor. We are - * assuming we don't need to get any more events from the - * QEMU agent at that time. - */ + qemuDomainObjStopWorker(vm); =20 /* Remove the master key */ qemuDomainMasterKeyRemove(priv); --=20 2.24.1