All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cgroup : remove the ns_cgroup
@ 2011-01-25  9:39 Daniel Lezcano
  2011-01-27  0:16 ` Andrew Morton
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Daniel Lezcano @ 2011-01-25  9:39 UTC (permalink / raw)
  To: akpm; +Cc: containers, linux-kernel

The ns_cgroup is an annoying cgroup at the namespace / cgroup frontier
and leads to some problems:

        * cgroup creation is out-of-control
        * cgroup name can conflict when pids are looping
        * it is not possible to have a single process handling
        a lot of namespaces without falling in a exponential creation time
        * we may want to create a namespace without creating a cgroup

        The ns_cgroup was replaced by a compatibility flag 'clone_children',
        where a newly created cgroup will copy the parent cgroup values.
        The userspace has to manually create a cgroup and add a task to
        the 'tasks' file.

This patch removes the ns_cgroup as suggested in the following thread:

https://lists.linux-foundation.org/pipermail/containers/2009-June/018616.html

The 'cgroup_clone' function is removed because it is no longer used.

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
Signed-off-by: Serge E. Hallyn <serge.hallyn@canonical.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Jamal Hadi Salim <hadi@cyberus.ca>
Reviewed-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Paul Menage <menage@google.com>
Acked-by: Matt Helsley <matthltc@us.ibm.com>
---
 Documentation/cgroups/cgroups.txt      |    2 +-
 arch/mips/configs/bcm47xx_defconfig    |    1 -
 arch/mn10300/configs/asb2364_defconfig |    1 -
 arch/powerpc/configs/ppc6xx_defconfig  |    1 -
 arch/powerpc/configs/pseries_defconfig |    1 -
 arch/sh/configs/apsh4ad0a_defconfig    |    1 -
 arch/sh/configs/sdk7786_defconfig      |    1 -
 arch/sh/configs/se7206_defconfig       |    1 -
 arch/sh/configs/shx3_defconfig         |    1 -
 arch/sh/configs/urquell_defconfig      |    1 -
 arch/x86/configs/i386_defconfig        |    1 -
 arch/x86/configs/x86_64_defconfig      |    1 -
 include/linux/cgroup.h                 |    3 -
 include/linux/cgroup_subsys.h          |    6 --
 include/linux/nsproxy.h                |    9 ---
 init/Kconfig                           |    8 --
 kernel/Makefile                        |    1 -
 kernel/cgroup.c                        |  116 -------------------------------
 kernel/cpuset.c                        |    7 +-
 kernel/fork.c                          |    6 --
 kernel/ns_cgroup.c                     |  118 --------------------------------
 kernel/nsproxy.c                       |    4 -
 22 files changed, 4 insertions(+), 287 deletions(-)
 delete mode 100644 kernel/ns_cgroup.c

diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt
index 44b8b7a..ac759b6 100644
--- a/Documentation/cgroups/cgroups.txt
+++ b/Documentation/cgroups/cgroups.txt
@@ -618,7 +618,7 @@ always handled well.
 void post_clone(struct cgroup_subsys *ss, struct cgroup *cgrp)
 (cgroup_mutex held by caller)
 
-Called at the end of cgroup_clone() to do any parameter
+Called during cgroup_create() to do any parameter
 initialization which might be required before a task could attach.  For
 example in cpusets, no task may attach before 'cpus' and 'mems' are set
 up.
diff --git a/arch/mips/configs/bcm47xx_defconfig b/arch/mips/configs/bcm47xx_defconfig
index 927d58b..c4338e0 100644
--- a/arch/mips/configs/bcm47xx_defconfig
+++ b/arch/mips/configs/bcm47xx_defconfig
@@ -16,7 +16,6 @@ CONFIG_TASK_IO_ACCOUNTING=y
 CONFIG_AUDIT=y
 CONFIG_TINY_RCU=y
 CONFIG_CGROUPS=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_CPUACCT=y
 CONFIG_RELAY=y
 CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/mn10300/configs/asb2364_defconfig b/arch/mn10300/configs/asb2364_defconfig
index 83ce2f2..d38391a 100644
--- a/arch/mn10300/configs/asb2364_defconfig
+++ b/arch/mn10300/configs/asb2364_defconfig
@@ -8,7 +8,6 @@ CONFIG_TASK_XACCT=y
 CONFIG_TASK_IO_ACCOUNTING=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_CGROUPS=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_FREEZER=y
 CONFIG_CGROUP_DEVICE=y
 CONFIG_CGROUP_CPUACCT=y
diff --git a/arch/powerpc/configs/ppc6xx_defconfig b/arch/powerpc/configs/ppc6xx_defconfig
index 9d64a68..9b253f6 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -10,7 +10,6 @@ CONFIG_TASK_XACCT=y
 CONFIG_TASK_IO_ACCOUNTING=y
 CONFIG_AUDIT=y
 CONFIG_CGROUPS=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_DEVICE=y
 CONFIG_CGROUP_CPUACCT=y
 CONFIG_RESOURCE_COUNTERS=y
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index f87f0e1..972587f 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -15,7 +15,6 @@ CONFIG_AUDITSYSCALL=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_CGROUPS=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_FREEZER=y
 CONFIG_CGROUP_DEVICE=y
 CONFIG_CPUSETS=y
diff --git a/arch/sh/configs/apsh4ad0a_defconfig b/arch/sh/configs/apsh4ad0a_defconfig
index e71a531..f722a3d 100644
--- a/arch/sh/configs/apsh4ad0a_defconfig
+++ b/arch/sh/configs/apsh4ad0a_defconfig
@@ -7,7 +7,6 @@ CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_CGROUPS=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_FREEZER=y
 CONFIG_CGROUP_DEVICE=y
 CONFIG_CGROUP_CPUACCT=y
diff --git a/arch/sh/configs/sdk7786_defconfig b/arch/sh/configs/sdk7786_defconfig
index dc4a2eb..9fdabe2 100644
--- a/arch/sh/configs/sdk7786_defconfig
+++ b/arch/sh/configs/sdk7786_defconfig
@@ -12,7 +12,6 @@ CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_CGROUPS=y
 CONFIG_CGROUP_DEBUG=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_FREEZER=y
 CONFIG_CGROUP_DEVICE=y
 CONFIG_CPUSETS=y
diff --git a/arch/sh/configs/se7206_defconfig b/arch/sh/configs/se7206_defconfig
index a468ff2..72c3fad 100644
--- a/arch/sh/configs/se7206_defconfig
+++ b/arch/sh/configs/se7206_defconfig
@@ -8,7 +8,6 @@ CONFIG_RCU_TRACE=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_CGROUPS=y
 CONFIG_CGROUP_DEBUG=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_DEVICE=y
 CONFIG_CGROUP_CPUACCT=y
 CONFIG_RESOURCE_COUNTERS=y
diff --git a/arch/sh/configs/shx3_defconfig b/arch/sh/configs/shx3_defconfig
index 3f92d37..6bb4130 100644
--- a/arch/sh/configs/shx3_defconfig
+++ b/arch/sh/configs/shx3_defconfig
@@ -9,7 +9,6 @@ CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_CGROUPS=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_FREEZER=y
 CONFIG_CGROUP_DEVICE=y
 CONFIG_CGROUP_CPUACCT=y
diff --git a/arch/sh/configs/urquell_defconfig b/arch/sh/configs/urquell_defconfig
index 7b3daec..8bfa4d0 100644
--- a/arch/sh/configs/urquell_defconfig
+++ b/arch/sh/configs/urquell_defconfig
@@ -9,7 +9,6 @@ CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_CGROUPS=y
 CONFIG_CGROUP_DEBUG=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_FREEZER=y
 CONFIG_CGROUP_DEVICE=y
 CONFIG_CPUSETS=y
diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig
index 6f98726..2bf1805 100644
--- a/arch/x86/configs/i386_defconfig
+++ b/arch/x86/configs/i386_defconfig
@@ -10,7 +10,6 @@ CONFIG_TASK_IO_ACCOUNTING=y
 CONFIG_AUDIT=y
 CONFIG_LOG_BUF_SHIFT=18
 CONFIG_CGROUPS=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_FREEZER=y
 CONFIG_CPUSETS=y
 CONFIG_CGROUP_CPUACCT=y
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index ee01a9d..22a0dc8 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -11,7 +11,6 @@ CONFIG_TASK_IO_ACCOUNTING=y
 CONFIG_AUDIT=y
 CONFIG_LOG_BUF_SHIFT=18
 CONFIG_CGROUPS=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_FREEZER=y
 CONFIG_CPUSETS=y
 CONFIG_CGROUP_CPUACCT=y
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index ce104e3..d0509a3 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -552,9 +552,6 @@ static inline struct cgroup* task_cgroup(struct task_struct *task,
 	return task_subsys_state(task, subsys_id)->cgroup;
 }
 
-int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *ss,
-							char *nodename);
-
 /* A cgroup_iter should be treated as an opaque object */
 struct cgroup_iter {
 	struct list_head *cg_link;
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index ccefff0..4ba5259 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -19,12 +19,6 @@ SUBSYS(debug)
 
 /* */
 
-#ifdef CONFIG_CGROUP_NS
-SUBSYS(ns)
-#endif
-
-/* */
-
 #ifdef CONFIG_CGROUP_SCHED
 SUBSYS(cpu_cgroup)
 #endif
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index 7b370c7..50d20ab 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -81,13 +81,4 @@ static inline void get_nsproxy(struct nsproxy *ns)
 	atomic_inc(&ns->count);
 }
 
-#ifdef CONFIG_CGROUP_NS
-int ns_cgroup_clone(struct task_struct *tsk, struct pid *pid);
-#else
-static inline int ns_cgroup_clone(struct task_struct *tsk, struct pid *pid)
-{
-	return 0;
-}
-#endif
-
 #endif
diff --git a/init/Kconfig b/init/Kconfig
index 1379adc..7acdfb4 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -582,14 +582,6 @@ config CGROUP_DEBUG
 
 	  Say N if unsure.
 
-config CGROUP_NS
-	bool "Namespace cgroup subsystem"
-	help
-	  Provides a simple namespace cgroup subsystem to
-	  provide hierarchical naming of sets of namespaces,
-	  for instance virtual servers and checkpoint/restart
-	  jobs.
-
 config CGROUP_FREEZER
 	bool "Freezer cgroup subsystem"
 	help
diff --git a/kernel/Makefile b/kernel/Makefile
index 353d3fe..bd1b486 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -62,7 +62,6 @@ obj-$(CONFIG_COMPAT) += compat.o
 obj-$(CONFIG_CGROUPS) += cgroup.o
 obj-$(CONFIG_CGROUP_FREEZER) += cgroup_freezer.o
 obj-$(CONFIG_CPUSETS) += cpuset.o
-obj-$(CONFIG_CGROUP_NS) += ns_cgroup.o
 obj-$(CONFIG_UTS_NS) += utsname.o
 obj-$(CONFIG_USER_NS) += user_namespace.o
 obj-$(CONFIG_PID_NS) += pid_namespace.o
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index b24d702..9b92442 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4267,122 +4267,6 @@ void cgroup_exit(struct task_struct *tsk, int run_callbacks)
 }
 
 /**
- * cgroup_clone - clone the cgroup the given subsystem is attached to
- * @tsk: the task to be moved
- * @subsys: the given subsystem
- * @nodename: the name for the new cgroup
- *
- * Duplicate the current cgroup in the hierarchy that the given
- * subsystem is attached to, and move this task into the new
- * child.
- */
-int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys,
-							char *nodename)
-{
-	struct dentry *dentry;
-	int ret = 0;
-	struct cgroup *parent, *child;
-	struct inode *inode;
-	struct css_set *cg;
-	struct cgroupfs_root *root;
-	struct cgroup_subsys *ss;
-
-	/* We shouldn't be called by an unregistered subsystem */
-	BUG_ON(!subsys->active);
-
-	/* First figure out what hierarchy and cgroup we're dealing
-	 * with, and pin them so we can drop cgroup_mutex */
-	mutex_lock(&cgroup_mutex);
- again:
-	root = subsys->root;
-	if (root == &rootnode) {
-		mutex_unlock(&cgroup_mutex);
-		return 0;
-	}
-
-	/* Pin the hierarchy */
-	if (!atomic_inc_not_zero(&root->sb->s_active)) {
-		/* We race with the final deactivate_super() */
-		mutex_unlock(&cgroup_mutex);
-		return 0;
-	}
-
-	/* Keep the cgroup alive */
-	task_lock(tsk);
-	parent = task_cgroup(tsk, subsys->subsys_id);
-	cg = tsk->cgroups;
-	get_css_set(cg);
-	task_unlock(tsk);
-
-	mutex_unlock(&cgroup_mutex);
-
-	/* Now do the VFS work to create a cgroup */
-	inode = parent->dentry->d_inode;
-
-	/* Hold the parent directory mutex across this operation to
-	 * stop anyone else deleting the new cgroup */
-	mutex_lock(&inode->i_mutex);
-	dentry = lookup_one_len(nodename, parent->dentry, strlen(nodename));
-	if (IS_ERR(dentry)) {
-		printk(KERN_INFO
-		       "cgroup: Couldn't allocate dentry for %s: %ld\n", nodename,
-		       PTR_ERR(dentry));
-		ret = PTR_ERR(dentry);
-		goto out_release;
-	}
-
-	/* Create the cgroup directory, which also creates the cgroup */
-	ret = vfs_mkdir(inode, dentry, 0755);
-	child = __d_cgrp(dentry);
-	dput(dentry);
-	if (ret) {
-		printk(KERN_INFO
-		       "Failed to create cgroup %s: %d\n", nodename,
-		       ret);
-		goto out_release;
-	}
-
-	/* The cgroup now exists. Retake cgroup_mutex and check
-	 * that we're still in the same state that we thought we
-	 * were. */
-	mutex_lock(&cgroup_mutex);
-	if ((root != subsys->root) ||
-	    (parent != task_cgroup(tsk, subsys->subsys_id))) {
-		/* Aargh, we raced ... */
-		mutex_unlock(&inode->i_mutex);
-		put_css_set(cg);
-
-		deactivate_super(root->sb);
-		/* The cgroup is still accessible in the VFS, but
-		 * we're not going to try to rmdir() it at this
-		 * point. */
-		printk(KERN_INFO
-		       "Race in cgroup_clone() - leaking cgroup %s\n",
-		       nodename);
-		goto again;
-	}
-
-	/* do any required auto-setup */
-	for_each_subsys(root, ss) {
-		if (ss->post_clone)
-			ss->post_clone(ss, child);
-	}
-
-	/* All seems fine. Finish by moving the task into the new cgroup */
-	ret = cgroup_attach_task(child, tsk);
-	mutex_unlock(&cgroup_mutex);
-
- out_release:
-	mutex_unlock(&inode->i_mutex);
-
-	mutex_lock(&cgroup_mutex);
-	put_css_set(cg);
-	mutex_unlock(&cgroup_mutex);
-	deactivate_super(root->sb);
-	return ret;
-}
-
-/**
  * cgroup_is_descendant - see if @cgrp is a descendant of @task's cgrp
  * @cgrp: the cgroup in question
  * @task: the task in question
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 4349935..10f1835 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1828,10 +1828,9 @@ static int cpuset_populate(struct cgroup_subsys *ss, struct cgroup *cont)
 }
 
 /*
- * post_clone() is called at the end of cgroup_clone().
- * 'cgroup' was just created automatically as a result of
- * a cgroup_clone(), and the current task is about to
- * be moved into 'cgroup'.
+ * post_clone() is called during cgroup_create() when the
+ * clone_children mount argument was specified.  The cgroup
+ * can not yet have any tasks.
  *
  * Currently we refuse to set up the cgroup - thereby
  * refusing the task to be entered, and as a result refusing
diff --git a/kernel/fork.c b/kernel/fork.c
index 25e4291..4326cbe 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1193,12 +1193,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
 	if (clone_flags & CLONE_THREAD)
 		p->tgid = current->tgid;
 
-	if (current->nsproxy != p->nsproxy) {
-		retval = ns_cgroup_clone(p, pid);
-		if (retval)
-			goto bad_fork_free_pid;
-	}
-
 	p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL;
 	/*
 	 * Clear TID on mm_release()?
diff --git a/kernel/ns_cgroup.c b/kernel/ns_cgroup.c
deleted file mode 100644
index 2c98ad9..0000000
--- a/kernel/ns_cgroup.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * ns_cgroup.c - namespace cgroup subsystem
- *
- * Copyright 2006, 2007 IBM Corp
- */
-
-#include <linux/module.h>
-#include <linux/cgroup.h>
-#include <linux/fs.h>
-#include <linux/proc_fs.h>
-#include <linux/slab.h>
-#include <linux/nsproxy.h>
-
-struct ns_cgroup {
-	struct cgroup_subsys_state css;
-};
-
-struct cgroup_subsys ns_subsys;
-
-static inline struct ns_cgroup *cgroup_to_ns(
-		struct cgroup *cgroup)
-{
-	return container_of(cgroup_subsys_state(cgroup, ns_subsys_id),
-			    struct ns_cgroup, css);
-}
-
-int ns_cgroup_clone(struct task_struct *task, struct pid *pid)
-{
-	char name[PROC_NUMBUF];
-
-	snprintf(name, PROC_NUMBUF, "%d", pid_vnr(pid));
-	return cgroup_clone(task, &ns_subsys, name);
-}
-
-/*
- * Rules:
- *   1. you can only enter a cgroup which is a descendant of your current
- *     cgroup
- *   2. you can only place another process into a cgroup if
- *     a. you have CAP_SYS_ADMIN
- *     b. your cgroup is an ancestor of task's destination cgroup
- *       (hence either you are in the same cgroup as task, or in an
- *        ancestor cgroup thereof)
- */
-static int ns_can_attach(struct cgroup_subsys *ss, struct cgroup *new_cgroup,
-			 struct task_struct *task, bool threadgroup)
-{
-	if (current != task) {
-		if (!capable(CAP_SYS_ADMIN))
-			return -EPERM;
-
-		if (!cgroup_is_descendant(new_cgroup, current))
-			return -EPERM;
-	}
-
-	if (!cgroup_is_descendant(new_cgroup, task))
-		return -EPERM;
-
-	if (threadgroup) {
-		struct task_struct *c;
-		rcu_read_lock();
-		list_for_each_entry_rcu(c, &task->thread_group, thread_group) {
-			if (!cgroup_is_descendant(new_cgroup, c)) {
-				rcu_read_unlock();
-				return -EPERM;
-			}
-		}
-		rcu_read_unlock();
-	}
-
-	return 0;
-}
-
-/*
- * Rules: you can only create a cgroup if
- *     1. you are capable(CAP_SYS_ADMIN)
- *     2. the target cgroup is a descendant of your own cgroup
- */
-static struct cgroup_subsys_state *ns_create(struct cgroup_subsys *ss,
-						struct cgroup *cgroup)
-{
-	struct ns_cgroup *ns_cgroup;
-
-	if (!capable(CAP_SYS_ADMIN))
-		return ERR_PTR(-EPERM);
-	if (!cgroup_is_descendant(cgroup, current))
-		return ERR_PTR(-EPERM);
-	if (test_bit(CGRP_CLONE_CHILDREN, &cgroup->flags)) {
-		printk("ns_cgroup can't be created with parent "
-		       "'clone_children' set.\n");
-		return ERR_PTR(-EINVAL);
-	}
-
-	printk_once("ns_cgroup deprecated: consider using the "
-		    "'clone_children' flag without the ns_cgroup.\n");
-
-	ns_cgroup = kzalloc(sizeof(*ns_cgroup), GFP_KERNEL);
-	if (!ns_cgroup)
-		return ERR_PTR(-ENOMEM);
-	return &ns_cgroup->css;
-}
-
-static void ns_destroy(struct cgroup_subsys *ss,
-			struct cgroup *cgroup)
-{
-	struct ns_cgroup *ns_cgroup;
-
-	ns_cgroup = cgroup_to_ns(cgroup);
-	kfree(ns_cgroup);
-}
-
-struct cgroup_subsys ns_subsys = {
-	.name = "ns",
-	.can_attach = ns_can_attach,
-	.create = ns_create,
-	.destroy  = ns_destroy,
-	.subsys_id = ns_subsys_id,
-};
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
index f74e6c0..014a90d 100644
--- a/kernel/nsproxy.c
+++ b/kernel/nsproxy.c
@@ -198,10 +198,6 @@ int unshare_nsproxy_namespaces(unsigned long unshare_flags,
 		goto out;
 	}
 
-	err = ns_cgroup_clone(current, task_pid(current));
-	if (err)
-		put_nsproxy(*new_nsp);
-
 out:
 	return err;
 }
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] cgroup : remove the ns_cgroup
       [not found] ` <1295948388-15108-1-git-send-email-daniel.lezcano-GANU6spQydw@public.gmane.org>
