lkml.org 
[lkml]   [2008]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/3] cgroup: fix pre_destroy and semantics of css->refcnt
> +/*
> + * Try to set all subsys's refcnt to be 0.
> + * css->refcnt==0 means this subsys will be destroy()'d.
> + */
> +static bool cgroup_set_subsys_removed(struct cgroup *cgrp)
> +{
> + struct cgroup_subsys *ss;
> + struct cgroup_subsys_state *css, *tmp;
> +
> + for_each_subsys(cgrp->root, ss) {
> + css = cgrp->subsys[ss->subsys_id];
> + if (!atomic_dec_and_test(&css->refcnt))
> + goto rollback;
> + }
> + return true;
> +rollback:
> + for_each_subsys(cgrp->root, ss) {
> + tmp = cgrp->subsys[ss->subsys_id];
> + atomic_inc(&tmp->refcnt);
> + if (tmp == css)
> + break;
> + }
> + return false;
> +}
> +

This function may return false, then causes rmdir() fail. So css_tryget(subsys1)
returns 0 doesn't necessarily mean subsys1->destroy() will be called,
if subsys2's css's refcnt is >1 when cgroup_set_subsys_removed() is called.

Will this bring up bugs and problems?



\
 
 \ /
  Last update: 2008-12-03 04:47    [W:0.178 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site