From: David S. Miller Date: Fri, 10 Sep 2010 04:59:51 +0000 (-0700) Subject: Merge branch 'vhost-net' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost X-Git-Tag: v2.6.36-rc4~6^2 X-Git-Url: http://bbs.cooldavid.org/git/?a=commitdiff_plain;h=053d8f6622701f849fda2ca2c9ae596c13599ba9;hp=-c;p=net-next-2.6.git Merge branch 'vhost-net' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost --- 053d8f6622701f849fda2ca2c9ae596c13599ba9 diff --combined kernel/cgroup.c index 192f88c5b0f,9d90c08f3bd..ed19afd9e3f --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@@ -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)) { @@@ -1123,7 -1123,7 +1123,7 @@@ 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; @@@ -1791,10 -1789,11 +1791,11 @@@ out } /** - * 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; @@@ -1802,7 -1801,7 +1803,7 @@@ 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; @@@ -1811,7 -1810,7 +1812,7 @@@ 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);