From nobody Sun Feb 8 19:03:06 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=1569533016; cv=none; d=zoho.com; s=zohoarc; b=gBFK/MpRFRx6YdSiUqpJ04BGejgdgcS68m3jYcV63NdNqXg0LPO0NXN0DuQs/OZjYAhfEjQVWTDRFtwBrYjqjK8Y38U4AGRDj62rLCE/CHKaRT+xQhpIYsdQYv1w3pppzq2MZmoYW01+yconpVkxsWE3BeFV/Rz6M+ZL4tn6Fmk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569533016; 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=5bni/YxIoOt2/d5cJP2uXZbu4G771Bs9qvt5IJnOMnk=; b=dZWKPHxxGn0oSxQZz9ZX186oxw/DXf81DVFPSyy0xyU6g7lWfhgUmcqAYb9mCu/5VXo5MZvndyMUgjgs+uqFk+cdB/R8iLQtM+teu1iOCwq8+3oCmTE4JWY/fwRTTYGN5WTGOVs3uAScZ89QTTzsc30hiJjt63a+moufO5+uASU= 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 1569533016249557.9628788381468; Thu, 26 Sep 2019 14:23:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 896285AFE3; Thu, 26 Sep 2019 21:23:33 +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 3CC575D6B0; Thu, 26 Sep 2019 21:23: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 F205B1803B37; Thu, 26 Sep 2019 21:23:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8QLIV7W018377 for ; Thu, 26 Sep 2019 17:18:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id D3F2D60605; Thu, 26 Sep 2019 21:18:31 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-123-202.rdu2.redhat.com [10.10.123.202]) by smtp.corp.redhat.com (Postfix) with ESMTP id 07D4560933; Thu, 26 Sep 2019 21:18:30 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Thu, 26 Sep 2019 17:18:40 -0400 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] vircgroupv2: Fix VM startup when legacy cgroups are defined 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 26 Sep 2019 21:23:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" On Fedora 31, starting a 'mock' build alters /proc/$pid/cgroup, probably due to usage of systemd-nspawn. Before: $ cat /proc/self/cgroup 0::/user.slice/user-1000.slice/... After: $ cat /proc/self/cgroup 1:name=3Dsystemd:/ 0::/user.slice/user-1000.slice/... The cgroupv2 code mishandles that first line in the second case, which causes VM startup to fail with: Unable to read from '/sys/fs/cgroup/machine/cgroup.controllers': No such file or directory The kernel docs[1] say that the cgroupv2 path will always start with '0::', which in the code here controllers=3D"". Only set the v2 placement path when we see that cgroup file entry. [1] https://www.kernel.org/doc/html/v5.3/admin-guide/cgroup-v2.html#process= es https://bugzilla.redhat.com/show_bug.cgi?id=3D1751120 Signed-off-by: Cole Robinson Reviewed-by: Pavel Hrdina --- src/util/vircgroupv2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 0663c67190..0cb20e4896 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -194,12 +194,16 @@ virCgroupV2DetectMounts(virCgroupPtr group, static int virCgroupV2DetectPlacement(virCgroupPtr group, const char *path, - const char *controllers ATTRIBUTE_UNUSED, + const char *controllers, const char *selfpath) { if (group->unified.placement) return 0; =20 + /* controllers=3D"" indicates the cgroupv2 controller path */ + if (STRNEQ_NULLABLE(controllers, "")) + return 0; + /* * selfpath =3D=3D "/" + path=3D"" -> "/" * selfpath =3D=3D "/libvirt.service" + path =3D=3D "" -> "/libvirt.se= rvice" --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list