diff options
author | Hans de Goede <hdegoede@redhat.com> | 2013-01-11 13:19:27 +0100 |
---|---|---|
committer | Ziyan <jaraidaniel@gmail.com> | 2016-03-11 15:56:53 +0100 |
commit | e049dcbb3e8ba8aeb42e3ae5787c471732dfd029 (patch) | |
tree | cf9b18ddbf9b6c29c15d2ddb8b487321401d2746 /kernel | |
parent | 64c760879d1bfd265c68fe6c9e13a2cf96131837 (diff) | |
download | kernel_samsung_espresso10-e049dcbb3e8ba8aeb42e3ae5787c471732dfd029.zip kernel_samsung_espresso10-e049dcbb3e8ba8aeb42e3ae5787c471732dfd029.tar.gz kernel_samsung_espresso10-e049dcbb3e8ba8aeb42e3ae5787c471732dfd029.tar.bz2 |
cgroup: Take css_set_lock from cgroup_css_sets_empty()
As indicated in the comment above cgroup_css_sets_empty it needs the
css_set_lock. But neither of the 2 call points have it, so rather then fixing
the callers just take the lock inside cgroup_css_sets_empty().
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Change-Id: If7aea71824f6d0e3f2cc6c1ce236c3ae6be2037b
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/cgroup.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 648d8a8..ca8bfff 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -3980,19 +3980,23 @@ static int cgroup_clear_css_refs(struct cgroup *cgrp) return !failed; } -/* checks if all of the css_sets attached to a cgroup have a refcount of 0. - * Must be called with css_set_lock held */ +/* Checks if all of the css_sets attached to a cgroup have a refcount of 0. */ static int cgroup_css_sets_empty(struct cgroup *cgrp) { struct cg_cgroup_link *link; + int retval = 1; + read_lock(&css_set_lock); list_for_each_entry(link, &cgrp->css_sets, cgrp_link_list) { struct css_set *cg = link->cg; - if (atomic_read(&cg->refcount) > 0) - return 0; + if (atomic_read(&cg->refcount) > 0) { + retval = 0; + break; + } } + read_unlock(&css_set_lock); - return 1; + return retval; } static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry) |