aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cgroup.c
diff options
context:
space:
mode:
authorAl Viro <viro@ZenIV.linux.org.uk>2011-01-14 00:31:45 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-14 11:07:48 -0500
commitc72a04e34735ec3f19f4788b7f95017310b5e1eb (patch)
tree9a6958a8f291c4bd4ac80548565d3a41f8bec84a /kernel/cgroup.c
parent323b7fe8f8f6d5ac6214382cf30e8b3a80b265c9 (diff)
cgroup_fs: fix cgroup use of simple_lookup()
cgroup can't use simple_lookup(), since that'd override its desired ->d_op. Tested-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r--kernel/cgroup.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 5c5f4cc2e99a..ffb7bbad0638 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -764,6 +764,7 @@ EXPORT_SYMBOL_GPL(cgroup_unlock);
764 */ 764 */
765 765
766static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode); 766static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode);
767static struct dentry *cgroup_lookup(struct inode *, struct dentry *, struct nameidata *);
767static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry); 768static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry);
768static int cgroup_populate_dir(struct cgroup *cgrp); 769static int cgroup_populate_dir(struct cgroup *cgrp);
769static const struct inode_operations cgroup_dir_inode_operations; 770static const struct inode_operations cgroup_dir_inode_operations;
@@ -860,6 +861,11 @@ static void cgroup_diput(struct dentry *dentry, struct inode *inode)
860 iput(inode); 861 iput(inode);
861} 862}
862 863
864static int cgroup_delete(const struct dentry *d)
865{
866 return 1;
867}
868
863static void remove_dir(struct dentry *d) 869static void remove_dir(struct dentry *d)
864{ 870{
865 struct dentry *parent = dget(d->d_parent); 871 struct dentry *parent = dget(d->d_parent);
@@ -1451,6 +1457,7 @@ static int cgroup_get_rootdir(struct super_block *sb)
1451{ 1457{
1452 static const struct dentry_operations cgroup_dops = { 1458 static const struct dentry_operations cgroup_dops = {
1453 .d_iput = cgroup_diput, 1459 .d_iput = cgroup_diput,
1460 .d_delete = cgroup_delete,
1454 }; 1461 };
1455 1462
1456 struct inode *inode = 1463 struct inode *inode =
@@ -2195,12 +2202,20 @@ static const struct file_operations cgroup_file_operations = {
2195}; 2202};
2196 2203
2197static const struct inode_operations cgroup_dir_inode_operations = { 2204static const struct inode_operations cgroup_dir_inode_operations = {
2198 .lookup = simple_lookup, 2205 .lookup = cgroup_lookup,
2199 .mkdir = cgroup_mkdir, 2206 .mkdir = cgroup_mkdir,
2200 .rmdir = cgroup_rmdir, 2207 .rmdir = cgroup_rmdir,
2201 .rename = cgroup_rename, 2208 .rename = cgroup_rename,
2202}; 2209};
2203 2210
2211static 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
2204/* 2219/*
2205 * Check if a file is a control file 2220 * Check if a file is a control file
2206 */ 2221 */