diff options
author | Tejun Heo <tj@kernel.org> | 2013-05-24 10:53:09 +0900 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-05-24 10:53:09 +0900 |
commit | 3f33e64f4a212771a0b5c63eddaa7f81e65223e3 (patch) | |
tree | a212de935bb984849a5bf3bed3618dc9975203db | |
parent | 23958e729e7029678e746bf8f4094c8863a79c3d (diff) | |
parent | 7805d000db30a3787a4c969bab6ae4d8a5fd8ce6 (diff) | |
download | linux-3f33e64f4a212771a0b5c63eddaa7f81e65223e3.tar.gz linux-3f33e64f4a212771a0b5c63eddaa7f81e65223e3.tar.bz2 linux-3f33e64f4a212771a0b5c63eddaa7f81e65223e3.zip |
Merge branch 'for-3.10-fixes' into for-3.11
Merging to receive 7805d000db ("cgroup: fix a subtle bug in descendant
pre-order walk") so that further iterator updates can build upon it.
Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r-- | include/linux/cgroup.h | 2 | ||||
-rw-r--r-- | kernel/cgroup.c | 18 |
2 files changed, 9 insertions, 11 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 4f6f5138c340..1df5f699be61 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -709,7 +709,7 @@ struct cgroup *cgroup_rightmost_descendant(struct cgroup *pos); * * If a subsystem synchronizes against the parent in its ->css_online() and * before starting iterating, and synchronizes against @pos on each - * iteration, any descendant cgroup which finished ->css_offline() is + * iteration, any descendant cgroup which finished ->css_online() is * guaranteed to be visible in the future iterations. * * In other words, the following guarantees that a descendant can't escape diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 6b2b1d945df2..a19419f4af1a 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -2736,13 +2736,14 @@ static int cgroup_add_file(struct cgroup *cgrp, struct cgroup_subsys *subsys, goto out; } + cfe->type = (void *)cft; + cfe->dentry = dentry; + dentry->d_fsdata = cfe; + simple_xattrs_init(&cfe->xattrs); + mode = cgroup_file_mode(cft); error = cgroup_create_file(dentry, mode | S_IFREG, cgrp->root->sb); if (!error) { - cfe->type = (void *)cft; - cfe->dentry = dentry; - dentry->d_fsdata = cfe; - simple_xattrs_init(&cfe->xattrs); list_add_tail(&cfe->node, &parent->files); cfe = NULL; } @@ -2990,11 +2991,8 @@ struct cgroup *cgroup_next_descendant_pre(struct cgroup *pos, WARN_ON_ONCE(!rcu_read_lock_held()); /* if first iteration, pretend we just visited @cgroup */ - if (!pos) { - if (list_empty(&cgroup->children)) - return NULL; + if (!pos) pos = cgroup; - } /* visit the first child if exists */ next = list_first_or_null_rcu(&pos->children, struct cgroup, sibling); @@ -3002,14 +3000,14 @@ struct cgroup *cgroup_next_descendant_pre(struct cgroup *pos, return next; /* no child, visit my or the closest ancestor's next sibling */ - do { + while (pos != cgroup) { next = list_entry_rcu(pos->sibling.next, struct cgroup, sibling); if (&next->sibling != &pos->parent->children) return next; pos = pos->parent; - } while (pos != cgroup); + } return NULL; } |