Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83790
b: refs/heads/master
c: 4fca88c
h: refs/heads/master
v: v3
  • Loading branch information
KAMEZAWA Hiroyuki authored and Linus Torvalds committed Feb 7, 2008
1 parent ac50f14 commit 5b1d4f8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d2ceb9b7ddedbb2e8e590bc6ce33c854043016f9
refs/heads/master: 4fca88c87b7969c698912e2de9b1b31088c777cb
1 change: 1 addition & 0 deletions trunk/include/linux/cgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ int cgroup_is_descendant(const struct cgroup *cont);
struct cgroup_subsys {
struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss,
struct cgroup *cont);
void (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cont);
void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cont);
int (*can_attach)(struct cgroup_subsys *ss,
struct cgroup *cont, struct task_struct *tsk);
Expand Down
22 changes: 22 additions & 0 deletions trunk/kernel/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,21 @@ static struct inode *cgroup_new_inode(mode_t mode, struct super_block *sb)
return inode;
}

/*
* Call subsys's pre_destroy handler.
* This is called before css refcnt check.
*/

static void cgroup_call_pre_destroy(struct cgroup *cgrp)
{
struct cgroup_subsys *ss;
for_each_subsys(cgrp->root, ss)
if (ss->pre_destroy && cgrp->subsys[ss->subsys_id])
ss->pre_destroy(ss, cgrp);
return;
}


static void cgroup_diput(struct dentry *dentry, struct inode *inode)
{
/* is dentry a directory ? if so, kfree() associated cgroup */
Expand Down Expand Up @@ -2160,6 +2175,13 @@ static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry)
parent = cgrp->parent;
root = cgrp->root;
sb = root->sb;
/*
* Call pre_destroy handlers of subsys
*/
cgroup_call_pre_destroy(cgrp);
/*
* Notify subsyses that rmdir() request comes.
*/

if (cgroup_has_css_refs(cgrp)) {
mutex_unlock(&cgroup_mutex);
Expand Down

0 comments on commit 5b1d4f8

Please sign in to comment.