diff options
Diffstat (limited to 'fs/ext4/ioctl.c')
-rw-r--r-- | fs/ext4/ioctl.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index a56796814d6a..e87a932b073b 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -45,7 +45,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
45 | if (get_user(flags, (int __user *) arg)) | 45 | if (get_user(flags, (int __user *) arg)) |
46 | return -EFAULT; | 46 | return -EFAULT; |
47 | 47 | ||
48 | err = mnt_want_write(filp->f_path.mnt); | 48 | err = mnt_want_write_file(filp); |
49 | if (err) | 49 | if (err) |
50 | return err; | 50 | return err; |
51 | 51 | ||
@@ -134,7 +134,7 @@ flags_err: | |||
134 | err = ext4_ext_migrate(inode); | 134 | err = ext4_ext_migrate(inode); |
135 | flags_out: | 135 | flags_out: |
136 | mutex_unlock(&inode->i_mutex); | 136 | mutex_unlock(&inode->i_mutex); |
137 | mnt_drop_write(filp->f_path.mnt); | 137 | mnt_drop_write_file(filp); |
138 | return err; | 138 | return err; |
139 | } | 139 | } |
140 | case EXT4_IOC_GETVERSION: | 140 | case EXT4_IOC_GETVERSION: |
@@ -150,7 +150,7 @@ flags_out: | |||
150 | if (!inode_owner_or_capable(inode)) | 150 | if (!inode_owner_or_capable(inode)) |
151 | return -EPERM; | 151 | return -EPERM; |
152 | 152 | ||
153 | err = mnt_want_write(filp->f_path.mnt); | 153 | err = mnt_want_write_file(filp); |
154 | if (err) | 154 | if (err) |
155 | return err; | 155 | return err; |
156 | if (get_user(generation, (int __user *) arg)) { | 156 | if (get_user(generation, (int __user *) arg)) { |
@@ -158,10 +158,11 @@ flags_out: | |||
158 | goto setversion_out; | 158 | goto setversion_out; |
159 | } | 159 | } |
160 | 160 | ||
161 | mutex_lock(&inode->i_mutex); | ||
161 | handle = ext4_journal_start(inode, 1); | 162 | handle = ext4_journal_start(inode, 1); |
162 | if (IS_ERR(handle)) { | 163 | if (IS_ERR(handle)) { |
163 | err = PTR_ERR(handle); | 164 | err = PTR_ERR(handle); |
164 | goto setversion_out; | 165 | goto unlock_out; |
165 | } | 166 | } |
166 | err = ext4_reserve_inode_write(handle, inode, &iloc); | 167 | err = ext4_reserve_inode_write(handle, inode, &iloc); |
167 | if (err == 0) { | 168 | if (err == 0) { |
@@ -170,8 +171,11 @@ flags_out: | |||
170 | err = ext4_mark_iloc_dirty(handle, inode, &iloc); | 171 | err = ext4_mark_iloc_dirty(handle, inode, &iloc); |
171 | } | 172 | } |
172 | ext4_journal_stop(handle); | 173 | ext4_journal_stop(handle); |
174 | |||
175 | unlock_out: | ||
176 | mutex_unlock(&inode->i_mutex); | ||
173 | setversion_out: | 177 | setversion_out: |
174 | mnt_drop_write(filp->f_path.mnt); | 178 | mnt_drop_write_file(filp); |
175 | return err; | 179 | return err; |
176 | } | 180 | } |
177 | case EXT4_IOC_GROUP_EXTEND: { | 181 | case EXT4_IOC_GROUP_EXTEND: { |
@@ -192,7 +196,7 @@ setversion_out: | |||
192 | return -EOPNOTSUPP; | 196 | return -EOPNOTSUPP; |
193 | } | 197 | } |
194 | 198 | ||
195 | err = mnt_want_write(filp->f_path.mnt); | 199 | err = mnt_want_write_file(filp); |
196 | if (err) | 200 | if (err) |
197 | return err; | 201 | return err; |
198 | 202 | ||
@@ -204,7 +208,7 @@ setversion_out: | |||
204 | } | 208 | } |
205 | if (err == 0) | 209 | if (err == 0) |
206 | err = err2; | 210 | err = err2; |
207 | mnt_drop_write(filp->f_path.mnt); | 211 | mnt_drop_write_file(filp); |
208 | ext4_resize_end(sb); | 212 | ext4_resize_end(sb); |
209 | 213 | ||
210 | return err; | 214 | return err; |
@@ -240,13 +244,13 @@ setversion_out: | |||
240 | return -EOPNOTSUPP; | 244 | return -EOPNOTSUPP; |
241 | } | 245 | } |
242 | 246 | ||
243 | err = mnt_want_write(filp->f_path.mnt); | 247 | err = mnt_want_write_file(filp); |
244 | if (err) | 248 | if (err) |
245 | goto mext_out; | 249 | goto mext_out; |
246 | 250 | ||
247 | err = ext4_move_extents(filp, donor_filp, me.orig_start, | 251 | err = ext4_move_extents(filp, donor_filp, me.orig_start, |
248 | me.donor_start, me.len, &me.moved_len); | 252 | me.donor_start, me.len, &me.moved_len); |
249 | mnt_drop_write(filp->f_path.mnt); | 253 | mnt_drop_write_file(filp); |
250 | if (me.moved_len > 0) | 254 | if (me.moved_len > 0) |
251 | file_remove_suid(donor_filp); | 255 | file_remove_suid(donor_filp); |
252 | 256 | ||
@@ -277,7 +281,7 @@ mext_out: | |||
277 | return -EOPNOTSUPP; | 281 | return -EOPNOTSUPP; |
278 | } | 282 | } |
279 | 283 | ||
280 | err = mnt_want_write(filp->f_path.mnt); | 284 | err = mnt_want_write_file(filp); |
281 | if (err) | 285 | if (err) |
282 | return err; | 286 | return err; |
283 | 287 | ||
@@ -289,7 +293,7 @@ mext_out: | |||
289 | } | 293 | } |
290 | if (err == 0) | 294 | if (err == 0) |
291 | err = err2; | 295 | err = err2; |
292 | mnt_drop_write(filp->f_path.mnt); | 296 | mnt_drop_write_file(filp); |
293 | ext4_resize_end(sb); | 297 | ext4_resize_end(sb); |
294 | 298 | ||
295 | return err; | 299 | return err; |
@@ -301,7 +305,7 @@ mext_out: | |||
301 | if (!inode_owner_or_capable(inode)) | 305 | if (!inode_owner_or_capable(inode)) |
302 | return -EACCES; | 306 | return -EACCES; |
303 | 307 | ||
304 | err = mnt_want_write(filp->f_path.mnt); | 308 | err = mnt_want_write_file(filp); |
305 | if (err) | 309 | if (err) |
306 | return err; | 310 | return err; |
307 | /* | 311 | /* |
@@ -313,7 +317,7 @@ mext_out: | |||
313 | mutex_lock(&(inode->i_mutex)); | 317 | mutex_lock(&(inode->i_mutex)); |
314 | err = ext4_ext_migrate(inode); | 318 | err = ext4_ext_migrate(inode); |
315 | mutex_unlock(&(inode->i_mutex)); | 319 | mutex_unlock(&(inode->i_mutex)); |
316 | mnt_drop_write(filp->f_path.mnt); | 320 | mnt_drop_write_file(filp); |
317 | return err; | 321 | return err; |
318 | } | 322 | } |
319 | 323 | ||
@@ -323,11 +327,11 @@ mext_out: | |||
323 | if (!inode_owner_or_capable(inode)) | 327 | if (!inode_owner_or_capable(inode)) |
324 | return -EACCES; | 328 | return -EACCES; |
325 | 329 | ||
326 | err = mnt_want_write(filp->f_path.mnt); | 330 | err = mnt_want_write_file(filp); |
327 | if (err) | 331 | if (err) |
328 | return err; | 332 | return err; |
329 | err = ext4_alloc_da_blocks(inode); | 333 | err = ext4_alloc_da_blocks(inode); |
330 | mnt_drop_write(filp->f_path.mnt); | 334 | mnt_drop_write_file(filp); |
331 | return err; | 335 | return err; |
332 | } | 336 | } |
333 | 337 | ||