From nobody Sun Feb 8 17:22:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1565274462; cv=none; d=zoho.com; s=zohoarc; b=dRPoF+gHDd3MXcxntnbtr9mE3gpyFdvmJsYTouEUudxHh4hkEdTpVduHbEV/Akv7+W5Ng0qPLdGqkmX+sCXqdcw5zVsN8FIP93dkUO8STUlrYS9WAtcQElHp1yUvr1SWvWFmV3FjesmgR9ZjUqDqy6kifLtEqYRHM3AVROhRq0w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565274462; h=Content-Type:Content-Transfer-Encoding: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:ARC-Authentication-Results; bh=P/KN22Pko/Gp6/vKLX1ro78w4f1aBZBwP0naLCZNV3U=; b=ksQvBf7w929yakvXRSGVdnvQ4YP8M38rkv5hmmJ2G9yi8ap6nx7A9NI3fdGgXEnAiBBlZSkdHQuEWBTOkYwTD9iJi1SXQjLiZfCYo8DExoYlMl93mez+O+M/BAZYP7WzV5EzDYsRotVmAD19yq04SomoQ5mCu7AG0M7bs2XWVYI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565274462649326.88222512772415; Thu, 8 Aug 2019 07:27:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C453D3090FCD; Thu, 8 Aug 2019 14:27:40 +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 3870E100194E; Thu, 8 Aug 2019 14:27:40 +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 3BAB34EE96; Thu, 8 Aug 2019 14:27:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x78EQp4C017483 for ; Thu, 8 Aug 2019 10:26:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id DDE2A5C21F; Thu, 8 Aug 2019 14:26:51 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.188]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8EB065C219 for ; Thu, 8 Aug 2019 14:26:51 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 4BC7F10251A; Thu, 8 Aug 2019 16:26:47 +0200 (CEST) From: Jiri Denemark To: libvir-list@redhat.com Date: Thu, 8 Aug 2019 16:26:42 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/10] qemu: Pass correct qemuCaps to virDomainDefPostParse 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 08 Aug 2019 14:27:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Since qemuDomainDefPostParse callback requires qemuCaps, we need to make sure it gets the capabilities stored in the domain's private data if the domain is running. Passing NULL may cause QEMU capabilities probing to be triggered in case QEMU binary changed in the meantime. When this happens while a running domain object is locked, QMP event delivered to the domain before QEMU capabilities probing finishes will deadlock the event loop. This patch fixes all paths leading to virDomainDefPostParse. Signed-off-by: Jiri Denemark --- src/qemu/qemu_driver.c | 17 ++++++++++------- src/qemu/qemu_process.c | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f6e9c8672d..4da8b0e623 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -8326,6 +8326,7 @@ static int qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev, virCapsPtr caps, + virQEMUCapsPtr qemuCaps, unsigned int parse_flags, virDomainXMLOptionPtr xmlopt) { @@ -8517,7 +8518,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, return -1; } =20 - if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt, NULL) < 0) + if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt, qemuCaps) = < 0) return -1; =20 return 0; @@ -8528,6 +8529,7 @@ static int qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev, virCapsPtr caps, + virQEMUCapsPtr qemuCaps, unsigned int parse_flags, virDomainXMLOptionPtr xmlopt) { @@ -8709,7 +8711,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, return -1; } =20 - if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt, NULL) < 0) + if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt, qemuCaps) = < 0) return -1; =20 return 0; @@ -8719,6 +8721,7 @@ static int qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev, virCapsPtr caps, + virQEMUCapsPtr qemuCaps, unsigned int parse_flags, virDomainXMLOptionPtr xmlopt) { @@ -8814,7 +8817,7 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef, return -1; } =20 - if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt, NULL) < 0) + if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt, qemuCaps) = < 0) return -1; =20 return 0; @@ -8866,7 +8869,7 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr v= m, false) < 0) goto cleanup; =20 - if (qemuDomainAttachDeviceConfig(vmdef, devConf, caps, + if (qemuDomainAttachDeviceConfig(vmdef, devConf, caps, priv->qemuC= aps, parse_flags, driver->xmlopt) < 0) goto cleanup; @@ -9031,7 +9034,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr d= om, =20 /* virDomainDefCompatibleDevice call is delayed until we know the * device we're going to update. */ - if ((ret =3D qemuDomainUpdateDeviceConfig(vmdef, dev, caps, + if ((ret =3D qemuDomainUpdateDeviceConfig(vmdef, dev, caps, priv->= qemuCaps, parse_flags, driver->xmlopt)) < 0) goto endjob; @@ -9126,7 +9129,7 @@ qemuDomainDetachDeviceLiveAndConfig(virQEMUDriverPtr = driver, if (!vmdef) goto cleanup; =20 - if (qemuDomainDetachDeviceConfig(vmdef, dev, caps, + if (qemuDomainDetachDeviceConfig(vmdef, dev, caps, priv->qemuCaps, parse_flags, driver->xmlopt) < 0) goto cleanup; @@ -9212,7 +9215,7 @@ qemuDomainDetachDeviceAliasLiveAndConfig(virQEMUDrive= rPtr driver, if (virDomainDefFindDevice(vmdef, alias, &dev, true) < 0) goto cleanup; =20 - if (qemuDomainDetachDeviceConfig(vmdef, &dev, caps, + if (qemuDomainDetachDeviceConfig(vmdef, &dev, caps, priv->qemuCaps, parse_flags, driver->xmlopt) < 0) goto cleanup; } diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ffe4338854..22ff4c42af 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5615,7 +5615,7 @@ qemuProcessInit(virQEMUDriverPtr driver, if (vm->def->postParseFailed) { VIR_DEBUG("re-running the post parse callback"); =20 - if (virDomainDefPostParse(vm->def, caps, 0, driver->xmlopt, NULL) = < 0) + if (virDomainDefPostParse(vm->def, caps, 0, driver->xmlopt, priv->= qemuCaps) < 0) goto cleanup; } =20 --=20 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list