From nobody Sat May 4 06:07:52 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1522327711021387.2046695307713; Thu, 29 Mar 2018 05:48:31 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 960484E906; Thu, 29 Mar 2018 12:48:29 +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 68E785FCAD; Thu, 29 Mar 2018 12:48:29 +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 1A6FE4CA9E; Thu, 29 Mar 2018 12:48:29 +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 w2TCmPJ2030748 for ; Thu, 29 Mar 2018 08:48:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id ACC0160F8C; Thu, 29 Mar 2018 12:48:25 +0000 (UTC) Received: from unknown54ee7586bd10.attlocal.net.com (ovpn-116-109.phx2.redhat.com [10.3.116.109]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B5855E9CF for ; Thu, 29 Mar 2018 12:48:24 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Thu, 29 Mar 2018 08:48:16 -0400 Message-Id: <20180329124817.4524-2-jferlan@redhat.com> In-Reply-To: <20180329124817.4524-1-jferlan@redhat.com> References: <20180329124817.4524-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] qemu: Fix qemuProcessAutoDestroy 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: , MIME-Version: 1.0 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 29 Mar 2018 12:48:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Upon entry from virCloseCallbacksRun, the @dom will have a Ref and Lock from virDomainObjListFindByUUIDRef, so there's no need to take an extra reference nor should the code call virDomainObjEndAPI when done since that both Unref's and Unlock's the @dom which means the callers call to EndAPI would be unlocking an unlocked object. At least the Ref saved the code from referencing something already freed. Signed-off-by: John Ferlan Reviewed-by: Marc Hartmayer --- src/qemu/qemu_process.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 1afb71f11..14f197e7f 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7057,8 +7057,6 @@ qemuProcessAutoDestroy(virDomainObjPtr dom, =20 VIR_DEBUG("vm=3D%s, conn=3D%p", dom->def->name, conn); =20 - virObjectRef(dom); - if (priv->job.asyncJob =3D=3D QEMU_ASYNC_JOB_MIGRATION_IN) stopFlags |=3D VIR_QEMU_PROCESS_STOP_MIGRATED; =20 @@ -7088,7 +7086,6 @@ qemuProcessAutoDestroy(virDomainObjPtr dom, qemuDomainEventQueue(driver, event); =20 cleanup: - virDomainObjEndAPI(&dom); return dom; } =20 --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 06:07:52 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1522327711894959.2205668079506; Thu, 29 Mar 2018 05:48:31 -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 7F2ADA457D; Thu, 29 Mar 2018 12:48:30 +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 5647763767; Thu, 29 Mar 2018 12:48:30 +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 1BABB4CA9F; Thu, 29 Mar 2018 12:48:30 +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 w2TCmRCr030760 for ; Thu, 29 Mar 2018 08:48:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 283E460F8C; Thu, 29 Mar 2018 12:48:27 +0000 (UTC) Received: from unknown54ee7586bd10.attlocal.net.com (ovpn-116-109.phx2.redhat.com [10.3.116.109]) by smtp.corp.redhat.com (Postfix) with ESMTP id DDCA360F87 for ; Thu, 29 Mar 2018 12:48:25 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Thu, 29 Mar 2018 08:48:17 -0400 Message-Id: <20180329124817.4524-3-jferlan@redhat.com> In-Reply-To: <20180329124817.4524-1-jferlan@redhat.com> References: <20180329124817.4524-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] util: Alter virCloseCallback typedef to return void 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: , MIME-Version: 1.0 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.38]); Thu, 29 Mar 2018 12:48:31 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Since virCloseCallbacksRun was ignoring the value anyway, let's just change it to be a void function. Signed-off-by: John Ferlan Reviewed-by: Marc Hartmayer --- src/bhyve/bhyve_process.c | 8 ++------ src/lxc/lxc_process.c | 8 ++------ src/qemu/qemu_migration.c | 7 ++----- src/qemu/qemu_process.c | 7 ++----- src/util/virclosecallbacks.c | 5 ++--- src/util/virclosecallbacks.h | 6 +++--- 6 files changed, 13 insertions(+), 28 deletions(-) diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index 4ff6257f8..9276d7d36 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -53,7 +53,7 @@ =20 VIR_LOG_INIT("bhyve.bhyve_process"); =20 -static virDomainObjPtr +static void bhyveProcessAutoDestroy(virDomainObjPtr vm, virConnectPtr conn ATTRIBUTE_UNUSED, void *opaque) @@ -62,12 +62,8 @@ bhyveProcessAutoDestroy(virDomainObjPtr vm, =20 virBhyveProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED); =20 - if (!vm->persistent) { + if (!vm->persistent) virDomainObjListRemove(driver->domains, vm); - vm =3D NULL; - } - - return vm; } =20 static void diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index bc321e360..c155bd9d4 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -59,7 +59,7 @@ VIR_LOG_INIT("lxc.lxc_process"); =20 #define START_POSTFIX ": starting up\n" =20 -static virDomainObjPtr +static void lxcProcessAutoDestroy(virDomainObjPtr dom, virConnectPtr conn, void *opaque) @@ -79,15 +79,11 @@ lxcProcessAutoDestroy(virDomainObjPtr dom, VIR_DOMAIN_EVENT_STOPPED_DESTROYED); priv->doneStopEvent =3D true; =20 - if (!dom->persistent) { + if (!dom->persistent) virDomainObjListRemove(driver->domains, dom); - dom =3D NULL; - } =20 if (event) virObjectEventStateQueue(driver->domainEventState, event); - - return dom; } =20 /* diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index e5231555d..256b994bd 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1954,7 +1954,7 @@ qemuMigrationDstRun(virQEMUDriverPtr driver, * qemuDomainMigrateBegin3 and qemuDomainMigratePerform3 or * qemuDomainMigratePerform3 and qemuDomainMigrateConfirm3. */ -static virDomainObjPtr +static void qemuMigrationSrcCleanup(virDomainObjPtr vm, virConnectPtr conn, void *opaque) @@ -1969,7 +1969,7 @@ qemuMigrationSrcCleanup(virDomainObjPtr vm, priv->job.phase)); =20 if (!qemuMigrationJobIsActive(vm, QEMU_ASYNC_JOB_MIGRATION_OUT)) - goto cleanup; + return; =20 VIR_DEBUG("The connection which started outgoing migration of domain %= s" " was closed; canceling the migration", @@ -2005,9 +2005,6 @@ qemuMigrationSrcCleanup(virDomainObjPtr vm, /* unreachable */ ; } - - cleanup: - return vm; } =20 =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 14f197e7f..288409685 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7045,7 +7045,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UN= USED, } =20 =20 -static virDomainObjPtr +static void qemuProcessAutoDestroy(virDomainObjPtr dom, virConnectPtr conn, void *opaque) @@ -7069,7 +7069,7 @@ qemuProcessAutoDestroy(virDomainObjPtr dom, VIR_DEBUG("Killing domain"); =20 if (qemuProcessBeginStopJob(driver, dom, QEMU_JOB_DESTROY, true) < 0) - goto cleanup; + return; =20 qemuProcessStop(driver, dom, VIR_DOMAIN_SHUTOFF_DESTROYED, QEMU_ASYNC_JOB_NONE, stopFlags); @@ -7084,9 +7084,6 @@ qemuProcessAutoDestroy(virDomainObjPtr dom, qemuDomainObjEndJob(driver, dom); =20 qemuDomainEventQueue(driver, event); - - cleanup: - return dom; } =20 int qemuProcessAutoDestroyAdd(virQEMUDriverPtr driver, diff --git a/src/util/virclosecallbacks.c b/src/util/virclosecallbacks.c index 4db50e8b6..49dac6589 100644 --- a/src/util/virclosecallbacks.c +++ b/src/util/virclosecallbacks.c @@ -359,10 +359,9 @@ virCloseCallbacksRun(virCloseCallbacksPtr closeCallbac= ks, * we're about to call the callback function and we have another * ref anyway (so it cannot be deleted). * - * Call the callback function, ignoring the return since it might = be - * NULL. Once we're done with the object, then end the API usage. = */ + * Call the callback function and end the API usage. */ virObjectUnref(vm); - ignore_value(list->entries[i].callback(vm, conn, opaque)); + list->entries[i].callback(vm, conn, opaque); virDomainObjEndAPI(&vm); } VIR_FREE(list->entries); diff --git a/src/util/virclosecallbacks.h b/src/util/virclosecallbacks.h index d48997181..79ca635bd 100644 --- a/src/util/virclosecallbacks.h +++ b/src/util/virclosecallbacks.h @@ -30,9 +30,9 @@ typedef struct _virCloseCallbacks virCloseCallbacks; typedef virCloseCallbacks *virCloseCallbacksPtr; =20 -typedef virDomainObjPtr (*virCloseCallback)(virDomainObjPtr vm, - virConnectPtr conn, - void *opaque); +typedef void (*virCloseCallback)(virDomainObjPtr vm, + virConnectPtr conn, + void *opaque); virCloseCallbacksPtr virCloseCallbacksNew(void); int virCloseCallbacksSet(virCloseCallbacksPtr closeCallbacks, virDomainObjPtr vm, --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list