Commit 2c4736d9 authored by Tejun Heo's avatar Tejun Heo

Merge branch 'for-4.15-fixes' into for-4.16

parents c4e0842b 4f58424d
...@@ -123,7 +123,11 @@ int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from) ...@@ -123,7 +123,11 @@ int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from)
*/ */
do { do {
css_task_iter_start(&from->self, 0, &it); css_task_iter_start(&from->self, 0, &it);
task = css_task_iter_next(&it);
do {
task = css_task_iter_next(&it);
} while (task && (task->flags & PF_EXITING));
if (task) if (task)
get_task_struct(task); get_task_struct(task);
css_task_iter_end(&it); css_task_iter_end(&it);
......
...@@ -1397,7 +1397,7 @@ static char *cgroup_file_name(struct cgroup *cgrp, const struct cftype *cft, ...@@ -1397,7 +1397,7 @@ static char *cgroup_file_name(struct cgroup *cgrp, const struct cftype *cft,
cgroup_on_dfl(cgrp) ? ss->name : ss->legacy_name, cgroup_on_dfl(cgrp) ? ss->name : ss->legacy_name,
cft->name); cft->name);
else else
strncpy(buf, cft->name, CGROUP_FILE_NAME_MAX); strlcpy(buf, cft->name, CGROUP_FILE_NAME_MAX);
return buf; return buf;
} }
...@@ -1864,9 +1864,9 @@ void init_cgroup_root(struct cgroup_root *root, struct cgroup_sb_opts *opts) ...@@ -1864,9 +1864,9 @@ void init_cgroup_root(struct cgroup_root *root, struct cgroup_sb_opts *opts)
root->flags = opts->flags; root->flags = opts->flags;
if (opts->release_agent) if (opts->release_agent)
strcpy(root->release_agent_path, opts->release_agent); strlcpy(root->release_agent_path, opts->release_agent, PATH_MAX);
if (opts->name) if (opts->name)
strcpy(root->name, opts->name); strlcpy(root->name, opts->name, MAX_CGROUP_ROOT_NAMELEN);
if (opts->cpuset_clone_children) if (opts->cpuset_clone_children)
set_bit(CGRP_CPUSET_CLONE_CHILDREN, &root->cgrp.flags); set_bit(CGRP_CPUSET_CLONE_CHILDREN, &root->cgrp.flags);
} }
...@@ -4125,26 +4125,24 @@ static void css_task_iter_advance_css_set(struct css_task_iter *it) ...@@ -4125,26 +4125,24 @@ static void css_task_iter_advance_css_set(struct css_task_iter *it)
static void css_task_iter_advance(struct css_task_iter *it) static void css_task_iter_advance(struct css_task_iter *it)
{ {
struct list_head *l = it->task_pos; struct list_head *next;
lockdep_assert_held(&css_set_lock); lockdep_assert_held(&css_set_lock);
WARN_ON_ONCE(!l);
repeat: repeat:
/* /*
* Advance iterator to find next entry. cset->tasks is consumed * Advance iterator to find next entry. cset->tasks is consumed
* first and then ->mg_tasks. After ->mg_tasks, we move onto the * first and then ->mg_tasks. After ->mg_tasks, we move onto the
* next cset. * next cset.
*/ */
l = l->next; next = it->task_pos->next;
if (l == it->tasks_head) if (next == it->tasks_head)
l = it->mg_tasks_head->next; next = it->mg_tasks_head->next;
if (l == it->mg_tasks_head) if (next == it->mg_tasks_head)
css_task_iter_advance_css_set(it); css_task_iter_advance_css_set(it);
else else
it->task_pos = l; it->task_pos = next;
/* if PROCS, skip over tasks which aren't group leaders */ /* if PROCS, skip over tasks which aren't group leaders */
if ((it->flags & CSS_TASK_ITER_PROCS) && it->task_pos && if ((it->flags & CSS_TASK_ITER_PROCS) && it->task_pos &&
...@@ -4449,6 +4447,7 @@ static struct cftype cgroup_base_files[] = { ...@@ -4449,6 +4447,7 @@ static struct cftype cgroup_base_files[] = {
}, },
{ {
.name = "cgroup.threads", .name = "cgroup.threads",
.flags = CFTYPE_NS_DELEGATABLE,
.release = cgroup_procs_release, .release = cgroup_procs_release,
.seq_start = cgroup_threads_start, .seq_start = cgroup_threads_start,
.seq_next = cgroup_procs_next, .seq_next = cgroup_procs_next,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment