diff options
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r-- | kernel/cgroup.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index f221446aa02d..220e0fd659fa 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -586,7 +586,7 @@ static void cgroup_call_pre_destroy(struct cgroup *cgrp) | |||
586 | { | 586 | { |
587 | struct cgroup_subsys *ss; | 587 | struct cgroup_subsys *ss; |
588 | for_each_subsys(cgrp->root, ss) | 588 | for_each_subsys(cgrp->root, ss) |
589 | if (ss->pre_destroy && cgrp->subsys[ss->subsys_id]) | 589 | if (ss->pre_destroy) |
590 | ss->pre_destroy(ss, cgrp); | 590 | ss->pre_destroy(ss, cgrp); |
591 | return; | 591 | return; |
592 | } | 592 | } |
@@ -610,10 +610,8 @@ static void cgroup_diput(struct dentry *dentry, struct inode *inode) | |||
610 | /* | 610 | /* |
611 | * Release the subsystem state objects. | 611 | * Release the subsystem state objects. |
612 | */ | 612 | */ |
613 | for_each_subsys(cgrp->root, ss) { | 613 | for_each_subsys(cgrp->root, ss) |
614 | if (cgrp->subsys[ss->subsys_id]) | 614 | ss->destroy(ss, cgrp); |
615 | ss->destroy(ss, cgrp); | ||
616 | } | ||
617 | 615 | ||
618 | cgrp->root->number_of_cgroups--; | 616 | cgrp->root->number_of_cgroups--; |
619 | mutex_unlock(&cgroup_mutex); | 617 | mutex_unlock(&cgroup_mutex); |
@@ -1445,7 +1443,7 @@ static ssize_t cgroup_file_write(struct file *file, const char __user *buf, | |||
1445 | struct cftype *cft = __d_cft(file->f_dentry); | 1443 | struct cftype *cft = __d_cft(file->f_dentry); |
1446 | struct cgroup *cgrp = __d_cgrp(file->f_dentry->d_parent); | 1444 | struct cgroup *cgrp = __d_cgrp(file->f_dentry->d_parent); |
1447 | 1445 | ||
1448 | if (!cft || cgroup_is_removed(cgrp)) | 1446 | if (cgroup_is_removed(cgrp)) |
1449 | return -ENODEV; | 1447 | return -ENODEV; |
1450 | if (cft->write) | 1448 | if (cft->write) |
1451 | return cft->write(cgrp, cft, file, buf, nbytes, ppos); | 1449 | return cft->write(cgrp, cft, file, buf, nbytes, ppos); |
@@ -1490,7 +1488,7 @@ static ssize_t cgroup_file_read(struct file *file, char __user *buf, | |||
1490 | struct cftype *cft = __d_cft(file->f_dentry); | 1488 | struct cftype *cft = __d_cft(file->f_dentry); |
1491 | struct cgroup *cgrp = __d_cgrp(file->f_dentry->d_parent); | 1489 | struct cgroup *cgrp = __d_cgrp(file->f_dentry->d_parent); |
1492 | 1490 | ||
1493 | if (!cft || cgroup_is_removed(cgrp)) | 1491 | if (cgroup_is_removed(cgrp)) |
1494 | return -ENODEV; | 1492 | return -ENODEV; |
1495 | 1493 | ||
1496 | if (cft->read) | 1494 | if (cft->read) |
@@ -1554,10 +1552,8 @@ static int cgroup_file_open(struct inode *inode, struct file *file) | |||
1554 | err = generic_file_open(inode, file); | 1552 | err = generic_file_open(inode, file); |
1555 | if (err) | 1553 | if (err) |
1556 | return err; | 1554 | return err; |
1557 | |||
1558 | cft = __d_cft(file->f_dentry); | 1555 | cft = __d_cft(file->f_dentry); |
1559 | if (!cft) | 1556 | |
1560 | return -ENODEV; | ||
1561 | if (cft->read_map || cft->read_seq_string) { | 1557 | if (cft->read_map || cft->read_seq_string) { |
1562 | struct cgroup_seqfile_state *state = | 1558 | struct cgroup_seqfile_state *state = |
1563 | kzalloc(sizeof(*state), GFP_USER); | 1559 | kzalloc(sizeof(*state), GFP_USER); |
@@ -2463,8 +2459,6 @@ static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry) | |||
2463 | struct cgroup *cgrp = dentry->d_fsdata; | 2459 | struct cgroup *cgrp = dentry->d_fsdata; |
2464 | struct dentry *d; | 2460 | struct dentry *d; |
2465 | struct cgroup *parent; | 2461 | struct cgroup *parent; |
2466 | struct super_block *sb; | ||
2467 | struct cgroupfs_root *root; | ||
2468 | 2462 | ||
2469 | /* the vfs holds both inode->i_mutex already */ | 2463 | /* the vfs holds both inode->i_mutex already */ |
2470 | 2464 | ||
@@ -2487,8 +2481,6 @@ static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry) | |||
2487 | 2481 | ||
2488 | mutex_lock(&cgroup_mutex); | 2482 | mutex_lock(&cgroup_mutex); |
2489 | parent = cgrp->parent; | 2483 | parent = cgrp->parent; |
2490 | root = cgrp->root; | ||
2491 | sb = root->sb; | ||
2492 | 2484 | ||
2493 | if (atomic_read(&cgrp->count) | 2485 | if (atomic_read(&cgrp->count) |
2494 | || !list_empty(&cgrp->children) | 2486 | || !list_empty(&cgrp->children) |
@@ -2937,7 +2929,7 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys, | |||
2937 | } | 2929 | } |
2938 | 2930 | ||
2939 | /* Create the cgroup directory, which also creates the cgroup */ | 2931 | /* Create the cgroup directory, which also creates the cgroup */ |
2940 | ret = vfs_mkdir(inode, dentry, S_IFDIR | 0755); | 2932 | ret = vfs_mkdir(inode, dentry, 0755); |
2941 | child = __d_cgrp(dentry); | 2933 | child = __d_cgrp(dentry); |
2942 | dput(dentry); | 2934 | dput(dentry); |
2943 | if (ret) { | 2935 | if (ret) { |
@@ -2947,13 +2939,6 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys, | |||
2947 | goto out_release; | 2939 | goto out_release; |
2948 | } | 2940 | } |
2949 | 2941 | ||
2950 | if (!child) { | ||
2951 | printk(KERN_INFO | ||
2952 | "Couldn't find new cgroup %s\n", nodename); | ||
2953 | ret = -ENOMEM; | ||
2954 | goto out_release; | ||
2955 | } | ||
2956 | |||
2957 | /* The cgroup now exists. Retake cgroup_mutex and check | 2942 | /* The cgroup now exists. Retake cgroup_mutex and check |
2958 | * that we're still in the same state that we thought we | 2943 | * that we're still in the same state that we thought we |
2959 | * were. */ | 2944 | * were. */ |