Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 339344
b: refs/heads/master
c: 4b8b47e
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo committed Nov 19, 2012
1 parent 1e25a39 commit a6ab55e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b8a2df6a5b576d04f78f54abf254c283527d8bbc
refs/heads/master: 4b8b47eb0001a89f271d671d959b235faa8f03e2
21 changes: 14 additions & 7 deletions trunk/kernel/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -4107,7 +4107,7 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
*/
if (!cgroup_lock_live_group(parent)) {
err = -ENODEV;
goto err_free;
goto err_free_cgrp;
}

/* Grab a reference on the superblock so the hierarchy doesn't
Expand Down Expand Up @@ -4135,13 +4135,13 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
css = ss->create(cgrp);
if (IS_ERR(css)) {
err = PTR_ERR(css);
goto err_destroy;
goto err_free_all;
}
init_cgroup_css(css, ss, cgrp);
if (ss->use_id) {
err = alloc_css_id(ss, parent, cgrp);
if (err)
goto err_destroy;
goto err_free_all;
}
/* At error, ->destroy() callback has to free assigned ID. */
if (clone_children(parent) && ss->post_clone)
Expand All @@ -4164,7 +4164,7 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
*/
err = cgroup_create_file(dentry, S_IFDIR | mode, sb);
if (err < 0)
goto err_destroy;
goto err_free_all;
lockdep_assert_held(&dentry->d_inode->i_mutex);

/* allocation complete, commit to creation */
Expand All @@ -4183,24 +4183,31 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
}

err = cgroup_populate_dir(cgrp, true, root->subsys_mask);
/* If err < 0, we have a half-filled directory - oh well ;) */
if (err)
goto err_destroy;

mutex_unlock(&cgroup_mutex);
mutex_unlock(&cgrp->dentry->d_inode->i_mutex);

return 0;

err_destroy:
err_free_all:
for_each_subsys(root, ss) {
if (cgrp->subsys[ss->subsys_id])
ss->destroy(cgrp);
}
mutex_unlock(&cgroup_mutex);
/* Release the reference count that we took on the superblock */
deactivate_super(sb);
err_free:
err_free_cgrp:
kfree(cgrp);
return err;

err_destroy:
cgroup_destroy_locked(cgrp);
mutex_unlock(&cgroup_mutex);
mutex_unlock(&dentry->d_inode->i_mutex);
return err;
}

static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
Expand Down

0 comments on commit a6ab55e

Please sign in to comment.