From nobody Fri May 17 07:07:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1618817060; cv=none; d=zohomail.com; s=zohoarc; b=dmHA6EbmrIPPqcC+5j63Rz9Yqkycon8KlhTlLIu+PST1GSOA2Zn8Ct6KI2yeiYzGPRAR9DwcZpbgqScUUs8dtJIMK22YdVOBZ48doFzL8tHB+ZUIHgRN0KOu7gCeyW0oJbfaviUwBYWmtHnvW01YsHHHR5ZSjtSXZnm+E3lQOZ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618817060; 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; bh=siq3Y1cNti7rtFZaSINpbSCOjtc8Baf6U2hONDYBIWY=; b=RewgPXZRzO4IGeOg5rdFFA2emNOwz3em42sAWqRBGjFx++M8hScgeDzmzW3d4G3rozDhP2tFluulNspvXmNO1NPq1z3d8oyfb+rhAz/C+pKPkTU/LqCONqtfxI8vc2EBW1oaVOVACOuUSIndaMJQ1K/SYr4kjVzjKIWPKgJ+z2U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1618817060744695.6732891299499; Mon, 19 Apr 2021 00:24:20 -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-239-5JBEj1jWM8qQguxE7gfxHQ-1; Mon, 19 Apr 2021 03:24:17 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 99C541008063; Mon, 19 Apr 2021 07:24:11 +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 7C2959CA0; Mon, 19 Apr 2021 07:24:11 +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 3AA231806D17; Mon, 19 Apr 2021 07:24:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13J7KPFQ016911 for ; Mon, 19 Apr 2021 03:20:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 639B05DAA5; Mon, 19 Apr 2021 07:20:25 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id D38DC5D9F0 for ; Mon, 19 Apr 2021 07:20:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618817059; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=siq3Y1cNti7rtFZaSINpbSCOjtc8Baf6U2hONDYBIWY=; b=V286Ec9+jimTb7ZZNgXWjbfBJAHfFiTxu/FpYAmvyBGHRfb7qgYdmQvB5XsxPKzoIhMx6U ZpdwwMf35osMrx0de6fg9zzNnYU9U9LownvlFkrp5XK89ASJ7Pq7Ua7cmAG86jlNR+etXx XIbCggVzo2dFZfUaERmioT+QyFOkmcY= X-MC-Unique: 5JBEj1jWM8qQguxE7gfxHQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/3] vircgroup: Debug print all arguments of virCgroupKillRecursiveInternal() Date: Mon, 19 Apr 2021 09:20:16 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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" Currently, only a subset of virCgroupKillRecursiveInternal() arguments is printed into debug logs. Print all of them. Signed-off-by: Michal Privoznik --- src/util/vircgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index e7a94c47e4..96280a0a4e 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -2725,8 +2725,8 @@ virCgroupKillRecursiveInternal(virCgroup *group, g_autoptr(DIR) dp =3D NULL; struct dirent *ent; int direrr; - VIR_DEBUG("group=3D%p signum=3D%d pids=3D%p", - group, signum, pids); + VIR_DEBUG("group=3D%p signum=3D%d pids=3D%p taskFile=3D%s dormdir=3D%d= ", + group, signum, pids, taskFile, dormdir); =20 if (virCgroupPathOfController(group, controller, "", &keypath) < 0) return -1; --=20 2.26.3 From nobody Fri May 17 07:07:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1618817064; cv=none; d=zohomail.com; s=zohoarc; b=OBs6QdIh5AiXlu34r0DBM7GdwskLslgPH5p4eo/+Xa9IX/xA1YptOC8u1l2oMsH5DSP0iEMrIdnTPwzQAzhx/bxl3VcZHzhC3UFqxfUxAs1BclvfAOcisW8jBymvRzcmMp/sJkdWmPJ8AkJ4co9g1hTxONS4fVNBCJtGBdfPupM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618817064; 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; bh=HWJ5jic5C7V62XO2nh4zl3rHKA09StHy0eMV144YNeE=; b=LYjAE/wozYMGgvvPGhaF0Ch02JbtTfzudFp4bz4JsyQf+t2FSIib3JxZz7J55s2vWWyLQSBLowTQuTooJcaPZIT0Yyq6B9Wt+0fVP8KalOORi2h15M+y6bxFJJaIzPQT0Q6c4ZPBImy9i1rY2DM6whq91l7sJ1+uqJ2J1SLxvOA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1618817064618664.9750539892376; Mon, 19 Apr 2021 00:24:24 -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-381-aTsTytD9PGCcXfTzsZznhg-1; Mon, 19 Apr 2021 03:24:20 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 88B7B6D269; Mon, 19 Apr 2021 07:24:14 +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 6499D60C04; Mon, 19 Apr 2021 07:24:14 +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 2DCC81806D1A; Mon, 19 Apr 2021 07:24:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13J7KQPT016921 for ; Mon, 19 Apr 2021 03:20:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 48C075D9CD; Mon, 19 Apr 2021 07:20:26 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id B841A5D9F0 for ; Mon, 19 Apr 2021 07:20:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618817063; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=HWJ5jic5C7V62XO2nh4zl3rHKA09StHy0eMV144YNeE=; b=AdMpPLD9LEpdNAckoH0QddB7z1FcvxgTP2ebZktHkchj4IArTeQS6d7xbCD+OMAcp1Pq18 bYynR3LoUxzNXmn6iuPOZwNwMrxKOcKQ+peZ+KHFK5HcscLYs/P0oF0ZfFWTKUqxmw5IOU dFTliSySm6Vgl5p/Q/T/NZjTDDzp8WQ= X-MC-Unique: aTsTytD9PGCcXfTzsZznhg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/3] vircgroupbackend: Extend error messages in VIR_CGROUP_BACKEND_CALL() Date: Mon, 19 Apr 2021 09:20:17 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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" The VIR_CGROUP_BACKEND_CALL() macro gets a backend for controller and calls corresponding callback in it. If either is NULL then an error message is printed out. However, the error message contains only the intended callback func and not controller or backend found. Signed-off-by: Michal Privoznik --- src/util/vircgroupbackend.c | 1 - src/util/vircgroupbackend.h | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/util/vircgroupbackend.c b/src/util/vircgroupbackend.c index 53184cd060..6d6f82cbb1 100644 --- a/src/util/vircgroupbackend.c +++ b/src/util/vircgroupbackend.c @@ -29,7 +29,6 @@ =20 #define VIR_FROM_THIS VIR_FROM_CGROUP =20 -VIR_ENUM_DECL(virCgroupBackend); VIR_ENUM_IMPL(virCgroupBackend, VIR_CGROUP_BACKEND_TYPE_LAST, "cgroup V2", diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h index c7f5708b86..c4d56896b0 100644 --- a/src/util/vircgroupbackend.h +++ b/src/util/vircgroupbackend.h @@ -58,6 +58,8 @@ typedef enum { VIR_CGROUP_BACKEND_TYPE_LAST, } virCgroupBackendType; =20 +VIR_ENUM_DECL(virCgroupBackend); + typedef bool (*virCgroupAvailableCB)(void); =20 @@ -464,12 +466,14 @@ virCgroupBackendForController(virCgroup *group, virCgroupBackend *backend =3D virCgroupBackendForController(group,= controller); \ if (!backend) { \ virReportError(VIR_ERR_INTERNAL_ERROR, \ - _("failed to get cgroup backend for '%s'"), #fu= nc); \ + _("failed to get cgroup backend for '%s' contro= ller '%u'"), \ + #func, controller); \ return ret; \ } \ if (!backend->func) { \ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, \ - _("operation '%s' not supported"), #func); \ + _("operation '%s' not supported for backend '%s= '"), \ + #func, virCgroupBackendTypeToString(backend->ty= pe)); \ return ret; \ } \ return backend->func(group, ##__VA_ARGS__); \ --=20 2.26.3 From nobody Fri May 17 07:07:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1618817107; cv=none; d=zohomail.com; s=zohoarc; b=KC4hLykLlxThSVzdOxQS0d9reWhtHAGKIeulZqwzwrBhzhlrOff/Zd0apSLaZQAWy+JycuWyBLKno3Ww6X7kc6QibB4i15iX5TC3+/kae+kpIrs21x4gjotqmLWmDZh7o8OSh4mjate/4JyG3nEnurh1ODRUaYM2+GDKvdn7lA0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618817107; 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; bh=TpuyqK5B61bOW/x1ZCDbWviePL7Io7GQg+I0mLWgiac=; b=PMtN9eiuUE7j5fRELne29t1js4SUOCT6jHTUp8EAPyjukrbOr2/j2Hz3QOsIsdrlg4LaxiDA8g7p5cTPbPGuqlbVSCtKTuqokTDU6XHepSKMFf5zgiewQQB3VOA2bWwQJS/m6ixBa8nmkBuBp8KHBCwHC8DRPzs1YGigQfejzx8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1618817107188711.1926016702731; Mon, 19 Apr 2021 00:25:07 -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-343-HGJBj3TmMKOcQgPREizf_Q-1; Mon, 19 Apr 2021 03:24:25 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 86432874998; Mon, 19 Apr 2021 07:24:17 +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 5D6701F055; Mon, 19 Apr 2021 07:24:17 +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 266991806D1C; Mon, 19 Apr 2021 07:24:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13J7KRiV016929 for ; Mon, 19 Apr 2021 03:20:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2F73E5D9F0; Mon, 19 Apr 2021 07:20:27 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F1A65D9CD for ; Mon, 19 Apr 2021 07:20:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618817106; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=TpuyqK5B61bOW/x1ZCDbWviePL7Io7GQg+I0mLWgiac=; b=LllwnTJw6Kce/0u4f2zUaEA8TreBWcwEDSpBqNVT1Noo4W5cRFdVVIwLn3JHPiuFTLNdx2 zR6IqwTewFneUvFkpVfU28B/rcOt2eZq0PHGyexTGPjPQRtgnpREk89xbLO7QkwN5/LuKU MyneZdju8LG9vld4ObDQzLjH7EMgc8U= X-MC-Unique: HGJBj3TmMKOcQgPREizf_Q-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/3] vircgroup: Fix virCgroupKillRecursive() wrt nested controllers Date: Mon, 19 Apr 2021 09:20:18 +0200 Message-Id: <5e54f0317551b6873fc914f50507d4c4704b5449.1618816726.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) I've encountered the following bug, but only on Gentoo with systemd and CGroupsV2. I've started an LXC container successfully but destroying it reported the following error: error: Failed to destroy domain 'amd64' error: internal error: failed to get cgroup backend for 'pathOfController' Debugging showed, that CGroup hierarchy is full of surprises: /sys/fs/cgroup/machine.slice/machine-lxc\x2d861\x2damd64.scope/ =E2=94=94=E2=94=80=E2=94=80 libvirt =E2=94=9C=E2=94=80=E2=94=80 dev-hugepages.mount =E2=94=9C=E2=94=80=E2=94=80 dev-mqueue.mount =E2=94=9C=E2=94=80=E2=94=80 init.scope =E2=94=9C=E2=94=80=E2=94=80 sys-fs-fuse-connections.mount =E2=94=9C=E2=94=80=E2=94=80 sys-kernel-config.mount =E2=94=9C=E2=94=80=E2=94=80 sys-kernel-debug.mount =E2=94=9C=E2=94=80=E2=94=80 sys-kernel-tracing.mount =E2=94=9C=E2=94=80=E2=94=80 system.slice =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 console-getty.service =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 dbus.service =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 system-getty.slice =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 system-modprobe.slice =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 systemd-journald.serv= ice =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 systemd-logind.service =E2=94=82=C2=A0=C2=A0 =E2=94=94=E2=94=80=E2=94=80 tmp.mount =E2=94=94=E2=94=80=E2=94=80 user.slice For comparison, here's the same container on recent Rawhide: /sys/fs/cgroup/machine.slice/machine-lxc\x2d13550\x2damd64.scope/ =E2=94=94=E2=94=80=E2=94=80 libvirt Anyway, those nested directories should not be a problem, because virCgroupKillRecursiveInternal() removes them recursively, right? Sort of. The function really does remove nested directories, but it assumes that every directory has the same controller as the rest. Just take a look at virCgroupV2KillRecursive() - it gets 'Any' controller (the first one it found in ".scope") and then passes it to virCgroupKillRecursiveInternal(). This assumption is not true though. The controllers found in ".scope" are the following: cpuset cpu io memory pids while "libvirt" has fewer: cpuset cpu io memory Up until now it's not problem, because of how we order controllers internally - "cpu" is the first and thus picking "Any" controller returns just that. But the rest of directories has no controllers, their "cgroup.controllers" is just empty. What fixes the bug is dropping @controller argument from virCgroupKillRecursiveInternal() and letting each iteration work pick its own controller. Signed-off-by: Michal Privoznik --- src/util/vircgroup.c | 25 +++++++++++++++++++++++-- src/util/vircgrouppriv.h | 1 - src/util/vircgroupv1.c | 7 +------ src/util/vircgroupv2.c | 7 +------ 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 96280a0a4e..37dde2a5ed 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -1477,6 +1477,24 @@ virCgroupHasController(virCgroup *cgroup, int contro= ller) } =20 =20 +static int +virCgroupGetAnyController(virCgroup *cgroup) +{ + size_t i; + + for (i =3D 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) { + if (!cgroup->backends[i]) + continue; + + return cgroup->backends[i]->getAnyController(cgroup); + } + + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get any controller")); + return -1; +} + + int virCgroupPathOfController(virCgroup *group, unsigned int controller, @@ -2715,11 +2733,11 @@ int virCgroupKillRecursiveInternal(virCgroup *group, int signum, GHashTable *pids, - int controller, const char *taskFile, bool dormdir) { int rc; + int controller; bool killedAny =3D false; g_autofree char *keypath =3D NULL; g_autoptr(DIR) dp =3D NULL; @@ -2728,6 +2746,9 @@ virCgroupKillRecursiveInternal(virCgroup *group, VIR_DEBUG("group=3D%p signum=3D%d pids=3D%p taskFile=3D%s dormdir=3D%d= ", group, signum, pids, taskFile, dormdir); =20 + if ((controller =3D virCgroupGetAnyController(group)) < 0) + return -1; + if (virCgroupPathOfController(group, controller, "", &keypath) < 0) return -1; =20 @@ -2760,7 +2781,7 @@ virCgroupKillRecursiveInternal(virCgroup *group, return -1; =20 if ((rc =3D virCgroupKillRecursiveInternal(subgroup, signum, pids, - controller, taskFile, tru= e)) < 0) + taskFile, true)) < 0) return -1; if (rc =3D=3D 1) killedAny =3D true; diff --git a/src/util/vircgrouppriv.h b/src/util/vircgrouppriv.h index 00193fb101..caf7ed84db 100644 --- a/src/util/vircgrouppriv.h +++ b/src/util/vircgrouppriv.h @@ -135,6 +135,5 @@ int virCgroupRemoveRecursively(char *grppath); int virCgroupKillRecursiveInternal(virCgroup *group, int signum, GHashTable *pids, - int controller, const char *taskFile, bool dormdir); diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c index 2cc7dd386a..8a04bb2e4a 100644 --- a/src/util/vircgroupv1.c +++ b/src/util/vircgroupv1.c @@ -812,12 +812,7 @@ virCgroupV1KillRecursive(virCgroup *group, int signum, GHashTable *pids) { - int controller =3D virCgroupV1GetAnyController(group); - - if (controller < 0) - return -1; - - return virCgroupKillRecursiveInternal(group, signum, pids, controller, + return virCgroupKillRecursiveInternal(group, signum, pids, "tasks", false); } =20 diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index e555217355..8881d3a88a 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -577,12 +577,7 @@ virCgroupV2KillRecursive(virCgroup *group, int signum, GHashTable *pids) { - int controller =3D virCgroupV2GetAnyController(group); - - if (controller < 0) - return -1; - - return virCgroupKillRecursiveInternal(group, signum, pids, controller, + return virCgroupKillRecursiveInternal(group, signum, pids, "cgroup.threads", false); } =20 --=20 2.26.3