From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-609627-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 1CA401381F3
	for <garchives@archives.gentoo.org>; Tue, 16 Jul 2013 18:56:30 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 434FDE0A99;
	Tue, 16 Jul 2013 18:56:29 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id B49D0E0A99
	for <gentoo-commits@lists.gentoo.org>; Tue, 16 Jul 2013 18:56:28 +0000 (UTC)
Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id BF16533E9CA
	for <gentoo-commits@lists.gentoo.org>; Tue, 16 Jul 2013 18:56:27 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by hornbill.gentoo.org (Postfix) with ESMTP id 99626E545F
	for <gentoo-commits@lists.gentoo.org>; Tue, 16 Jul 2013 18:56:25 +0000 (UTC)
From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" <williamh@gentoo.org>
Message-ID: <1372655882.992807de55bd9b0e8cbb569a86bb84b75fe9482e.WilliamH@OpenRC>
Subject: [gentoo-commits] proj/openrc:master commit in: sh/
X-VCS-Repository: proj/openrc
X-VCS-Files: sh/rc-cgroup.sh.in
X-VCS-Directories: sh/
X-VCS-Committer: WilliamH
X-VCS-Committer-Name: William Hubbs
X-VCS-Revision: 992807de55bd9b0e8cbb569a86bb84b75fe9482e
X-VCS-Branch: master
Date: Tue, 16 Jul 2013 18:56:25 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 717e7e0b-d4fd-43d1-83a7-a5227abaa40e
X-Archives-Hash: b35653850e30a1b5526059b66dba89e9

commit:     992807de55bd9b0e8cbb569a86bb84b75fe9482e
Author:     Alexander V Vershilov <qnikst <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 30 12:32:30 2013 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Jul  1 05:18:02 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=992807de

Put a service on into a top hierarchy of each cgroup

This change will fix unwanted cgroup inheriting from user cgroups,
and fixes issues with systemd cgroup tracking by logind.

However this fix can lead to incorrect work for some user cgroup
controllers - so more advanced solution, that coveres such cases
will be created later.

Thanks to Fabio Erculiani (lxnay) for testing and general idea.

---
 sh/rc-cgroup.sh.in | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index d96aa16..21f5f50 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -72,6 +72,14 @@ cgroup_set_values()
 
 cgroup_set_limits()
 {
+    # relocate starting process to the top of the cgroup
+    # it prevents from unwanted inheriting of the user
+    # cgroups. But may lead to a problems where that inheriting
+    # is needed.
+	for d in /sys/fs/cgroup/* ; do
+		echo $$ > "${d}"/tasks
+	done
+
 	openrc_cgroup=/sys/fs/cgroup/openrc
 	if [ -d "$openrc_cgroup" ]; then
 		cgroup="$openrc_cgroup/$RC_SVCNAME"