Merge branch 'for-4.6-ns' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 21 Mar 2016 17:05:13 +0000 (10:05 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 21 Mar 2016 17:05:13 +0000 (10:05 -0700)
Pull cgroup namespace support from Tejun Heo:
 "These are changes to implement namespace support for cgroup which has
  been pending for quite some time now.  It is very straight-forward and
  only affects what part of cgroup hierarchies are visible.

  After unsharing, mounting a cgroup fs will be scoped to the cgroups
  the task belonged to at the time of unsharing and the cgroup paths
  exposed to userland would be adjusted accordingly"

* 'for-4.6-ns' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
  cgroup: fix and restructure error handling in copy_cgroup_ns()
  cgroup: fix alloc_cgroup_ns() error handling in copy_cgroup_ns()
  Add FS_USERNS_FLAG to cgroup fs
  cgroup: Add documentation for cgroup namespaces
  cgroup: mount cgroupns-root when inside non-init cgroupns
  kernfs: define kernfs_node_dentry
  cgroup: cgroup namespace setns support
  cgroup: introduce cgroup namespaces
  sched: new clone flag CLONE_NEWCGROUP for cgroup namespace
  kernfs: Add API to generate relative kernfs path

1  2 
Documentation/cgroup-v2.txt
fs/kernfs/dir.c
kernel/cgroup.c
kernel/cpuset.c
kernel/fork.c

Simple merge
diff --cc fs/kernfs/dir.c
Simple merge
diff --cc kernel/cgroup.c
@@@ -211,12 -211,21 +214,21 @@@ static u64 css_serial_nr_next = 1
   * fork/exit handlers to call. This avoids us having to do extra work in the
   * fork/exit path to check which subsystems have fork/exit callbacks.
   */
 -static unsigned long have_fork_callback __read_mostly;
 -static unsigned long have_exit_callback __read_mostly;
 -static unsigned long have_free_callback __read_mostly;
 +static u16 have_fork_callback __read_mostly;
 +static u16 have_exit_callback __read_mostly;
 +static u16 have_free_callback __read_mostly;
  
+ /* cgroup namespace for init task */
+ struct cgroup_namespace init_cgroup_ns = {
+       .count          = { .counter = 2, },
+       .user_ns        = &init_user_ns,
+       .ns.ops         = &cgroupns_operations,
+       .ns.inum        = PROC_CGROUP_INIT_INO,
+       .root_cset      = &init_css_set,
+ };
  /* Ditto for the can_fork callback. */
 -static unsigned long have_canfork_callback __read_mostly;
 +static u16 have_canfork_callback __read_mostly;
  
  static struct file_system_type cgroup2_fs_type;
  static struct cftype cgroup_dfl_base_files[];
@@@ -2020,9 -2021,10 +2041,10 @@@ static struct dentry *cgroup_mount(stru
        if (is_v2) {
                if (data) {
                        pr_err("cgroup2: unknown option \"%s\"\n", (char *)data);
+                       put_cgroup_ns(ns);
                        return ERR_PTR(-EINVAL);
                }
 -              cgrp_dfl_root_visible = true;
 +              cgrp_dfl_visible = true;
                root = &cgrp_dfl_root;
                cgroup_get(&root->cgrp);
                goto out_mount;
@@@ -5450,14 -5386,13 +5539,16 @@@ int __init cgroup_init(void
        BUG_ON(cgroup_init_cftypes(NULL, cgroup_dfl_base_files));
        BUG_ON(cgroup_init_cftypes(NULL, cgroup_legacy_base_files));
  
+       get_user_ns(init_cgroup_ns.user_ns);
        mutex_lock(&cgroup_mutex);
  
 -      /* Add init_css_set to the hash table */
 -      key = css_set_hash(init_css_set.subsys);
 -      hash_add(css_set_table, &init_css_set.hlist, key);
 +      /*
 +       * Add init_css_set to the hash table so that dfl_root can link to
 +       * it during init.
 +       */
 +      hash_add(css_set_table, &init_css_set.hlist,
 +               css_set_hash(init_css_set.subsys));
  
        BUG_ON(cgroup_setup_root(&cgrp_dfl_root, 0));
  
diff --cc kernel/cpuset.c
Simple merge
diff --cc kernel/fork.c
Simple merge