From nobody Mon Feb 9 10:54:18 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=1562947663; cv=none; d=zoho.com; s=zohoarc; b=lDpxZ3n3s+PJ7bLtU4qeLoNP4epvRteLH894pwxhoLXFmgPonbnH60NVpkItGEZQ0ZdsWm054e4c5ytPYYCQlTUe5qmsT76WWex1lhf9CAt2Bn8dDCDE9YAuHkzly6vSbV/vY+I331dOvknlQVGrpnaiVlz5ASpXWO6s/Q2xPIo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562947663; 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:ARC-Authentication-Results; bh=uMw1Xfdma0UTvC2x5mxnFUJH3iSRX/LBn1+MdPn/zRE=; b=NPtx4xWLgqLQ+9vr4LhTBIT1RnxJaAe0LEd6QYSXJufMtS97NU3IQXwbG7gNAes4EcUDLnlsSYJ3oepy60w/g1dIs0HtErO5uXg/8F8II/zMgRBgr5smmnj+SYa0R9MyL5W0r5YuKn6BCT31i0GkNfLhXeSi/qZf2Z/mFmRHOn0= 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 1562947663681765.1593800628702; Fri, 12 Jul 2019 09:07:43 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 0653F30A5A4D; Fri, 12 Jul 2019 16:07:42 +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 D44FA5DE74; Fri, 12 Jul 2019 16:07:41 +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 8CC151972A; Fri, 12 Jul 2019 16:07:41 +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 x6CG7ZTn017500 for ; Fri, 12 Jul 2019 12:07:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id BAB5060C77; Fri, 12 Jul 2019 16:07:35 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1FD3F60C70; Fri, 12 Jul 2019 16:07:34 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 12 Jul 2019 18:06:06 +0200 Message-Id: <9277048c5122881d9ab9f51573c3f4619b240e9b.1562947284.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 25/25] qemu: hotplug: Transfer ownership of backing chain to block job on disk unplug 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.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 12 Jul 2019 16:07:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" When removing the disk fronted while any block job is still active we need to transfer the ownership of the backing chain to the job itself as the job still holds the reference to the chain members and thus attempts to remove them would fail. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_hotplug.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index c50e41144e..7501ae5029 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -4228,8 +4228,15 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver, if (VIR_STRDUP(corAlias, diskPriv->nodeCopyOnRead) < 0) goto cleanup; - if (!(diskBackend =3D qemuBlockStorageSourceChainDetachPrepareBloc= kdev(disk->src))) - goto cleanup; + if (diskPriv->blockjob) { + /* the block job keeps reference to the disk chain */ + diskPriv->blockjob->disk =3D NULL; + virObjectUnref(diskPriv->blockjob); + diskPriv->blockjob =3D NULL; + } else { + if (!(diskBackend =3D qemuBlockStorageSourceChainDetachPrepare= Blockdev(disk->src))) + goto cleanup; + } } else { char *driveAlias; @@ -4252,7 +4259,8 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver, if (corAlias) ignore_value(qemuMonitorDelObject(priv->mon, corAlias)); - qemuBlockStorageSourceChainDetach(priv->mon, diskBackend); + if (diskBackend) + qemuBlockStorageSourceChainDetach(priv->mon, diskBackend); if (qemuDomainObjExitMonitor(driver, vm) < 0) goto cleanup; @@ -4262,7 +4270,8 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver, qemuDomainReleaseDeviceAddress(vm, &disk->info); /* tear down disk security access */ - qemuDomainStorageSourceChainAccessRevoke(driver, vm, disk->src); + if (diskBackend) + qemuDomainStorageSourceChainAccessRevoke(driver, vm, disk->src); dev.type =3D VIR_DOMAIN_DEVICE_DISK; dev.data.disk =3D disk; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list