diff options
Diffstat (limited to 'fs/ocfs2/ioctl.c')
-rw-r--r-- | fs/ocfs2/ioctl.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c index 87dcece7e1b5..5177fba5162b 100644 --- a/fs/ocfs2/ioctl.c +++ b/fs/ocfs2/ioctl.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include "ocfs2_fs.h" | 21 | #include "ocfs2_fs.h" |
22 | #include "ioctl.h" | 22 | #include "ioctl.h" |
23 | #include "resize.h" | ||
23 | 24 | ||
24 | #include <linux/ext2_fs.h> | 25 | #include <linux/ext2_fs.h> |
25 | 26 | ||
@@ -27,14 +28,14 @@ static int ocfs2_get_inode_attr(struct inode *inode, unsigned *flags) | |||
27 | { | 28 | { |
28 | int status; | 29 | int status; |
29 | 30 | ||
30 | status = ocfs2_meta_lock(inode, NULL, 0); | 31 | status = ocfs2_inode_lock(inode, NULL, 0); |
31 | if (status < 0) { | 32 | if (status < 0) { |
32 | mlog_errno(status); | 33 | mlog_errno(status); |
33 | return status; | 34 | return status; |
34 | } | 35 | } |
35 | ocfs2_get_inode_flags(OCFS2_I(inode)); | 36 | ocfs2_get_inode_flags(OCFS2_I(inode)); |
36 | *flags = OCFS2_I(inode)->ip_attr; | 37 | *flags = OCFS2_I(inode)->ip_attr; |
37 | ocfs2_meta_unlock(inode, 0); | 38 | ocfs2_inode_unlock(inode, 0); |
38 | 39 | ||
39 | mlog_exit(status); | 40 | mlog_exit(status); |
40 | return status; | 41 | return status; |
@@ -52,7 +53,7 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags, | |||
52 | 53 | ||
53 | mutex_lock(&inode->i_mutex); | 54 | mutex_lock(&inode->i_mutex); |
54 | 55 | ||
55 | status = ocfs2_meta_lock(inode, &bh, 1); | 56 | status = ocfs2_inode_lock(inode, &bh, 1); |
56 | if (status < 0) { | 57 | if (status < 0) { |
57 | mlog_errno(status); | 58 | mlog_errno(status); |
58 | goto bail; | 59 | goto bail; |
@@ -100,7 +101,7 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags, | |||
100 | 101 | ||
101 | ocfs2_commit_trans(osb, handle); | 102 | ocfs2_commit_trans(osb, handle); |
102 | bail_unlock: | 103 | bail_unlock: |
103 | ocfs2_meta_unlock(inode, 1); | 104 | ocfs2_inode_unlock(inode, 1); |
104 | bail: | 105 | bail: |
105 | mutex_unlock(&inode->i_mutex); | 106 | mutex_unlock(&inode->i_mutex); |
106 | 107 | ||
@@ -115,8 +116,10 @@ int ocfs2_ioctl(struct inode * inode, struct file * filp, | |||
115 | unsigned int cmd, unsigned long arg) | 116 | unsigned int cmd, unsigned long arg) |
116 | { | 117 | { |
117 | unsigned int flags; | 118 | unsigned int flags; |
119 | int new_clusters; | ||
118 | int status; | 120 | int status; |
119 | struct ocfs2_space_resv sr; | 121 | struct ocfs2_space_resv sr; |
122 | struct ocfs2_new_group_input input; | ||
120 | 123 | ||
121 | switch (cmd) { | 124 | switch (cmd) { |
122 | case OCFS2_IOC_GETFLAGS: | 125 | case OCFS2_IOC_GETFLAGS: |
@@ -140,6 +143,23 @@ int ocfs2_ioctl(struct inode * inode, struct file * filp, | |||
140 | return -EFAULT; | 143 | return -EFAULT; |
141 | 144 | ||
142 | return ocfs2_change_file_space(filp, cmd, &sr); | 145 | return ocfs2_change_file_space(filp, cmd, &sr); |
146 | case OCFS2_IOC_GROUP_EXTEND: | ||
147 | if (!capable(CAP_SYS_RESOURCE)) | ||
148 | return -EPERM; | ||
149 | |||
150 | if (get_user(new_clusters, (int __user *)arg)) | ||
151 | return -EFAULT; | ||
152 | |||
153 | return ocfs2_group_extend(inode, new_clusters); | ||
154 | case OCFS2_IOC_GROUP_ADD: | ||
155 | case OCFS2_IOC_GROUP_ADD64: | ||
156 | if (!capable(CAP_SYS_RESOURCE)) | ||
157 | return -EPERM; | ||
158 | |||
159 | if (copy_from_user(&input, (int __user *) arg, sizeof(input))) | ||
160 | return -EFAULT; | ||
161 | |||
162 | return ocfs2_group_add(inode, &input); | ||
143 | default: | 163 | default: |
144 | return -ENOTTY; | 164 | return -ENOTTY; |
145 | } | 165 | } |
@@ -162,6 +182,9 @@ long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
162 | case OCFS2_IOC_RESVSP64: | 182 | case OCFS2_IOC_RESVSP64: |
163 | case OCFS2_IOC_UNRESVSP: | 183 | case OCFS2_IOC_UNRESVSP: |
164 | case OCFS2_IOC_UNRESVSP64: | 184 | case OCFS2_IOC_UNRESVSP64: |
185 | case OCFS2_IOC_GROUP_EXTEND: | ||
186 | case OCFS2_IOC_GROUP_ADD: | ||
187 | case OCFS2_IOC_GROUP_ADD64: | ||
165 | break; | 188 | break; |
166 | default: | 189 | default: |
167 | return -ENOIOCTLCMD; | 190 | return -ENOIOCTLCMD; |