@ 2011-01-27  0:16   ` Andrew Morton
  2011-01-27  0:18   ` Andrew Morton
  1 sibling, 0 replies; 14+ messages in thread
From: Andrew Morton @ 2011-01-27  0:16 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Tue, 25 Jan 2011 10:39:48 +0100
Daniel Lezcano <daniel.lezcano-GANU6spQydw@public.gmane.org> wrote:

> The ns_cgroup is an annoying cgroup at the namespace / cgroup frontier
> and leads to some problems:
> 
>         * cgroup creation is out-of-control
>         * cgroup name can conflict when pids are looping
>         * it is not possible to have a single process handling
>         a lot of namespaces without falling in a exponential creation time
>         * we may want to create a namespace without creating a cgroup
> 
>         The ns_cgroup was replaced by a compatibility flag 'clone_children',
>         where a newly created cgroup will copy the parent cgroup values.
>         The userspace has to manually create a cgroup and add a task to
>         the 'tasks' file.
> 
> This patch removes the ns_cgroup as suggested in the following thread:
> 
> https://lists.linux-foundation.org/pipermail/containers/2009-June/018616.html
> 
> The 'cgroup_clone' function is removed because it is no longer used.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano-GANU6spQydw@public.gmane.org>
> Signed-off-by: Serge E. Hallyn <serge.hallyn-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
> Cc: Eric W. Biederman <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
> Cc: Jamal Hadi Salim <hadi-fAAogVwAN2Kw5LPnMra/2Q@public.gmane.org>
> Reviewed-by: Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
> Acked-by: Paul Menage <menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
> Acked-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
>
> ...
>
>  22 files changed, 4 insertions(+), 287 deletions(-)

