diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 1d51968890480bdbca29d576769a6565ba7544a2..e717a39f22eabc8795f5e7ed397fb4a45430ff36 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -612,6 +612,7 @@ struct cgroup_subsys { struct cgroup_subsys_state *(*css_alloc)(struct cgroup_subsys_state *parent_css); int (*css_online)(struct cgroup_subsys_state *css); void (*css_offline)(struct cgroup_subsys_state *css); + void (*css_released)(struct cgroup_subsys_state *css); void (*css_free)(struct cgroup_subsys_state *css); void (*css_reset)(struct cgroup_subsys_state *css); diff --git a/kernel/cgroup.c b/kernel/cgroup.c index dffa54041d4a3544b0b6112de1a6363bbcd54935..c8558693102b906f6dedf6579b9212dafcd855b2 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -4380,6 +4380,8 @@ static void css_release_work_fn(struct work_struct *work) if (ss) { /* css release path */ cgroup_idr_remove(&ss->css_idr, css->id); + if (ss->css_released) + ss->css_released(css); } else { /* cgroup release path */ cgroup_idr_remove(&cgrp->root->cgroup_idr, cgrp->id);