From nobody Sun Feb 8 12:52:01 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1548423120415709.9030844906786; Fri, 25 Jan 2019 05:32:00 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 46D2137EEA; Fri, 25 Jan 2019 13:31:58 +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 B9AFB16BEC; Fri, 25 Jan 2019 13:31:57 +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 B0BD74ED28; Fri, 25 Jan 2019 13:31:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0PDVu9g002036 for ; Fri, 25 Jan 2019 08:31:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 37B731048125; Fri, 25 Jan 2019 13:31:56 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id B18731048117 for ; Fri, 25 Jan 2019 13:31:55 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 25 Jan 2019 14:31:46 +0100 Message-Id: <97ea112e63ecad86057639fee582217f1789bfe8.1548422575.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/5] vircgroup: Try harder to kill cgroup 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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 25 Jan 2019 13:31:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Prior to rewrite of cgroup code we only had one backend to try. After the rewrite the virCgroupBackendGetAll() returns both backends (for v1 and v2). However, not both have to really be present on the system which results in killRecursive callback failing which in turn might mean we won't try the other backend. At the same time, this function reports no error as it should. Signed-off-by: Michal Privoznik Reviewed-by: Erik Skultety --- src/util/vircgroup.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 3ebb3b0a0f..b8b56f1263 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -2606,6 +2606,7 @@ virCgroupKillRecursive(virCgroupPtr group, int signum) int ret =3D 0; int rc; size_t i; + bool backendAvailable =3D false; virCgroupBackendPtr *backends =3D virCgroupBackendGetAll(); virHashTablePtr pids =3D virHashCreateFull(100, NULL, @@ -2616,13 +2617,9 @@ virCgroupKillRecursive(virCgroupPtr group, int signu= m) =20 VIR_DEBUG("group=3D%p path=3D%s signum=3D%d", group, group->path, sign= um); =20 - if (!backends) { - ret =3D -1; - goto cleanup; - } - for (i =3D 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) { - if (backends[i]) { + if (backends && backends[i] && backends[i]->available()) { + backendAvailable =3D true; rc =3D backends[i]->killRecursive(group, signum, pids); if (rc < 0) { ret =3D -1; @@ -2633,6 +2630,12 @@ virCgroupKillRecursive(virCgroupPtr group, int signu= m) } } =20 + if (!backends || !backendAvailable) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("no cgroup backend available")); + goto cleanup; + } + cleanup: virHashFree(pids); return ret; --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list