I didn't see that one coming.

This change is userspace-visible, is it not?  What are the implications
of this?  There's some discussion in that nearly-two-year-old thread
regarding making provision for back-compatibility but I'm not seeing
such things in this patch?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] cgroup : remove the ns_cgroup
  2011-01-25  9:39 [PATCH] cgroup : remove the ns_cgroup Daniel Lezcano
@ 2011-01-27  0:16 ` Andrew Morton
  2011-01-27  0:18 ` Andrew Morton
       [not found] ` <1295948388-15108-1-git-send-email-daniel.lezcano-GANU6spQydw@public.gmane.org>
  2 siblings, 0 replies; 14+ messages in thread
From: Andrew Morton @ 2011-01-27  0:16 UTC (permalink / raw)
  To: Daniel Lezcano; +Cc: containers, linux-kernel

On Tue, 25 Jan 2011 10:39:48 +0100
Daniel Lezcano <daniel.lezcano@free.fr> wrote:

> The ns_cgroup is an annoying cgroup at the namespace / cgroup frontier
> and leads to some problems:
> 
>         * cgroup creation is out-of-control
>         * cgroup name can conflict when pids are looping
>         * it is not possible to have a single process handling
>         a lot of namespaces without falling in a exponential creation time
>         * we may want to create a namespace without creating a cgroup
> 
>         The ns_cgroup was replaced by a compatibility flag 'clone_children',
>         where a newly created cgroup will copy the parent cgroup values.
>         The userspace has to manually create a cgroup and add a task to
>         the 'tasks' file.
> 
> This patch removes the ns_cgroup as suggested in the following thread:
> 
> https://lists.linux-foundation.org/pipermail/containers/2009-June/018616.html
> 
> The 'cgroup_clone' function is removed because it is no longer used.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
> Signed-off-by: Serge E. Hallyn <serge.hallyn@canonical.com>
> Cc: Eric W. Biederman <ebiederm@xmission.com>
> Cc: Jamal Hadi Salim <hadi@cyberus.ca>
> Reviewed-by: Li Zefan <lizf@cn.fujitsu.com>
> Acked-by: Paul Menage <menage@google.com>
> Acked-by: Matt Helsley <matthltc@us.ibm.com>
>
> ...
>
>  22 files changed, 4 insertions(+), 287 deletions(-)

I didn't see that one coming.

This change is userspace-visible, is it not?  What are the implications
of this?  There's some discussion in that nearly-two-year-old thread
regarding making provision for back-compatibility but I'm not seeing
such things in this patch?



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] cgroup : remove the ns_cgroup
       [not found] ` <1295948388-15108-1-git-send-email-daniel.lezcano-GANU6spQydw@public.gmane.org>
  2011-01-27  0:16   ` Andrew Morton
@ 2011-01-27  0:18   ` Andrew Morton
  1 sibling, 0 replies; 14+ messages in thread
From: Andrew Morton @ 2011-01-27  0:18 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Tue, 25 Jan 2011 10:39:48 +0100
Daniel Lezcano <daniel.lezcano-GANU6spQydw@public.gmane.org> wrote:

> This patch removes the ns_cgroup as suggested in the following thread:

