Commit b9777cf8 authored by Tejun Heo's avatar Tejun Heo

cgroup: unexport locking interface and cgroup_attach_task()

Now that all external cgroup_lock() users are gone, we can finally
unexport the locking interface and prevent future abuse of
cgroup_mutex.

Make cgroup_[un]lock() and cgroup_lock_live_group() static.  Also,
cgroup_attach_task() doesn't have any user left and can't be used
without locking interface anyway.  Make it static too.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarLi Zefan <lizefan@huawei.com>
parent 7ae1bad9
...@@ -30,10 +30,7 @@ struct css_id; ...@@ -30,10 +30,7 @@ struct css_id;
extern int cgroup_init_early(void); extern int cgroup_init_early(void);
extern int cgroup_init(void); extern int cgroup_init(void);
extern void cgroup_lock(void);
extern int cgroup_lock_is_held(void); extern int cgroup_lock_is_held(void);
extern bool cgroup_lock_live_group(struct cgroup *cgrp);
extern void cgroup_unlock(void);
extern void cgroup_fork(struct task_struct *p); extern void cgroup_fork(struct task_struct *p);
extern void cgroup_post_fork(struct task_struct *p); extern void cgroup_post_fork(struct task_struct *p);
extern void cgroup_exit(struct task_struct *p, int run_callbacks); extern void cgroup_exit(struct task_struct *p, int run_callbacks);
...@@ -693,8 +690,6 @@ struct task_struct *cgroup_iter_next(struct cgroup *cgrp, ...@@ -693,8 +690,6 @@ struct task_struct *cgroup_iter_next(struct cgroup *cgrp,
struct cgroup_iter *it); struct cgroup_iter *it);
void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it); void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it);
int cgroup_scan_tasks(struct cgroup_scanner *scan); int cgroup_scan_tasks(struct cgroup_scanner *scan);
int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk,
bool threadgroup);
int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from); int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
......
...@@ -336,7 +336,7 @@ static inline struct cftype *__d_cft(struct dentry *dentry) ...@@ -336,7 +336,7 @@ static inline struct cftype *__d_cft(struct dentry *dentry)
* On success, returns true; the lock should be later released with * On success, returns true; the lock should be later released with
* cgroup_unlock(). On failure returns false with no lock held. * cgroup_unlock(). On failure returns false with no lock held.
*/ */
bool cgroup_lock_live_group(struct cgroup *cgrp) static bool cgroup_lock_live_group(struct cgroup *cgrp)
{ {
mutex_lock(&cgroup_mutex); mutex_lock(&cgroup_mutex);
if (cgroup_is_removed(cgrp)) { if (cgroup_is_removed(cgrp)) {
...@@ -345,7 +345,6 @@ bool cgroup_lock_live_group(struct cgroup *cgrp) ...@@ -345,7 +345,6 @@ bool cgroup_lock_live_group(struct cgroup *cgrp)
} }
return true; return true;
} }
EXPORT_SYMBOL_GPL(cgroup_lock_live_group);
/* the list of cgroups eligible for automatic release. Protected by /* the list of cgroups eligible for automatic release. Protected by
* release_list_lock */ * release_list_lock */
...@@ -824,22 +823,20 @@ static struct cgroup *task_cgroup_from_root(struct task_struct *task, ...@@ -824,22 +823,20 @@ static struct cgroup *task_cgroup_from_root(struct task_struct *task,
* cgroup_lock - lock out any changes to cgroup structures * cgroup_lock - lock out any changes to cgroup structures
* *
*/ */
void cgroup_lock(void) static void cgroup_lock(void)
{ {
mutex_lock(&cgroup_mutex); mutex_lock(&cgroup_mutex);
} }
EXPORT_SYMBOL_GPL(cgroup_lock);
/** /**
* cgroup_unlock - release lock on cgroup changes * cgroup_unlock - release lock on cgroup changes
* *
* Undo the lock taken in a previous cgroup_lock() call. * Undo the lock taken in a previous cgroup_lock() call.
*/ */
void cgroup_unlock(void) static void cgroup_unlock(void)
{ {
mutex_unlock(&cgroup_mutex); mutex_unlock(&cgroup_mutex);
} }
EXPORT_SYMBOL_GPL(cgroup_unlock);
/* /*
* A couple of forward declarations required, due to cyclic reference loop: * A couple of forward declarations required, due to cyclic reference loop:
......
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