aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/ioctl.c
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2012-10-09 10:03:21 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-10-09 10:04:25 -0400
commitffe315012510165ce82e4dd4767f0a5dba9edbf7 (patch)
treef601cd980af9d0ced5ca9aedecef4fa0d2ca0e15 /fs/ext4/ioctl.c
parente2d3a35ee427aaba99b6c68a56609ce276c51270 (diff)
parent4a8e43feeac7996b8de2d5b2823e316917493df4 (diff)
Merge tag 'disintegrate-mtd-20121009' of git://git.infradead.org/users/dhowells/linux-headers
UAPI Disintegration 2012-10-09 Conflicts: MAINTAINERS arch/arm/configs/bcmring_defconfig arch/arm/mach-imx/clk-imx51-imx53.c drivers/mtd/nand/Kconfig drivers/mtd/nand/bcm_umi_nand.c drivers/mtd/nand/nand_bcm_umi.h drivers/mtd/nand/orion_nand.c
Diffstat (limited to 'fs/ext4/ioctl.c')
-rw-r--r--fs/ext4/ioctl.c37
1 files changed, 8 insertions, 29 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 7f7dad787603..5747f52f7c72 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -233,7 +233,7 @@ group_extend_out:
233 233
234 case EXT4_IOC_MOVE_EXT: { 234 case EXT4_IOC_MOVE_EXT: {
235 struct move_extent me; 235 struct move_extent me;
236 struct file *donor_filp; 236 struct fd donor;
237 int err; 237 int err;
238 238
239 if (!(filp->f_mode & FMODE_READ) || 239 if (!(filp->f_mode & FMODE_READ) ||
@@ -245,11 +245,11 @@ group_extend_out:
245 return -EFAULT; 245 return -EFAULT;
246 me.moved_len = 0; 246 me.moved_len = 0;
247 247
248 donor_filp = fget(me.donor_fd); 248 donor = fdget(me.donor_fd);
249 if (!donor_filp) 249 if (!donor.file)
250 return -EBADF; 250 return -EBADF;
251 251
252 if (!(donor_filp->f_mode & FMODE_WRITE)) { 252 if (!(donor.file->f_mode & FMODE_WRITE)) {
253 err = -EBADF; 253 err = -EBADF;
254 goto mext_out; 254 goto mext_out;
255 } 255 }
@@ -258,14 +258,15 @@ group_extend_out:
258 EXT4_FEATURE_RO_COMPAT_BIGALLOC)) { 258 EXT4_FEATURE_RO_COMPAT_BIGALLOC)) {
259 ext4_msg(sb, KERN_ERR, 259 ext4_msg(sb, KERN_ERR,
260 "Online defrag not supported with bigalloc"); 260 "Online defrag not supported with bigalloc");
261 return -EOPNOTSUPP; 261 err = -EOPNOTSUPP;
262 goto mext_out;
262 } 263 }
263 264
264 err = mnt_want_write_file(filp); 265 err = mnt_want_write_file(filp);
265 if (err) 266 if (err)
266 goto mext_out; 267 goto mext_out;
267 268
268 err = ext4_move_extents(filp, donor_filp, me.orig_start, 269 err = ext4_move_extents(filp, donor.file, me.orig_start,
269 me.donor_start, me.len, &me.moved_len); 270 me.donor_start, me.len, &me.moved_len);
270 mnt_drop_write_file(filp); 271 mnt_drop_write_file(filp);
271 272
@@ -273,7 +274,7 @@ group_extend_out:
273 &me, sizeof(me))) 274 &me, sizeof(me)))
274 err = -EFAULT; 275 err = -EFAULT;
275mext_out: 276mext_out:
276 fput(donor_filp); 277 fdput(donor);
277 return err; 278 return err;
278 } 279 }
279 280
@@ -365,26 +366,11 @@ group_add_out:
365 return -EOPNOTSUPP; 366 return -EOPNOTSUPP;
366 } 367 }
367 368
368 if (EXT4_HAS_INCOMPAT_FEATURE(sb,
369 EXT4_FEATURE_INCOMPAT_META_BG)) {
370 ext4_msg(sb, KERN_ERR,
371 "Online resizing not (yet) supported with meta_bg");
372 return -EOPNOTSUPP;
373 }
374
375 if (copy_from_user(&n_blocks_count, (__u64 __user *)arg, 369 if (copy_from_user(&n_blocks_count, (__u64 __user *)arg,
376 sizeof(__u64))) { 370 sizeof(__u64))) {
377 return -EFAULT; 371 return -EFAULT;
378 } 372 }
379 373
380 if (n_blocks_count > MAX_32_NUM &&
381 !EXT4_HAS_INCOMPAT_FEATURE(sb,
382 EXT4_FEATURE_INCOMPAT_64BIT)) {
383 ext4_msg(sb, KERN_ERR,
384 "File system only supports 32-bit block numbers");
385 return -EOPNOTSUPP;
386 }
387
388 err = ext4_resize_begin(sb); 374 err = ext4_resize_begin(sb);
389 if (err) 375 if (err)
390 return err; 376 return err;
@@ -419,13 +405,6 @@ resizefs_out:
419 if (!blk_queue_discard(q)) 405 if (!blk_queue_discard(q))
420 return -EOPNOTSUPP; 406 return -EOPNOTSUPP;
421 407
422 if (EXT4_HAS_RO_COMPAT_FEATURE(sb,
423 EXT4_FEATURE_RO_COMPAT_BIGALLOC)) {
424 ext4_msg(sb, KERN_ERR,
425 "FITRIM not supported with bigalloc");
426 return -EOPNOTSUPP;
427 }
428
429 if (copy_from_user(&range, (struct fstrim_range __user *)arg, 408 if (copy_from_user(&range, (struct fstrim_range __user *)arg,
430 sizeof(range))) 409 sizeof(range)))
431 return -EFAULT; 410 return -EFAULT;