I had this patch queued up in September last year, but dropped it.  Why
did I do that?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] cgroup : remove the ns_cgroup
  2011-01-25  9:39 [PATCH] cgroup : remove the ns_cgroup Daniel Lezcano
  2011-01-27  0:16 ` Andrew Morton
@ 2011-01-27  0:18 ` Andrew Morton
  2011-01-27  1:08   ` Li Zefan
       [not found]   ` <20110126161837.43830756.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
       [not found] ` <1295948388-15108-1-git-send-email-daniel.lezcano-GANU6spQydw@public.gmane.org>
  2 siblings, 2 replies; 14+ messages in thread
From: Andrew Morton @ 2011-01-27  0:18 UTC (permalink / raw)
  To: Daniel Lezcano; +Cc: containers, linux-kernel

On Tue, 25 Jan 2011 10:39:48 +0100
Daniel Lezcano <daniel.lezcano@free.fr> wrote:

> This patch removes the ns_cgroup as suggested in the following thread:

I had this patch queued up in September last year, but dropped it.  Why
did I do that?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] cgroup : remove the ns_cgroup
       [not found]   ` <20110126161837.43830756.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
@ 2011-01-27  1:08     ` Li Zefan
  0 siblings, 0 replies; 14+ messages in thread
From: Li Zefan @ 2011-01-27  1:08 UTC (permalink / raw)
  To: Andrew Morton
  Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Andrew Morton wrote:
> On Tue, 25 Jan 2011 10:39:48 +0100
> Daniel Lezcano <daniel.lezcano-GANU6spQydw@public.gmane.org> wrote:
> 
>> This patch removes the ns_cgroup as suggested in the following thread:
> 
> I had this patch queued up in September last year, but dropped it.  Why
> did I do that?

Because you wanted to wait for some time for users (if any) to notice this
coming change.

Author: Daniel Lezcano <daniel.lezcano-GANU6spQydw@public.gmane.org>
Date:   Wed Oct 27 15:33:38 2010 -0700

    cgroup: notify ns_cgroup deprecated
    
    The ns_cgroup will be removed very soon.  Let's warn, for this version,
    ns_cgroup is deprecated.
    
    Make ns_cgroup and clone_children exclusive.  If the clone_children is set
    and the ns_cgroup is mounted, let's fail with EINVAL when the ns_cgroup
    subsys is created (a printk will help the user to understand why the
    creation fails).
    
    Update the feature remove schedule file with the deprecated ns_cgroup.
    
    Signed-off-by: Daniel Lezcano <daniel.lezcano-GANU6spQydw@public.gmane.org>
    Acked-by: Paul Menage <menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
    Signed-off-by: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
    Signed-off-by: Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] cgroup : remove the ns_cgroup
  2011-01-27  0:18 ` Andrew Morton
@ 2011-01-27  1:08   ` Li Zefan
       [not found]     ` <4D40C5A3.4070703-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
  2011-01-27  1:45     ` Andrew Morton
       [not found]   ` <20110126161837.43830756.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
  1 sibling, 2 replies; 14+ messages in thread
From: Li Zefan @ 2011-01-27  1:08 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Daniel Lezcano, containers, linux-kernel

Andrew Morton wrote:
> On Tue, 25 Jan 2011 10:39:48 +0100
> Daniel Lezcano <daniel.lezcano@free.fr> wrote:
> 
>> This patch removes the ns_cgroup as suggested in the following thread:
> 
> I had this patch queued up in September last year, but dropped it.  Why
> did I do that?

Because you wanted to wait for some time for users (if any) to notice this
coming change.

Author: Daniel Lezcano <daniel.lezcano@free.fr>
Date:   Wed Oct 27 15:33:38 2010 -0700

    cgroup: notify ns_cgroup deprecated
    
    The ns_cgroup will be removed very soon.  Let's warn, for this version,
    ns_cgroup is deprecated.
    
    Make ns_cgroup and clone_children exclusive.  If the clone_children is set
    and the ns_cgroup is mounted, let's fail with EINVAL when the ns_cgroup
    subsys is created (a printk will help the user to understand why the
    creation fails).
    
    Update the feature remove schedule file with the deprecated ns_cgroup.
    
    Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
    Acked-by: Paul Menage <menage@google.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] cgroup : remove the ns_cgroup
       [not found]     ` <4D40C5A3.4070703-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
@ 2011-01-27  1:45       ` Andrew Morton
  0 siblings, 0 replies; 14+ messages in thread
From: Andrew Morton @ 2011-01-27  1:45 UTC (permalink / raw)
  To: Li Zefan
  Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Thu, 27 Jan 2011 09:08:51 +0800 Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> wrote:

> Andrew Morton wrote:
> > On Tue, 25 Jan 2011 10:39:48 +0100
> > Daniel Lezcano <daniel.lezcano-GANU6spQydw@public.gmane.org> wrote:
> > 
> >> This patch removes the ns_cgroup as suggested in the following thread:
> > 
> > I had this patch queued up in September last year, but dropped it.  Why
> > did I do that?
> 
> Because you wanted to wait for some time for users (if any) to notice this
> coming change.
> 
> Author: Daniel Lezcano <daniel.lezcano-GANU6spQydw@public.gmane.org>
> Date:   Wed Oct 27 15:33:38 2010 -0700
> 
>     cgroup: notify ns_cgroup deprecated
>     
>     The ns_cgroup will be removed very soon.  Let's warn, for this version,
>     ns_cgroup is deprecated.
>     
>     Make ns_cgroup and clone_children exclusive.  If the clone_children is set
>     and the ns_cgroup is mounted, let's fail with EINVAL when the ns_cgroup
>     subsys is created (a printk will help the user to understand why the
>     creation fails).
>     
>     Update the feature remove schedule file with the deprecated ns_cgroup.
>     
>     Signed-off-by: Daniel Lezcano <daniel.lezcano-GANU6spQydw@public.gmane.org>
>     Acked-by: Paul Menage <menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
>     Signed-off-by: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
>     Signed-off-by: Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>

ooh, that was clever of me.

Here is the text which was missing from the changelog:

  This is a userspace-visible change.  Commit 45531757b45c ("cgroup:
  notify ns_cgroup deprecated") (merged into 2.6.27) caused the kernel
  to emit a printk warning users that the feature is planned for
  removal.  Since that time we have heard from XXX users who were
  affected by this.

Please provide XXX.

How do we know that 2.6.37->2.6.38 is long enough?  Will any major
distros be released containing this warning in that timeframe?  I doubt
it.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] cgroup : remove the ns_cgroup
  2011-01-27  1:08   ` Li Zefan
       [not found]     ` <4D40C5A3.4070703-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
@ 2011-01-27  1:45     ` Andrew Morton
  2011-01-27  8:50       ` Daniel Lezcano
       [not found]       ` <20110126174513.c2a20fff.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
  1 sibling, 2 replies; 14+ messages in thread
From: Andrew Morton @ 2011-01-27  1:45 UTC (permalink / raw)
  To: Li Zefan; +Cc: Daniel Lezcano, containers, linux-kernel

On Thu, 27 Jan 2011 09:08:51 +0800 Li Zefan <lizf@cn.fujitsu.com> wrote:

> Andrew Morton wrote:
> > On Tue, 25 Jan 2011 10:39:48 +0100
> > Daniel Lezcano <daniel.lezcano@free.fr> wrote:
> > 
> >> This patch removes the ns_cgroup as suggested in the following thread:
> > 
> > I had this patch queued up in September last year, but dropped it.  Why
> > did I do that?
> 
> Because you wanted to wait for some time for users (if any) to notice this
> coming change.
> 
> Author: Daniel Lezcano <daniel.lezcano@free.fr>
> Date:   Wed Oct 27 15:33:38 2010 -0700
> 
>     cgroup: notify ns_cgroup deprecated
>     
>     The ns_cgroup will be removed very soon.  Let's warn, for this version,
>     ns_cgroup is deprecated.
>     
>     Make ns_cgroup and clone_children exclusive.  If the clone_children is set
>     and the ns_cgroup is mounted, let's fail with EINVAL when the ns_cgroup
>     subsys is created (a printk will help the user to understand why the
>     creation fails).
>     
>     Update the feature remove schedule file with the deprecated ns_cgroup.
>     
>     Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
>     Acked-by: Paul Menage <menage@google.com>
>     Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
>     Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

ooh, that was clever of me.

Here is the text which was missing from the changelog:

  This is a userspace-visible change.  Commit 45531757b45c ("cgroup:
  notify ns_cgroup deprecated") (merged into 2.6.27) caused the kernel
  to emit a printk warning users that the feature is planned for
  removal.  Since that time we have heard from XXX users who were
  affected by this.

Please provide XXX.

How do we know that 2.6.37->2.6.38 is long enough?  Will any major
distros be released containing this warning in that timeframe?  I doubt
it.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] cgroup : remove the ns_cgroup
       [not found]       ` <20110126174513.c2a20fff.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
