diff options
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r-- | kernel/cgroup.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index ef909a329750..3a53c771e503 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -27,7 +27,6 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <linux/cgroup.h> | 29 | #include <linux/cgroup.h> |
30 | #include <linux/module.h> | ||
31 | #include <linux/ctype.h> | 30 | #include <linux/ctype.h> |
32 | #include <linux/errno.h> | 31 | #include <linux/errno.h> |
33 | #include <linux/fs.h> | 32 | #include <linux/fs.h> |
@@ -1647,7 +1646,9 @@ static inline struct cftype *__d_cft(struct dentry *dentry) | |||
1647 | int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen) | 1646 | int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen) |
1648 | { | 1647 | { |
1649 | char *start; | 1648 | char *start; |
1650 | struct dentry *dentry = rcu_dereference(cgrp->dentry); | 1649 | struct dentry *dentry = rcu_dereference_check(cgrp->dentry, |
1650 | rcu_read_lock_held() || | ||
1651 | cgroup_lock_is_held()); | ||
1651 | 1652 | ||
1652 | if (!dentry || cgrp == dummytop) { | 1653 | if (!dentry || cgrp == dummytop) { |
1653 | /* | 1654 | /* |
@@ -1663,13 +1664,17 @@ int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen) | |||
1663 | *--start = '\0'; | 1664 | *--start = '\0'; |
1664 | for (;;) { | 1665 | for (;;) { |
1665 | int len = dentry->d_name.len; | 1666 | int len = dentry->d_name.len; |
1667 | |||
1666 | if ((start -= len) < buf) | 1668 | if ((start -= len) < buf) |
1667 | return -ENAMETOOLONG; | 1669 | return -ENAMETOOLONG; |
1668 | memcpy(start, cgrp->dentry->d_name.name, len); | 1670 | memcpy(start, dentry->d_name.name, len); |
1669 | cgrp = cgrp->parent; | 1671 | cgrp = cgrp->parent; |
1670 | if (!cgrp) | 1672 | if (!cgrp) |
1671 | break; | 1673 | break; |
1672 | dentry = rcu_dereference(cgrp->dentry); | 1674 | |
1675 | dentry = rcu_dereference_check(cgrp->dentry, | ||
1676 | rcu_read_lock_held() || | ||
1677 | cgroup_lock_is_held()); | ||
1673 | if (!cgrp->parent) | 1678 | if (!cgrp->parent) |
1674 | continue; | 1679 | continue; |
1675 | if (--start < buf) | 1680 | if (--start < buf) |
@@ -4556,13 +4561,13 @@ static int alloc_css_id(struct cgroup_subsys *ss, struct cgroup *parent, | |||
4556 | { | 4561 | { |
4557 | int subsys_id, i, depth = 0; | 4562 | int subsys_id, i, depth = 0; |
4558 | struct cgroup_subsys_state *parent_css, *child_css; | 4563 | struct cgroup_subsys_state *parent_css, *child_css; |
4559 | struct css_id *child_id, *parent_id = NULL; | 4564 | struct css_id *child_id, *parent_id; |
4560 | 4565 | ||
4561 | subsys_id = ss->subsys_id; | 4566 | subsys_id = ss->subsys_id; |
4562 | parent_css = parent->subsys[subsys_id]; | 4567 | parent_css = parent->subsys[subsys_id]; |
4563 | child_css = child->subsys[subsys_id]; | 4568 | child_css = child->subsys[subsys_id]; |
4564 | depth = css_depth(parent_css) + 1; | ||
4565 | parent_id = parent_css->id; | 4569 | parent_id = parent_css->id; |
4570 | depth = parent_id->depth; | ||
4566 | 4571 | ||
4567 | child_id = get_new_cssid(ss, depth); | 4572 | child_id = get_new_cssid(ss, depth); |
4568 | if (IS_ERR(child_id)) | 4573 | if (IS_ERR(child_id)) |