From nobody Mon Feb 9 10:30:28 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=1567611684; cv=none; d=zoho.com; s=zohoarc; b=kM6IxyI0JdChZEuOYRMSxuEur6RxO1jHj7Muf3KKIUAdrf7iyeurBa1k/tkYmHwdmCc1+jvJklsZqVCb4d8WoGb2bhw11WNNb6tg49/P4N4+v6aWvmBmYyuwRAGFPQmuk0zSERHvNwLIzEKfbV5v8n1Ez6E6DdPDmjOnVNj3nQY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567611684; 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=7nnZsZQ2+FNoqS5DgizhrW+DLHmRcX5TvJOL/yv4vEM=; b=fmKfI/aKTQSQ+Rptjt7vzLEZD3jhjV8bQZHgOrtEZSpIfYV4yTdJ+fMF+ahkqLGHTOWazXxSBvJn3GxagHXo8TwCpg8vc2zesY30kjzg4oWacnycf5hG0RExuRK/jqL0ahomW+LrGSEVuHJmLMAnBxw8ux+L43MQ5c9nrYpM7ew= 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 1567611684286503.94779121304737; Wed, 4 Sep 2019 08:41:24 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 2A9532EF168; Wed, 4 Sep 2019 15:41:23 +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 057FB5C258; Wed, 4 Sep 2019 15:41:23 +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 B7BCB1802220; Wed, 4 Sep 2019 15:41:22 +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 x84FdY3a028823 for ; Wed, 4 Sep 2019 11:39:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5733660BFB; Wed, 4 Sep 2019 15:39:34 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id D330F60C18 for ; Wed, 4 Sep 2019 15:39:33 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 4 Sep 2019 17:39:27 +0200 Message-Id: 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 Subject: [libvirt] [PATCH 3/4] qemu: migration: Refactor cleanup in qemuMigrationSrcNBDStorageCopy 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 04 Sep 2019 15:41:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Use VIR_AUTOUNREF and remove the cleanup label. Signed-off-by: Peter Krempa --- src/qemu/qemu_migration.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 82625b2261..c13b21a0bb 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -983,13 +983,12 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr drive= r, unsigned int flags) { qemuDomainObjPrivatePtr priv =3D vm->privateData; - int ret =3D -1; int port; size_t i; unsigned long long mirror_speed =3D speed; bool mirror_shallow =3D *migrate_flags & QEMU_MONITOR_MIGRATE_NON_SHAR= ED_INC; int rv; - virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); + VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg =3D virQEMUDriverGetConfig(d= river); VIR_DEBUG("Starting drive mirrors for domain %s", vm->def->name); @@ -997,7 +996,7 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr driver, virReportError(VIR_ERR_OVERFLOW, _("bandwidth must be less than %llu"), LLONG_MAX >> 20); - goto cleanup; + return -1; } mirror_speed <<=3D 20; @@ -1015,34 +1014,34 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr dri= ver, if (qemuMigrationSrcNBDStorageCopyOne(driver, vm, disk, host, port, mirror_speed, mirror_shallow, tlsAlias, flags) < 0) - goto cleanup; + return -1; if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver-= >caps) < 0) { VIR_WARN("Failed to save status on vm %s", vm->def->name); - goto cleanup; + return -1; } } while ((rv =3D qemuMigrationSrcNBDStorageCopyReady(vm, QEMU_ASYNC_JOB_= MIGRATION_OUT)) !=3D 1) { if (rv < 0) - goto cleanup; + return -1; if (priv->job.abortJob) { priv->job.current->status =3D QEMU_DOMAIN_JOB_STATUS_CANCELED; virReportError(VIR_ERR_OPERATION_ABORTED, _("%s: %s"), qemuDomainAsyncJobTypeToString(priv->job.asyncJ= ob), _("canceled by client")); - goto cleanup; + return -1; } if (dconn && virConnectIsAlive(dconn) <=3D 0) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("Lost connection to destination host")); - goto cleanup; + return -1; } if (virDomainObjWait(vm) < 0) - goto cleanup; + return -1; } qemuMigrationSrcFetchMirrorStats(driver, vm, QEMU_ASYNC_JOB_MIGRATION_= OUT, @@ -1051,11 +1050,8 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr driv= er, /* Okay, all disks are ready. Modify migrate_flags */ *migrate_flags &=3D ~(QEMU_MONITOR_MIGRATE_NON_SHARED_DISK | QEMU_MONITOR_MIGRATE_NON_SHARED_INC); - ret =3D 0; - cleanup: - virObjectUnref(cfg); - return ret; + return 0; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list