]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
Merge branch 'vhost-net' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
authorDavid S. Miller <davem@davemloft.net>
Fri, 10 Sep 2010 04:59:51 +0000 (21:59 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 10 Sep 2010 04:59:51 +0000 (21:59 -0700)
1  2 
kernel/cgroup.c

diff --combined kernel/cgroup.c
index 192f88c5b0f9df29b80d51d4c5ceba5388d099eb,9d90c08f3bdedf768a86cdd9f01874a1e0a87c8b..ed19afd9e3fe3f74eacada4c6b79deca210a689c
@@@ -1102,7 -1102,7 +1102,7 @@@ static int parse_cgroupfs_options(char 
                        if (opts->release_agent)
                                return -EINVAL;
                        opts->release_agent =
 -                              kstrndup(token + 14, PATH_MAX, GFP_KERNEL);
 +                              kstrndup(token + 14, PATH_MAX - 1, GFP_KERNEL);
                        if (!opts->release_agent)
                                return -ENOMEM;
                } else if (!strncmp(token, "name=", 5)) {
                        if (opts->name)
                                return -EINVAL;
                        opts->name = kstrndup(name,
 -                                            MAX_CGROUP_ROOT_NAMELEN,
 +                                            MAX_CGROUP_ROOT_NAMELEN - 1,
                                              GFP_KERNEL);
                        if (!opts->name)
                                return -ENOMEM;
@@@ -1623,8 -1623,6 +1623,8 @@@ static struct file_system_type cgroup_f
        .kill_sb = cgroup_kill_sb,
  };
  
 +static struct kobject *cgroup_kobj;
 +
  static inline struct cgroup *__d_cgrp(struct dentry *dentry)
  {
        return dentry->d_fsdata;
  }
  
  /**
-  * cgroup_attach_task_current_cg - attach task 'tsk' to current task's cgroup
+  * cgroup_attach_task_all - attach task 'tsk' to all cgroups of task 'from'
+  * @from: attach to all cgroups of a given task
   * @tsk: the task to be attached
   */
- int cgroup_attach_task_current_cg(struct task_struct *tsk)
+ int cgroup_attach_task_all(struct task_struct *from, struct task_struct *tsk)
  {
        struct cgroupfs_root *root;
        struct cgroup *cur_cg;
  
        cgroup_lock();
        for_each_active_root(root) {
-               cur_cg = task_cgroup_from_root(current, root);
+               cur_cg = task_cgroup_from_root(from, root);
                retval = cgroup_attach_task(cur_cg, tsk);
                if (retval)
                        break;
  
        return retval;
  }
- EXPORT_SYMBOL_GPL(cgroup_attach_task_current_cg);
+ EXPORT_SYMBOL_GPL(cgroup_attach_task_all);
  
  /*
   * Attach task with pid 'pid' to cgroup 'cgrp'. Call with cgroup_mutex
@@@ -3896,18 -3895,9 +3897,18 @@@ int __init cgroup_init(void
        hhead = css_set_hash(init_css_set.subsys);
        hlist_add_head(&init_css_set.hlist, hhead);
        BUG_ON(!init_root_id(&rootnode));
 +
 +      cgroup_kobj = kobject_create_and_add("cgroup", fs_kobj);
 +      if (!cgroup_kobj) {
 +              err = -ENOMEM;
 +              goto out;
 +      }
 +
        err = register_filesystem(&cgroup_fs_type);
 -      if (err < 0)
 +      if (err < 0) {
 +              kobject_put(cgroup_kobj);
                goto out;
 +      }
  
        proc_create("cgroups", 0, NULL, &proc_cgroupstats_operations);