Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 339333
b: refs/heads/master
c: 28fd6f3
h: refs/heads/master
i:
  339331: c0b1890
v: v3
  • Loading branch information
Tejun Heo committed Nov 19, 2012
1 parent ee3de69 commit ecfe69f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 26 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: 2243076ad128d0cc196cf6597e6ddcf6bc907676
refs/heads/master: 28fd6f30ac3efd9170ae1ac89f3521d53b5eb83a
30 changes: 5 additions & 25 deletions trunk/kernel/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -2652,6 +2652,7 @@ static int cgroup_create_file(struct dentry *dentry, umode_t mode,

/* start off with i_nlink == 2 (for "." entry) */
inc_nlink(inode);
inc_nlink(dentry->d_parent->d_inode);

/* start with the directory inode held, so that we can
* populate it without racing with another mkdir */
Expand All @@ -2666,30 +2667,6 @@ static int cgroup_create_file(struct dentry *dentry, umode_t mode,
return 0;
}

/*
* cgroup_create_dir - create a directory for an object.
* @cgrp: the cgroup we create the directory for. It must have a valid
* ->parent field. And we are going to fill its ->dentry field.
* @dentry: dentry of the new cgroup
* @mode: mode to set on new directory.
*/
static int cgroup_create_dir(struct cgroup *cgrp, struct dentry *dentry,
umode_t mode)
{
struct dentry *parent;
int error = 0;

parent = cgrp->parent->dentry;
error = cgroup_create_file(dentry, S_IFDIR | mode, cgrp->root->sb);
if (!error) {
dentry->d_fsdata = cgrp;
inc_nlink(parent->d_inode);
rcu_assign_pointer(cgrp->dentry, dentry);
}

return error;
}

/**
* cgroup_file_mode - deduce file mode of a control file
* @cft: the control file in question
Expand Down Expand Up @@ -4138,10 +4115,13 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
list_add_tail_rcu(&cgrp->sibling, &cgrp->parent->children);
root->number_of_cgroups++;

err = cgroup_create_dir(cgrp, dentry, mode);
err = cgroup_create_file(dentry, S_IFDIR | mode, sb);
if (err < 0)
goto err_remove;

dentry->d_fsdata = cgrp;
rcu_assign_pointer(cgrp->dentry, dentry);

for_each_subsys(root, ss) {
/* each css holds a ref to the cgroup's dentry */
dget(dentry);
Expand Down

0 comments on commit ecfe69f

Please sign in to comment.