From nobody Thu May 16 06:43:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1585806312; cv=none; d=zohomail.com; s=zohoarc; b=RiDCHBXliR84gznozSfH9MAMGVHTXo6B43k4REgTrO6s95ejpUamPhdr+HBGQcw5PLMvmuD7F4TBEBU+fzyMSefoBaHxdJuMe8zJjUWfF5QbLtwZbC8dcoLRo01h+TMs6qGSYnvVLTKS2cOwpOGocCN/dxApYQoFRQe9zXPMt4k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585806312; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=X10H08B+jrZ67P/F+vMd8wLpKZSnBFs1qWhxjWesx30=; b=RFNW0etfEjiGKCULGMuZXpPonsuQwnePEfjP4fA6wqBdNzZ3FXSwaHjSbANbuxMkwR5C5KBUG95NBrzz4A0/OC3r+911Nr9GG3wyEmw+Sl0Wq1dp77Px3e1DLcmvv9yMB4k7++UQtTZZix0+TAstWX/HTxB7gK4UvWZga9r/cZI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 15858063126330.6430990629899043; Wed, 1 Apr 2020 22:45:12 -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-142-QvaKkPeIPqe8A14GbqPUYg-1; Thu, 02 Apr 2020 01:45:08 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5AF31477; Thu, 2 Apr 2020 05:45:02 +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 C6DEFA63B6; Thu, 2 Apr 2020 05:44:59 +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 7974718089CE; Thu, 2 Apr 2020 05:44:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0325ioO1031641 for ; Thu, 2 Apr 2020 01:44:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id BF8BF1C933; Thu, 2 Apr 2020 05:44:50 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 446F01A269 for ; Thu, 2 Apr 2020 05:44:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585806311; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=X10H08B+jrZ67P/F+vMd8wLpKZSnBFs1qWhxjWesx30=; b=SzXcdlc4j6T1QtsPSDI2kNiCoLhIlJVQa7l5LYF8eKz7t8+d7vGure2PaWzffXqeJnegcW cY/TMT+9wtIoQkP+qZPCYxIuC/hZfrFIV/+VH+nDZaUUF3TgzdaxQ01ZiML3jC6F5JNtpe qHIx2FLARl3O8dnmksO31Uzm3A/RrfI= X-MC-Unique: QvaKkPeIPqe8A14GbqPUYg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH for 6.2.0] qemuDomainSnapshotDiskPrepareOne: Fix logic of relative backing store update Date: Thu, 2 Apr 2020 07:44:46 +0200 Message-Id: <1c247857ad77862ad4e370fbb0e7b313bc94d174.1585806242.git.pkrempa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.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.15 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" Commit 2ace7a87a8aced68c250 introduced a logic bug by an improperly modified condition where we'd skip to the else branch when reusing of external images was requested and blockdev is available. The original intentions were to skip the backing store update with blockdev. Fix it by only asserting the boolean which was used to track whether we support update of the backing store only when blockdev is not present along with the appropriate rename. https://bugzilla.redhat.com/show_bug.cgi?id=3D1820016 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 78024614cf..ff97f10f11 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15129,7 +15129,7 @@ qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr d= river, { virDomainDiskDefPtr persistdisk; bool supportsCreate; - bool supportsBacking; + bool updateRelativeBacking =3D false; dd->disk =3D disk; @@ -15158,19 +15158,22 @@ qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr= driver, } supportsCreate =3D virStorageFileSupportsCreate(dd->src); - supportsBacking =3D virStorageFileSupportsBackingChainTraversal(dd->sr= c); - if (supportsCreate || supportsBacking) { + /* relative backing store paths need to be updated so that relative + * block commit still works. With blockdev we must update it when doing + * commit anyways so it's skipped here */ + if (!blockdev && + virStorageFileSupportsBackingChainTraversal(dd->src)) + updateRelativeBacking =3D true; + + if (supportsCreate || updateRelativeBacking) { if (qemuDomainStorageFileInit(driver, vm, dd->src, NULL) < 0) return -1; dd->initialized =3D true; - /* relative backing store paths need to be updated so that relative - * block commit still works. With blockdev we must update it when = doing - * commit anyways so it's skipped here */ - if (reuse && !blockdev) { - if (supportsBacking) { + if (reuse) { + if (updateRelativeBacking) { g_autofree char *backingStoreStr =3D NULL; if (virStorageFileGetBackingStoreStr(dd->src, &backingStor= eStr) < 0) --=20 2.25.1