diff options
Diffstat (limited to 'kernel/cgroup.c')
| -rw-r--r-- | kernel/cgroup.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 51cddc11cd85..b24d7027b83c 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
| @@ -763,9 +763,8 @@ EXPORT_SYMBOL_GPL(cgroup_unlock); | |||
| 763 | * -> cgroup_mkdir. | 763 | * -> cgroup_mkdir. |
| 764 | */ | 764 | */ |
| 765 | 765 | ||
| 766 | static struct dentry *cgroup_lookup(struct inode *dir, | ||
| 767 | struct dentry *dentry, struct nameidata *nd); | ||
| 768 | static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode); | 766 | static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode); |
| 767 | static struct dentry *cgroup_lookup(struct inode *, struct dentry *, struct nameidata *); | ||
| 769 | static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry); | 768 | static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry); |
| 770 | static int cgroup_populate_dir(struct cgroup *cgrp); | 769 | static int cgroup_populate_dir(struct cgroup *cgrp); |
| 771 | static const struct inode_operations cgroup_dir_inode_operations; | 770 | static const struct inode_operations cgroup_dir_inode_operations; |
| @@ -862,6 +861,11 @@ static void cgroup_diput(struct dentry *dentry, struct inode *inode) | |||
| 862 | iput(inode); | 861 | iput(inode); |
| 863 | } | 862 | } |
| 864 | 863 | ||
| 864 | static int cgroup_delete(const struct dentry *d) | ||
| 865 | { | ||
| 866 | return 1; | ||
| 867 | } | ||
| 868 | |||
| 865 | static void remove_dir(struct dentry *d) | 869 | static void remove_dir(struct dentry *d) |
| 866 | { | 870 | { |
| 867 | struct dentry *parent = dget(d->d_parent); | 871 | struct dentry *parent = dget(d->d_parent); |
| @@ -912,7 +916,7 @@ static void cgroup_d_remove_dir(struct dentry *dentry) | |||
| 912 | 916 | ||
| 913 | parent = dentry->d_parent; | 917 | parent = dentry->d_parent; |
| 914 | spin_lock(&parent->d_lock); | 918 | spin_lock(&parent->d_lock); |
| 915 | spin_lock(&dentry->d_lock); | 919 | spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); |
| 916 | list_del_init(&dentry->d_u.d_child); | 920 | list_del_init(&dentry->d_u.d_child); |
| 917 | spin_unlock(&dentry->d_lock); | 921 | spin_unlock(&dentry->d_lock); |
| 918 | spin_unlock(&parent->d_lock); | 922 | spin_unlock(&parent->d_lock); |
| @@ -1451,6 +1455,11 @@ static int cgroup_set_super(struct super_block *sb, void *data) | |||
| 1451 | 1455 | ||
| 1452 | static int cgroup_get_rootdir(struct super_block *sb) | 1456 | static int cgroup_get_rootdir(struct super_block *sb) |
| 1453 | { | 1457 | { |
| 1458 | static const struct dentry_operations cgroup_dops = { | ||
| 1459 | .d_iput = cgroup_diput, | ||
| 1460 | .d_delete = cgroup_delete, | ||
| 1461 | }; | ||
| 1462 | |||
| 1454 | struct inode *inode = | 1463 | struct inode *inode = |
| 1455 | cgroup_new_inode(S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR, sb); | 1464 | cgroup_new_inode(S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR, sb); |
| 1456 | struct dentry *dentry; | 1465 | struct dentry *dentry; |
| @@ -1468,6 +1477,8 @@ static int cgroup_get_rootdir(struct super_block *sb) | |||
| 1468 | return -ENOMEM; | 1477 | return -ENOMEM; |
| 1469 | } | 1478 | } |
| 1470 | sb->s_root = dentry; | 1479 | sb->s_root = dentry; |
| 1480 | /* for everything else we want ->d_op set */ | ||
| 1481 | sb->s_d_op = &cgroup_dops; | ||
| 1471 | return 0; | 1482 | return 0; |
| 1472 | } | 1483 | } |
| 1473 | 1484 | ||
| @@ -2197,6 +2208,14 @@ static const struct inode_operations cgroup_dir_inode_operations = { | |||
| 2197 | .rename = cgroup_rename, | 2208 | .rename = cgroup_rename, |
| 2198 | }; | 2209 | }; |
| 2199 | 2210 | ||
| 2211 | static struct dentry *cgroup_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | ||
| 2212 | { | ||
| 2213 | if (dentry->d_name.len > NAME_MAX) | ||
| 2214 | return ERR_PTR(-ENAMETOOLONG); | ||
| 2215 | d_add(dentry, NULL); | ||
| 2216 | return NULL; | ||
| 2217 | } | ||
| 2218 | |||
| 2200 | /* | 2219 | /* |
| 2201 | * Check if a file is a control file | 2220 | * Check if a file is a control file |
| 2202 | */ | 2221 | */ |
| @@ -2207,26 +2226,6 @@ static inline struct cftype *__file_cft(struct file *file) | |||
| 2207 | return __d_cft(file->f_dentry); | 2226 | return __d_cft(file->f_dentry); |
| 2208 | } | 2227 | } |
| 2209 | 2228 | ||
| 2210 | static int cgroup_delete_dentry(const struct dentry *dentry) | ||
| 2211 | { | ||
| 2212 | return 1; | ||
| 2213 | } | ||
| 2214 | |||
| 2215 | static struct dentry *cgroup_lookup(struct inode *dir, | ||
| 2216 | struct dentry *dentry, struct nameidata *nd) | ||
| 2217 | { | ||
| 2218 | static const struct dentry_operations cgroup_dentry_operations = { | ||
| 2219 | .d_delete = cgroup_delete_dentry, | ||
| 2220 | .d_iput = cgroup_diput, | ||
| 2221 | }; | ||
| 2222 | |||
| 2223 | if (dentry->d_name.len > NAME_MAX) | ||
| 2224 | return ERR_PTR(-ENAMETOOLONG); | ||
| 2225 | d_set_d_op(dentry, &cgroup_dentry_operations); | ||
| 2226 | d_add(dentry, NULL); | ||
| 2227 | return NULL; | ||
| 2228 | } | ||
| 2229 | |||
| 2230 | static int cgroup_create_file(struct dentry *dentry, mode_t mode, | 2229 | static int cgroup_create_file(struct dentry *dentry, mode_t mode, |
| 2231 | struct super_block *sb) | 2230 | struct super_block *sb) |
| 2232 | { | 2231 | { |
