From nobody Wed May 8 02:51:13 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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1556112881; cv=none; d=zoho.com; s=zohoarc; b=Cg08uLIxxlHpfFtK+OP6JIbIwoju0Sf3tHG9ncRGApYNpzHfl9xh6VEN6Dgx8r2WJp3YbqhNvYzfs3nyzut7Id1/QAoLnU9L0OU8y2vD4IhR6e14fGhZe1SlXzmM/GTFCRECgLazC/WvigBndXpVlY1eLu5tMYAzvQZoY9Ogap8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556112881; 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:ARC-Authentication-Results; bh=rGk52PVMHUqoOR7mcxfl2IuWXwCu3svbvbEu4GhAUI4=; b=Jtfa//EwcWiQCwTneSfifGdkrRlE6/dGNNNWNpbeAv35EQ4txWtMWeMY+1bwOzvrA7tNZ+lIEJzWkioNw6aCcIHzL44e9TmZvfOnPtz7XRWzFegIZdD3q8rpZPltNg0PWfaPcr/OE7cKu+v9hJRRMNH8QZ5N4vEyWGRNgsKQIuU= 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 1556112881026542.1992895074347; Wed, 24 Apr 2019 06:34:41 -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 E9798C0AE08F; Wed, 24 Apr 2019 13:34:38 +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 35B281091EDB; Wed, 24 Apr 2019 13:34:36 +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 1255E3FA4A; Wed, 24 Apr 2019 13:34:34 +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 x3ODXTJ7021166 for ; Wed, 24 Apr 2019 09:33:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7CC03272CD; Wed, 24 Apr 2019 13:33:29 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 02A0C272D9 for ; Wed, 24 Apr 2019 13:33:26 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Wed, 24 Apr 2019 15:33:25 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] vircgroup: no need to ifdef virCgroupFree 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.31]); Wed, 24 Apr 2019 13:34:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" virCgroup struct is always defined and the free function is not calling anything that would require OS supporting cgroups. This fixes an issue if we try to start a VM with QEMU binary that doesn't support QXL. The start operation will fail in qemuProcessStartValidateVideo() which will set correct error message, but later in one of the cleanup paths we will call qemuDomainObjPrivateDataClear() which always calls virCgroupFree() and that will fail on OS that doesn't support cgroups and it will set a new error which will be eventually reported to user. Signed-off-by: Pavel Hrdina --- src/util/vircgroup.c | 62 +++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 4238d7014b..f58e336404 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -1279,33 +1279,6 @@ virCgroupNewIgnoreError(void) } =20 =20 -/** - * virCgroupFree: - * - * @group: The group structure to free - */ -void -virCgroupFree(virCgroupPtr *group) -{ - size_t i; - - if (*group =3D=3D NULL) - return; - - for (i =3D 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) { - VIR_FREE((*group)->legacy[i].mountPoint); - VIR_FREE((*group)->legacy[i].linkPoint); - VIR_FREE((*group)->legacy[i].placement); - } - - VIR_FREE((*group)->unified.mountPoint); - VIR_FREE((*group)->unified.placement); - - VIR_FREE((*group)->path); - VIR_FREE(*group); -} - - /** * virCgroupHasController: query whether a cgroup controller is present * @@ -2917,14 +2890,6 @@ virCgroupNewIgnoreError(void) } =20 =20 -void -virCgroupFree(virCgroupPtr *group ATTRIBUTE_UNUSED) -{ - virReportSystemError(ENXIO, "%s", - _("Control groups not supported on this platform"= )); -} - - bool virCgroupHasController(virCgroupPtr cgroup ATTRIBUTE_UNUSED, int controller ATTRIBUTE_UNUSED) @@ -3565,6 +3530,33 @@ virCgroupControllerAvailable(int controller ATTRIBUT= E_UNUSED) #endif /* !__linux__ */ =20 =20 +/** + * virCgroupFree: + * + * @group: The group structure to free + */ +void +virCgroupFree(virCgroupPtr *group) +{ + size_t i; + + if (*group =3D=3D NULL) + return; + + for (i =3D 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) { + VIR_FREE((*group)->legacy[i].mountPoint); + VIR_FREE((*group)->legacy[i].linkPoint); + VIR_FREE((*group)->legacy[i].placement); + } + + VIR_FREE((*group)->unified.mountPoint); + VIR_FREE((*group)->unified.placement); + + VIR_FREE((*group)->path); + VIR_FREE(*group); +} + + int virCgroupDelThread(virCgroupPtr cgroup, virCgroupThreadName nameval, --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list