@ 2011-01-27  8:50         ` Daniel Lezcano
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel Lezcano @ 2011-01-27  8:50 UTC (permalink / raw)
  To: Andrew Morton
  Cc: libvir-list-H+wXaHxf7aLQT0dZR+AlfA,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On 01/27/2011 02:45 AM, Andrew Morton wrote:
> On Thu, 27 Jan 2011 09:08:51 +0800 Li Zefan<lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>  wrote:
>
>> Andrew Morton wrote:
>>> On Tue, 25 Jan 2011 10:39:48 +0100
>>> Daniel Lezcano<daniel.lezcano-GANU6spQydw@public.gmane.org>  wrote:
>>>
>>>> This patch removes the ns_cgroup as suggested in the following thread:
>>> I had this patch queued up in September last year, but dropped it.  Why
>>> did I do that?
>> Because you wanted to wait for some time for users (if any) to notice this
>> coming change.
>>
>> Author: Daniel Lezcano<daniel.lezcano-GANU6spQydw@public.gmane.org>
>> Date:   Wed Oct 27 15:33:38 2010 -0700
>>
>>      cgroup: notify ns_cgroup deprecated
>>
>>      The ns_cgroup will be removed very soon.  Let's warn, for this version,
>>      ns_cgroup is deprecated.
>>
>>      Make ns_cgroup and clone_children exclusive.  If the clone_children is set
>>      and the ns_cgroup is mounted, let's fail with EINVAL when the ns_cgroup
>>      subsys is created (a printk will help the user to understand why the
>>      creation fails).
>>
>>      Update the feature remove schedule file with the deprecated ns_cgroup.
>>
>>      Signed-off-by: Daniel Lezcano<daniel.lezcano-GANU6spQydw@public.gmane.org>
>>      Acked-by: Paul Menage<menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
>>      Signed-off-by: Andrew Morton<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
>>      Signed-off-by: Linus Torvalds<torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
> ooh, that was clever of me.
>
> Here is the text which was missing from the changelog:
>
>    This is a userspace-visible change.  Commit 45531757b45c ("cgroup:
>    notify ns_cgroup deprecated") (merged into 2.6.27) caused the kernel
>    to emit a printk warning users that the feature is planned for
>    removal.  Since that time we have heard from XXX users who were
>    affected by this.
>
> Please provide XXX.

Ok, AFAIK nobody makes use of the ns_cgroup except the LXC userspace 
tools which I maintain and where
the backward compatibility with the ns_cgroup and the clone_children 
flag is already implemented.
Since today nobody seems to be affected by this.

I Cc'ed the libvirt mailing list.

> How do we know that 2.6.37->2.6.38 is long enough?  Will any major
> distros be released containing this warning in that timeframe?  I doubt
> it.

Hmm, maybe it is too short but I don't think someone will complain about 
this feature removal.
Google chromium is using the namespaces, hence a lot of cgroup is 
created on the system. The vsftpd and some pam modules uses the 
namespaces too.
I won't be surprised if one of these applications fails with 'clone' 
returning EEXIST ...

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] cgroup : remove the ns_cgroup
  2011-01-27  1:45     ` Andrew Morton
@ 2011-01-27  8:50       ` Daniel Lezcano
  2011-01-28 15:45         ` Daniel P. Berrange
       [not found]         ` <4D4131DE.3080309-GANU6spQydw@public.gmane.org>
       [not found]       ` <20110126174513.c2a20fff.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
  1 sibling, 2 replies; 14+ messages in thread
From: Daniel Lezcano @ 2011-01-27  8:50 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Li Zefan, containers, linux-kernel, libvir-list

