aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/cpuset.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 7491352276b2..6633f3fb6417 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1113,6 +1113,21 @@ static int cpuset_file_release(struct inode *inode, struct file *file)
1113 return 0; 1113 return 0;
1114} 1114}
1115 1115
1116/*
1117 * cpuset_rename - Only allow simple rename of directories in place.
1118 */
1119static int cpuset_rename(struct inode *old_dir, struct dentry *old_dentry,
1120 struct inode *new_dir, struct dentry *new_dentry)
1121{
1122 if (!S_ISDIR(old_dentry->d_inode->i_mode))
1123 return -ENOTDIR;
1124 if (new_dentry->d_inode)
1125 return -EEXIST;
1126 if (old_dir != new_dir)
1127 return -EIO;
1128 return simple_rename(old_dir, old_dentry, new_dir, new_dentry);
1129}
1130
1116static struct file_operations cpuset_file_operations = { 1131static struct file_operations cpuset_file_operations = {
1117 .read = cpuset_file_read, 1132 .read = cpuset_file_read,
1118 .write = cpuset_file_write, 1133 .write = cpuset_file_write,
@@ -1125,6 +1140,7 @@ static struct inode_operations cpuset_dir_inode_operations = {
1125 .lookup = simple_lookup, 1140 .lookup = simple_lookup,
1126 .mkdir = cpuset_mkdir, 1141 .mkdir = cpuset_mkdir,
1127 .rmdir = cpuset_rmdir, 1142 .rmdir = cpuset_rmdir,
1143 .rename = cpuset_rename,
1128}; 1144};
1129 1145
1130static int cpuset_create_file(struct dentry *dentry, int mode) 1146static int cpuset_create_file(struct dentry *dentry, int mode)