diff options
Diffstat (limited to 'fs/ocfs2/ioctl.c')
-rw-r--r-- | fs/ocfs2/ioctl.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c index 5177fba5162b..7b142f0ce995 100644 --- a/fs/ocfs2/ioctl.c +++ b/fs/ocfs2/ioctl.c | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
9 | #include <linux/mount.h> | 9 | #include <linux/mount.h> |
10 | #include <linux/smp_lock.h> | ||
10 | 11 | ||
11 | #define MLOG_MASK_PREFIX ML_INODE | 12 | #define MLOG_MASK_PREFIX ML_INODE |
12 | #include <cluster/masklog.h> | 13 | #include <cluster/masklog.h> |
@@ -59,10 +60,6 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags, | |||
59 | goto bail; | 60 | goto bail; |
60 | } | 61 | } |
61 | 62 | ||
62 | status = -EROFS; | ||
63 | if (IS_RDONLY(inode)) | ||
64 | goto bail_unlock; | ||
65 | |||
66 | status = -EACCES; | 63 | status = -EACCES; |
67 | if (!is_owner_or_cap(inode)) | 64 | if (!is_owner_or_cap(inode)) |
68 | goto bail_unlock; | 65 | goto bail_unlock; |
@@ -112,9 +109,9 @@ bail: | |||
112 | return status; | 109 | return status; |
113 | } | 110 | } |
114 | 111 | ||
115 | int ocfs2_ioctl(struct inode * inode, struct file * filp, | 112 | long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
116 | unsigned int cmd, unsigned long arg) | ||
117 | { | 113 | { |
114 | struct inode *inode = filp->f_path.dentry->d_inode; | ||
118 | unsigned int flags; | 115 | unsigned int flags; |
119 | int new_clusters; | 116 | int new_clusters; |
120 | int status; | 117 | int status; |
@@ -133,8 +130,13 @@ int ocfs2_ioctl(struct inode * inode, struct file * filp, | |||
133 | if (get_user(flags, (int __user *) arg)) | 130 | if (get_user(flags, (int __user *) arg)) |
134 | return -EFAULT; | 131 | return -EFAULT; |
135 | 132 | ||
136 | return ocfs2_set_inode_attr(inode, flags, | 133 | status = mnt_want_write(filp->f_path.mnt); |
134 | if (status) | ||
135 | return status; | ||
136 | status = ocfs2_set_inode_attr(inode, flags, | ||
137 | OCFS2_FL_MODIFIABLE); | 137 | OCFS2_FL_MODIFIABLE); |
138 | mnt_drop_write(filp->f_path.mnt); | ||
139 | return status; | ||
138 | case OCFS2_IOC_RESVSP: | 140 | case OCFS2_IOC_RESVSP: |
139 | case OCFS2_IOC_RESVSP64: | 141 | case OCFS2_IOC_RESVSP64: |
140 | case OCFS2_IOC_UNRESVSP: | 142 | case OCFS2_IOC_UNRESVSP: |
@@ -168,9 +170,6 @@ int ocfs2_ioctl(struct inode * inode, struct file * filp, | |||
168 | #ifdef CONFIG_COMPAT | 170 | #ifdef CONFIG_COMPAT |
169 | long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg) | 171 | long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg) |
170 | { | 172 | { |
171 | struct inode *inode = file->f_path.dentry->d_inode; | ||
172 | int ret; | ||
173 | |||
174 | switch (cmd) { | 173 | switch (cmd) { |
175 | case OCFS2_IOC32_GETFLAGS: | 174 | case OCFS2_IOC32_GETFLAGS: |
176 | cmd = OCFS2_IOC_GETFLAGS; | 175 | cmd = OCFS2_IOC_GETFLAGS; |
@@ -190,9 +189,6 @@ long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
190 | return -ENOIOCTLCMD; | 189 | return -ENOIOCTLCMD; |
191 | } | 190 | } |
192 | 191 | ||
193 | lock_kernel(); | 192 | return ocfs2_ioctl(file, cmd, arg); |
194 | ret = ocfs2_ioctl(inode, file, cmd, arg); | ||
195 | unlock_kernel(); | ||
196 | return ret; | ||
197 | } | 193 | } |
198 | #endif | 194 | #endif |