lkml.org 
[lkml]   [2012]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/8] cgroup: deactivate CSS's and mark cgroup dead before invoking ->pre_destroy()
On Wed 31-10-12 12:44:06, Tejun Heo wrote:
[...]
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index f22e3cd..66204a6 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
[...]
> @@ -4122,13 +4079,30 @@ static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry)
> }
> prepare_to_wait(&cgroup_rmdir_waitq, &wait, TASK_INTERRUPTIBLE);
>
> - /* block new css_tryget() by deactivating refcnt */
> + /*
> + * Block new css_tryget() by deactivating refcnt and mark @cgrp
> + * removed. This makes future css_tryget() and child creation
> + * attempts fail thus maintaining the removal conditions verified
> + * above.
> + */
> for_each_subsys(cgrp->root, ss) {
> struct cgroup_subsys_state *css = cgrp->subsys[ss->subsys_id];
>
> WARN_ON(atomic_read(&css->refcnt) < 0);
> atomic_add(CSS_DEACT_BIAS, &css->refcnt);
> }
> + set_bit(CGRP_REMOVED, &cgrp->flags);
> +
> + /*
> + * Tell subsystems to initate destruction. pre_destroy() should be
> + * called with cgroup_mutex unlocked. See 3fa59dfbc3 ("cgroup: fix
> + * potential deadlock in pre_destroy") for details.
> + */
> + mutex_unlock(&cgroup_mutex);
> + for_each_subsys(cgrp->root, ss)
> + if (ss->pre_destroy)
> + WARN_ON_ONCE(ss->pre_destroy(cgrp));

Do you think that BUG_ON would be too harsh?

--
Michal Hocko
SUSE Labs


\
 
 \ /
  Last update: 2012-10-31 22:41    [W:0.255 / U:0.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site