On 01/27/2011 02:45 AM, Andrew Morton wrote:
> On Thu, 27 Jan 2011 09:08:51 +0800 Li Zefan<lizf@cn.fujitsu.com>  wrote:
>
>> Andrew Morton wrote:
>>> On Tue, 25 Jan 2011 10:39:48 +0100
>>> Daniel Lezcano<daniel.lezcano@free.fr>  wrote:
>>>
>>>> This patch removes the ns_cgroup as suggested in the following thread:
>>> I had this patch queued up in September last year, but dropped it.  Why
>>> did I do that?
>> Because you wanted to wait for some time for users (if any) to notice this
>> coming change.
>>
>> Author: Daniel Lezcano<daniel.lezcano@free.fr>
>> Date:   Wed Oct 27 15:33:38 2010 -0700
>>
>>      cgroup: notify ns_cgroup deprecated
>>
>>      The ns_cgroup will be removed very soon.  Let's warn, for this version,
>>      ns_cgroup is deprecated.
>>
>>      Make ns_cgroup and clone_children exclusive.  If the clone_children is set
>>      and the ns_cgroup is mounted, let's fail with EINVAL when the ns_cgroup
>>      subsys is created (a printk will help the user to understand why the
>>      creation fails).
>>
>>      Update the feature remove schedule file with the deprecated ns_cgroup.
>>
>>      Signed-off-by: Daniel Lezcano<daniel.lezcano@free.fr>
>>      Acked-by: Paul Menage<menage@google.com>
>>      Signed-off-by: Andrew Morton<akpm@linux-foundation.org>
>>      Signed-off-by: Linus Torvalds<torvalds@linux-foundation.org>
> ooh, that was clever of me.
>
> Here is the text which was missing from the changelog:
>
>    This is a userspace-visible change.  Commit 45531757b45c ("cgroup:
>    notify ns_cgroup deprecated") (merged into 2.6.27) caused the kernel
>    to emit a printk warning users that the feature is planned for
>    removal.  Since that time we have heard from XXX users who were
>    affected by this.
>
> Please provide XXX.

Ok, AFAIK nobody makes use of the ns_cgroup except the LXC userspace 
tools which I maintain and where
the backward compatibility with the ns_cgroup and the clone_children 
flag is already implemented.
Since today nobody seems to be affected by this.

I Cc'ed the libvirt mailing list.

> How do we know that 2.6.37->2.6.38 is long enough?  Will any major
> distros be released containing this warning in that timeframe?  I doubt
> it.

Hmm, maybe it is too short but I don't think someone will complain about 
this feature removal.
Google chromium is using the namespaces, hence a lot of cgroup is 
created on the system. The vsftpd and some pam modules uses the 
namespaces too.
I won't be surprised if one of these applications fails with 'clone' 
returning EEXIST ...


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] cgroup : remove the ns_cgroup
       [not found]         ` <4D4131DE.3080309-GANU6spQydw@public.gmane.org>
@ 2011-01-28 15:45           ` Daniel P. Berrange
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel P. Berrange @ 2011-01-28 15:45 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: libvir-list-H+wXaHxf7aLQT0dZR+AlfA, Andrew Morton,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Thu, Jan 27, 2011 at 09:50:38AM +0100, Daniel Lezcano wrote:
> On 01/27/2011 02:45 AM, Andrew Morton wrote:
> >On Thu, 27 Jan 2011 09:08:51 +0800 Li Zefan<lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>  wrote:
> >
> >>Andrew Morton wrote:
> >>>On Tue, 25 Jan 2011 10:39:48 +0100
> >>>Daniel Lezcano<daniel.lezcano-GANU6spQydw@public.gmane.org>  wrote:
> >>>
> >>>>This patch removes the ns_cgroup as suggested in the following thread:
> >>>I had this patch queued up in September last year, but dropped it.  Why
> >>>did I do that?
> >>Because you wanted to wait for some time for users (if any) to notice this
> >>coming change.
> >>
> >>Author: Daniel Lezcano<daniel.lezcano-GANU6spQydw@public.gmane.org>
> >>Date:   Wed Oct 27 15:33:38 2010 -0700
> >>
> >>     cgroup: notify ns_cgroup deprecated
> >>
> >>     The ns_cgroup will be removed very soon.  Let's warn, for this version,
> >>     ns_cgroup is deprecated.
> >>
> >>     Make ns_cgroup and clone_children exclusive.  If the clone_children is set
> >>     and the ns_cgroup is mounted, let's fail with EINVAL when the ns_cgroup
> >>     subsys is created (a printk will help the user to understand why the
> >>     creation fails).
> >>
> >>     Update the feature remove schedule file with the deprecated ns_cgroup.
> >>
> >>     Signed-off-by: Daniel Lezcano<daniel.lezcano-GANU6spQydw@public.gmane.org>
> >>     Acked-by: Paul Menage<menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
> >>     Signed-off-by: Andrew Morton<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
> >>     Signed-off-by: Linus Torvalds<torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
> >ooh, that was clever of me.
> >
> >Here is the text which was missing from the changelog:
> >
> >   This is a userspace-visible change.  Commit 45531757b45c ("cgroup:
> >   notify ns_cgroup deprecated") (merged into 2.6.27) caused the kernel
> >   to emit a printk warning users that the feature is planned for
> >   removal.  Since that time we have heard from XXX users who were
> >   affected by this.
> >
> >Please provide XXX.
> 
> Ok, AFAIK nobody makes use of the ns_cgroup except the LXC userspace
> tools which I maintain and where
> the backward compatibility with the ns_cgroup and the clone_children
> flag is already implemented.
> Since today nobody seems to be affected by this.
> 
> I Cc'ed the libvirt mailing list.

Removing 'ns_cgroup' won't impact libvirt's container
support in any negative way, so fine by me.

Regards,
Daniel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] cgroup : remove the ns_cgroup
  2011-01-27  8:50       ` Daniel Lezcano
@ 2011-01-28 15:45         ` Daniel P. Berrange
       [not found]         ` <4D4131DE.3080309-GANU6spQydw@public.gmane.org>
  1 sibling, 0 replies; 14+ messages in thread
From: Daniel P. Berrange @ 2011-01-28 15:45 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Andrew Morton, Li Zefan, containers, linux-kernel, libvir-list

On Thu, Jan 27, 2011 at 09:50:38AM +0100, Daniel Lezcano wrote:
> On 01/27/2011 02:45 AM, Andrew Morton wrote:
> >On Thu, 27 Jan 2011 09:08:51 +0800 Li Zefan<lizf@cn.fujitsu.com>  wrote:
> >
> >>Andrew Morton wrote:
> >>>On Tue, 25 Jan 2011 10:39:48 +0100
> >>>Daniel Lezcano<daniel.lezcano@free.fr>  wrote:
> >>>
> >>>>This patch removes the ns_cgroup as suggested in the following thread:
> >>>I had this patch queued up in September last year, but dropped it.  Why
> >>>did I do that?
> >>Because you wanted to wait for some time for users (if any) to notice this
> >>coming change.
> >>
> >>Author: Daniel Lezcano<daniel.lezcano@free.fr>
> >>Date:   Wed Oct 27 15:33:38 2010 -0700
> >>
> >>     cgroup: notify ns_cgroup deprecated
> >>
> >>     The ns_cgroup will be removed very soon.  Let's warn, for this version,
> >>     ns_cgroup is deprecated.
> >>
> >>     Make ns_cgroup and clone_children exclusive.  If the clone_children is set
> >>     and the ns_cgroup is mounted, let's fail with EINVAL when the ns_cgroup
> >>     subsys is created (a printk will help the user to understand why the
> >>     creation fails).
> >>
> >>     Update the feature remove schedule file with the deprecated ns_cgroup.
> >>
> >>     Signed-off-by: Daniel Lezcano<daniel.lezcano@free.fr>
> >>     Acked-by: Paul Menage<menage@google.com>
> >>     Signed-off-by: Andrew Morton<akpm@linux-foundation.org>
> >>     Signed-off-by: Linus Torvalds<torvalds@linux-foundation.org>
> >ooh, that was clever of me.
> >
> >Here is the text which was missing from the changelog:
> >
> >   This is a userspace-visible change.  Commit 45531757b45c ("cgroup:
> >   notify ns_cgroup deprecated") (merged into 2.6.27) caused the kernel
> >   to emit a printk warning users that the feature is planned for
> >   removal.  Since that time we have heard from XXX users who were
> >   affected by this.
> >
> >Please provide XXX.
> 
> Ok, AFAIK nobody makes use of the ns_cgroup except the LXC userspace
> tools which I maintain and where
> the backward compatibility with the ns_cgroup and the clone_children
> flag is already implemented.
> Since today nobody seems to be affected by this.
> 
> I Cc'ed the libvirt mailing list.

Removing 'ns_cgroup' won't impact libvirt's container
support in any negative way, so fine by me.

Regards,
Daniel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] cgroup : remove the ns_cgroup
@ 2011-01-25  9:39 Daniel Lezcano
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel Lezcano @ 2011-01-25  9:39 UTC (permalink / raw)
  To: akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b
  Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

The ns_cgroup is an annoying cgroup at the namespace / cgroup frontier
and leads to some problems:

        * cgroup creation is out-of-control
        * cgroup name can conflict when pids are looping
        * it is not possible to have a single process handling
        a lot of namespaces without falling in a exponential creation time
        * we may want to create a namespace without creating a cgroup

        The ns_cgroup was replaced by a compatibility flag 'clone_children',
        where a newly created cgroup will copy the parent cgroup values.
        The userspace has to manually create a cgroup and add a task to
        the 'tasks' file.

This patch removes the ns_cgroup as suggested in the following thread:

https://lists.linux-foundation.org/pipermail/containers/2009-June/018616.html

The 'cgroup_clone' function is removed because it is no longer used.

Signed-off-by: Daniel Lezcano <daniel.lezcano-GANU6spQydw@public.gmane.org>
Signed-off-by: Serge E. Hallyn <serge.hallyn-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
Cc: Eric W. Biederman <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
Cc: Jamal Hadi Salim <hadi-fAAogVwAN2Kw5LPnMra/2Q@public.gmane.org>
Reviewed-by: Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Acked-by: Paul Menage <menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Acked-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
 Documentation/cgroups/cgroups.txt      |    2 +-
 arch/mips/configs/bcm47xx_defconfig    |    1 -
 arch/mn10300/configs/asb2364_defconfig |    1 -
 arch/powerpc/configs/ppc6xx_defconfig  |    1 -
 arch/powerpc/configs/pseries_defconfig |    1 -
 arch/sh/configs/apsh4ad0a_defconfig    |    1 -
 arch/sh/configs/sdk7786_defconfig      |    1 -
 arch/sh/configs/se7206_defconfig       |    1 -
 arch/sh/configs/shx3_defconfig         |    1 -
 arch/sh/configs/urquell_defconfig      |    1 -
 arch/x86/configs/i386_defconfig        |    1 -
 arch/x86/configs/x86_64_defconfig      |    1 -
 include/linux/cgroup.h                 |    3 -
 include/linux/cgroup_subsys.h          |    6 --
 include/linux/nsproxy.h                |    9 ---
 init/Kconfig                           |    8 --
 kernel/Makefile                        |    1 -
 kernel/cgroup.c                        |  116 -------------------------------
 kernel/cpuset.c                        |    7 +-
 kernel/fork.c                          |    6 --
 kernel/ns_cgroup.c                     |  118 --------------------------------
 kernel/nsproxy.c                       |    4 -
 22 files changed, 4 insertions(+), 287 deletions(-)
 delete mode 100644 kernel/ns_cgroup.c

diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt
index 44b8b7a..ac759b6 100644
--- a/Documentation/cgroups/cgroups.txt
+++ b/Documentation/cgroups/cgroups.txt
@@ -618,7 +618,7 @@ always handled well.
 void post_clone(struct cgroup_subsys *ss, struct cgroup *cgrp)
 (cgroup_mutex held by caller)
 
-Called at the end of cgroup_clone() to do any parameter
+Called during cgroup_create() to do any parameter
 initialization which might be required before a task could attach.  For
 example in cpusets, no task may attach before 'cpus' and 'mems' are set
 up.
diff --git a/arch/mips/configs/bcm47xx_defconfig b/arch/mips/configs/bcm47xx_defconfig
index 927d58b..c4338e0 100644
--- a/arch/mips/configs/bcm47xx_defconfig
+++ b/arch/mips/configs/bcm47xx_defconfig
@@ -16,7 +16,6 @@ CONFIG_TASK_IO_ACCOUNTING=y
 CONFIG_AUDIT=y
 CONFIG_TINY_RCU=y
 CONFIG_CGROUPS=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_CPUACCT=y
 CONFIG_RELAY=y
 CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/mn10300/configs/asb2364_defconfig b/arch/mn10300/configs/asb2364_defconfig
index 83ce2f2..d38391a 100644
--- a/arch/mn10300/configs/asb2364_defconfig
+++ b/arch/mn10300/configs/asb2364_defconfig
@@ -8,7 +8,6 @@ CONFIG_TASK_XACCT=y
 CONFIG_TASK_IO_ACCOUNTING=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_CGROUPS=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_FREEZER=y
 CONFIG_CGROUP_DEVICE=y
 CONFIG_CGROUP_CPUACCT=y
diff --git a/arch/powerpc/configs/ppc6xx_defconfig b/arch/powerpc/configs/ppc6xx_defconfig
index 9d64a68..9b253f6 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -10,7 +10,6 @@ CONFIG_TASK_XACCT=y
 CONFIG_TASK_IO_ACCOUNTING=y
 CONFIG_AUDIT=y
 CONFIG_CGROUPS=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_DEVICE=y
 CONFIG_CGROUP_CPUACCT=y
 CONFIG_RESOURCE_COUNTERS=y
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index f87f0e1..972587f 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -15,7 +15,6 @@ CONFIG_AUDITSYSCALL=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_CGROUPS=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_FREEZER=y
 CONFIG_CGROUP_DEVICE=y
 CONFIG_CPUSETS=y
diff --git a/arch/sh/configs/apsh4ad0a_defconfig b/arch/sh/configs/apsh4ad0a_defconfig
index e71a531..f722a3d 100644
--- a/arch/sh/configs/apsh4ad0a_defconfig
+++ b/arch/sh/configs/apsh4ad0a_defconfig
@@ -7,7 +7,6 @@ CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_CGROUPS=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_FREEZER=y
 CONFIG_CGROUP_DEVICE=y
 CONFIG_CGROUP_CPUACCT=y
diff --git a/arch/sh/configs/sdk7786_defconfig b/arch/sh/configs/sdk7786_defconfig
index dc4a2eb..9fdabe2 100644
--- a/arch/sh/configs/sdk7786_defconfig
+++ b/arch/sh/configs/sdk7786_defconfig
@@ -12,7 +12,6 @@ CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_CGROUPS=y
 CONFIG_CGROUP_DEBUG=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_FREEZER=y
 CONFIG_CGROUP_DEVICE=y
 CONFIG_CPUSETS=y
diff --git a/arch/sh/configs/se7206_defconfig b/arch/sh/configs/se7206_defconfig
index a468ff2..72c3fad 100644
--- a/arch/sh/configs/se7206_defconfig
+++ b/arch/sh/configs/se7206_defconfig
@@ -8,7 +8,6 @@ CONFIG_RCU_TRACE=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_CGROUPS=y
 CONFIG_CGROUP_DEBUG=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_DEVICE=y
 CONFIG_CGROUP_CPUACCT=y
 CONFIG_RESOURCE_COUNTERS=y
diff --git a/arch/sh/configs/shx3_defconfig b/arch/sh/configs/shx3_defconfig
index 3f92d37..6bb4130 100644
--- a/arch/sh/configs/shx3_defconfig
+++ b/arch/sh/configs/shx3_defconfig
@@ -9,7 +9,6 @@ CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_CGROUPS=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_FREEZER=y
 CONFIG_CGROUP_DEVICE=y
 CONFIG_CGROUP_CPUACCT=y
diff --git a/arch/sh/configs/urquell_defconfig b/arch/sh/configs/urquell_defconfig
index 7b3daec..8bfa4d0 100644
--- a/arch/sh/configs/urquell_defconfig
+++ b/arch/sh/configs/urquell_defconfig
@@ -9,7 +9,6 @@ CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_CGROUPS=y
 CONFIG_CGROUP_DEBUG=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_FREEZER=y
 CONFIG_CGROUP_DEVICE=y
 CONFIG_CPUSETS=y
diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig
index 6f98726..2bf1805 100644
--- a/arch/x86/configs/i386_defconfig
+++ b/arch/x86/configs/i386_defconfig
@@ -10,7 +10,6 @@ CONFIG_TASK_IO_ACCOUNTING=y
 CONFIG_AUDIT=y
 CONFIG_LOG_BUF_SHIFT=18
 CONFIG_CGROUPS=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_FREEZER=y
 CONFIG_CPUSETS=y
 CONFIG_CGROUP_CPUACCT=y
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index ee01a9d..22a0dc8 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -11,7 +11,6 @@ CONFIG_TASK_IO_ACCOUNTING=y
 CONFIG_AUDIT=y
 CONFIG_LOG_BUF_SHIFT=18
 CONFIG_CGROUPS=y
-CONFIG_CGROUP_NS=y
 CONFIG_CGROUP_FREEZER=y
 CONFIG_CPUSETS=y
 CONFIG_CGROUP_CPUACCT=y
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index ce104e3..d0509a3 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -552,9 +552,6 @@ static inline struct cgroup* task_cgroup(struct task_struct *task,
 	return task_subsys_state(task, subsys_id)->cgroup;
 }
 
-int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *ss,
-							char *nodename);
-
 /* A cgroup_iter should be treated as an opaque object */
 struct cgroup_iter {
 	struct list_head *cg_link;
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index ccefff0..4ba5259 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -19,12 +19,6 @@ SUBSYS(debug)
 
 /* */
 
-#ifdef CONFIG_CGROUP_NS
-SUBSYS(ns)
-#endif
-
-/* */
-
 #ifdef CONFIG_CGROUP_SCHED
 SUBSYS(cpu_cgroup)
 #endif
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index 7b370c7..50d20ab 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -81,13 +81,4 @@ static inline void get_nsproxy(struct nsproxy *ns)
 	atomic_inc(&ns->count);
 }
 
-#ifdef CONFIG_CGROUP_NS
-int ns_cgroup_clone(struct task_struct *tsk, struct pid *pid);
-#else
-static inline int ns_cgroup_clone(struct task_struct *tsk, struct pid *pid)
-{
-	return 0;
-}
-#endif
-
 #endif
diff --git a/init/Kconfig b/init/Kconfig
index 1379adc..7acdfb4 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -582,14 +582,6 @@ config CGROUP_DEBUG
 
 	  Say N if unsure.
 
-config CGROUP_NS
-	bool "Namespace cgroup subsystem"
-	help
-	  Provides a simple namespace cgroup subsystem to
-	  provide hierarchical naming of sets of namespaces,
-	  for instance virtual servers and checkpoint/restart
-	  jobs.
-
 config CGROUP_FREEZER
 	bool "Freezer cgroup subsystem"
 	help
diff --git a/kernel/Makefile b/kernel/Makefile
index 353d3fe..bd1b486 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -62,7 +62,6 @@ obj-$(CONFIG_COMPAT) += compat.o
 obj-$(CONFIG_CGROUPS) += cgroup.o
 obj-$(CONFIG_CGROUP_FREEZER) += cgroup_freezer.o
 obj-$(CONFIG_CPUSETS) += cpuset.o
-obj-$(CONFIG_CGROUP_NS) += ns_cgroup.o
 obj-$(CONFIG_UTS_NS) += utsname.o
 obj-$(CONFIG_USER_NS) += user_namespace.o
 obj-$(CONFIG_PID_NS) += pid_namespace.o
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index b24d702..9b92442 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4267,122 +4267,6 @@ void cgroup_exit(struct task_struct *tsk, int run_callbacks)
 }
 
 /**
- * cgroup_clone - clone the cgroup the given subsystem is attached to
- * @tsk: the task to be moved
- * @subsys: the given subsystem
- * @nodename: the name for the new cgroup
- *
- * Duplicate the current cgroup in the hierarchy that the given
- * subsystem is attached to, and move this task into the new
- * child.
- */
-int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys,
-							char *nodename)
-{
-	struct dentry *dentry;
-	int ret = 0;
-	struct cgroup *parent, *child;
-	struct inode *inode;
-	struct css_set *cg;
-	struct cgroupfs_root *root;
-	struct cgroup_subsys *ss;
-
-	/* We shouldn't be called by an unregistered subsystem */
-	BUG_ON(!subsys->active);
-
-	/* First figure out what hierarchy and cgroup we're dealing
-	 * with, and pin them so we can drop cgroup_mutex */
-	mutex_lock(&cgroup_mutex);
- again:
-	root = subsys->root;
-	if (root == &rootnode) {
-		mutex_unlock(&cgroup_mutex);
-		return 0;
-	}
-
-	/* Pin the hierarchy */
-	if (!atomic_inc_not_zero(&root->sb->s_active)) {
-		/* We race with the final deactivate_super() */
-		mutex_unlock(&cgroup_mutex);
-		return 0;
-	}
-
-	/* Keep the cgroup alive */
-	task_lock(tsk);
-	parent = task_cgroup(tsk, subsys->subsys_id);
-	cg = tsk->cgroups;
-	get_css_set(cg);
-	task_unlock(tsk);
-
-	mutex_unlock(&cgroup_mutex);
-
-	/* Now do the VFS work to create a cgroup */
-	inode = parent->dentry->d_inode;
-
-	/* Hold the parent directory mutex across this operation to
-	 * stop anyone else deleting the new cgroup */
-	mutex_lock(&inode->i_mutex);
-	dentry = lookup_one_len(nodename, parent->dentry, strlen(nodename));
-	if (IS_ERR(dentry)) {
-		printk(KERN_INFO
-		       "cgroup: Couldn't allocate dentry for %s: %ld\n", nodename,
-		       PTR_ERR(dentry));
-		ret = PTR_ERR(dentry);
-		goto out_release;
-	}
-
-	/* Create the cgroup directory, which also creates the cgroup */
-	ret = vfs_mkdir(inode, dentry, 0755);
-	child = __d_cgrp(dentry);
-	dput(dentry);
-	if (ret) {
-		printk(KERN_INFO
-		       "Failed to create cgroup %s: %d\n", nodename,
-		       ret);
-		goto out_release;
-	}
-
-	/* The cgroup now exists. Retake cgroup_mutex and check
-	 * that we're still in the same state that we thought we
-	 * were. */
-	mutex_lock(&cgroup_mutex);
-	if ((root != subsys->root) ||
-	    (parent != task_cgroup(tsk, subsys->subsys_id))) {
-		/* Aargh, we raced ... */
-		mutex_unlock(&inode->i_mutex);
-		put_css_set(cg);
-
-		deactivate_super(root->sb);
-		/* The cgroup is still accessible in the VFS, but
-		 * we're not going to try to rmdir() it at this
-		 * point. */
-		printk(KERN_INFO
-		       "Race in cgroup_clone() - leaking cgroup %s\n",
-		       nodename);
-		goto again;
-	}
-
-	/* do any required auto-setup */
-	for_each_subsys(root, ss) {
-		if (ss->post_clone)
-			ss->post_clone(ss, child);
-	}
-
-	/* All seems fine. Finish by moving the task into the new cgroup */
-	ret = cgroup_attach_task(child, tsk);
-	mutex_unlock(&cgroup_mutex);
-
- out_release:
-	mutex_unlock(&inode->i_mutex);
-
-	mutex_lock(&cgroup_mutex);
-	put_css_set(cg);
-	mutex_unlock(&cgroup_mutex);
-	deactivate_super(root->sb);
-	return ret;
-}
-
-/**
  * cgroup_is_descendant - see if @cgrp is a descendant of @task's cgrp
  * @cgrp: the cgroup in question
  * @task: the task in question
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 4349935..10f1835 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1828,10 +1828,9 @@ static int cpuset_populate(struct cgroup_subsys *ss, struct cgroup *cont)
 }
 
 /*
- * post_clone() is called at the end of cgroup_clone().
- * 'cgroup' was just created automatically as a result of
- * a cgroup_clone(), and the current task is about to
- * be moved into 'cgroup'.
+ * post_clone() is called during cgroup_create() when the
+ * clone_children mount argument was specified.  The cgroup
+ * can not yet have any tasks.
  *
  * Currently we refuse to set up the cgroup - thereby
  * refusing the task to be entered, and as a result refusing
diff --git a/kernel/fork.c b/kernel/fork.c
index 25e4291..4326cbe 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1193,12 +1193,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
 	if (clone_flags & CLONE_THREAD)
 		p->tgid = current->tgid;
 
-	if (current->nsproxy != p->nsproxy) {
-		retval = ns_cgroup_clone(p, pid);
-		if (retval)
-			goto bad_fork_free_pid;
-	}
-
 	p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL;
 	/*
 	 * Clear TID on mm_release()?
diff --git a/kernel/ns_cgroup.c b/kernel/ns_cgroup.c
deleted file mode 100644
index 2c98ad9..0000000
--- a/kernel/ns_cgroup.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * ns_cgroup.c - namespace cgroup subsystem
- *
- * Copyright 2006, 2007 IBM Corp
- */
-
-#include <linux/module.h>
-#include <linux/cgroup.h>
-#include <linux/fs.h>
-#include <linux/proc_fs.h>
-#include <linux/slab.h>
-#include <linux/nsproxy.h>
-
-struct ns_cgroup {
-	struct cgroup_subsys_state css;
-};
-
-struct cgroup_subsys ns_subsys;
-
-static inline struct ns_cgroup *cgroup_to_ns(
-		struct cgroup *cgroup)
-{
-	return container_of(cgroup_subsys_state(cgroup, ns_subsys_id),
-			    struct ns_cgroup, css);
-}
-
-int ns_cgroup_clone(struct task_struct *task, struct pid *pid)
-{
-	char name[PROC_NUMBUF];
-
-	snprintf(name, PROC_NUMBUF, "%d", pid_vnr(pid));
-	return cgroup_clone(task, &ns_subsys, name);
-}
-
-/*
- * Rules:
- *   1. you can only enter a cgroup which is a descendant of your current
- *     cgroup
- *   2. you can only place another process into a cgroup if
- *     a. you have CAP_SYS_ADMIN
- *     b. your cgroup is an ancestor of task's destination cgroup
- *       (hence either you are in the same cgroup as task, or in an
- *        ancestor cgroup thereof)
- */
-static int ns_can_attach(struct cgroup_subsys *ss, struct cgroup *new_cgroup,
-			 struct task_struct *task, bool threadgroup)
-{
-	if (current != task) {
-		if (!capable(CAP_SYS_ADMIN))
-			return -EPERM;
-
-		if (!cgroup_is_descendant(new_cgroup, current))
-			return -EPERM;
-	}
-
-	if (!cgroup_is_descendant(new_cgroup, task))
-		return -EPERM;
-
-	if (threadgroup) {
-		struct task_struct *c;
-		rcu_read_lock();
-		list_for_each_entry_rcu(c, &task->thread_group, thread_group) {
-			if (!cgroup_is_descendant(new_cgroup, c)) {
-				rcu_read_unlock();
-				return -EPERM;
-			}
-		}
-		rcu_read_unlock();
-	}
-
-	return 0;
-}
-
-/*
- * Rules: you can only create a cgroup if
- *     1. you are capable(CAP_SYS_ADMIN)
- *     2. the target cgroup is a descendant of your own cgroup
- */
-static struct cgroup_subsys_state *ns_create(struct cgroup_subsys *ss,
-						struct cgroup *cgroup)
-{
-	struct ns_cgroup *ns_cgroup;
-
-	if (!capable(CAP_SYS_ADMIN))
-		return ERR_PTR(-EPERM);
-	if (!cgroup_is_descendant(cgroup, current))
-		return ERR_PTR(-EPERM);
-	if (test_bit(CGRP_CLONE_CHILDREN, &cgroup->flags)) {
-		printk("ns_cgroup can't be created with parent "
-		       "'clone_children' set.\n");
-		return ERR_PTR(-EINVAL);
-	}
-
-	printk_once("ns_cgroup deprecated: consider using the "
-		    "'clone_children' flag without the ns_cgroup.\n");
-
-	ns_cgroup = kzalloc(sizeof(*ns_cgroup), GFP_KERNEL);
-	if (!ns_cgroup)
-		return ERR_PTR(-ENOMEM);
-	return &ns_cgroup->css;
-}
-
-static void ns_destroy(struct cgroup_subsys *ss,
-			struct cgroup *cgroup)
-{
-	struct ns_cgroup *ns_cgroup;
-
-	ns_cgroup = cgroup_to_ns(cgroup);
-	kfree(ns_cgroup);
-}
-
-struct cgroup_subsys ns_subsys = {
-	.name = "ns",
-	.can_attach = ns_can_attach,
-	.create = ns_create,
-	.destroy  = ns_destroy,
-	.subsys_id = ns_subsys_id,
-};
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
index f74e6c0..014a90d 100644
--- a/kernel/nsproxy.c
+++ b/kernel/nsproxy.c
@@ -198,10 +198,6 @@ int unshare_nsproxy_namespaces(unsigned long unshare_flags,
 		goto out;
 	}
 
-	err = ns_cgroup_clone(current, task_pid(current));
-	if (err)
-		put_nsproxy(*new_nsp);
-
 out:
 	return err;
 }
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-01-28 15:46 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-25  9:39 [PATCH] cgroup : remove the ns_cgroup Daniel Lezcano
2011-01-27  0:16 ` Andrew Morton
2011-01-27  0:18 ` Andrew Morton
2011-01-27  1:08   ` Li Zefan
     [not found]     ` <4D40C5A3.4070703-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2011-01-27  1:45       ` Andrew Morton
2011-01-27  1:45     ` Andrew Morton
2011-01-27  8:50       ` Daniel Lezcano
2011-01-28 15:45         ` Daniel P. Berrange
     [not found]         ` <4D4131DE.3080309-GANU6spQydw@public.gmane.org>
2011-01-28 15:45           ` Daniel P. Berrange
     [not found]       ` <20110126174513.c2a20fff.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2011-01-27  8:50         ` Daniel Lezcano
     [not found]   ` <20110126161837.43830756.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2011-01-27  1:08     ` Li Zefan
     [not found] ` <1295948388-15108-1-git-send-email-daniel.lezcano-GANU6spQydw@public.gmane.org>
2011-01-27  0:16   ` Andrew Morton
2011-01-27  0:18   ` Andrew Morton
2011-01-25  9:39 Daniel Lezcano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.