diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-17 14:54:55 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-17 14:54:55 -0500 |
commit | 93f30c73ecd0281cf3685ef0e4e384980a176176 (patch) | |
tree | bd272334a0dbd258c08b5b2237e8bf5e17ce7255 /fs/ext4 | |
parent | 06ede5f6086757f746b7be860ae76137f4e95032 (diff) | |
parent | 96271654f55c74ff7325fbdfc535466c9deb0ce6 (diff) |
Merge branch 'misc.compat' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull compat and uaccess updates from Al Viro:
- {get,put}_compat_sigset() series
- assorted compat ioctl stuff
- more set_fs() elimination
- a few more timespec64 conversions
- several removals of pointless access_ok() in places where it was
followed only by non-__ variants of primitives
* 'misc.compat' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (24 commits)
coredump: call do_unlinkat directly instead of sys_unlink
fs: expose do_unlinkat for built-in callers
ext4: take handling of EXT4_IOC_GROUP_ADD into a helper, get rid of set_fs()
ipmi: get rid of pointless access_ok()
pi433: sanitize ioctl
cxlflash: get rid of pointless access_ok()
mtdchar: get rid of pointless access_ok()
r128: switch compat ioctls to drm_ioctl_kernel()
selection: get rid of field-by-field copyin
VT_RESIZEX: get rid of field-by-field copyin
i2c compat ioctls: move to ->compat_ioctl()
sched_rr_get_interval(): move compat to native, get rid of set_fs()
mips: switch to {get,put}_compat_sigset()
sparc: switch to {get,put}_compat_sigset()
s390: switch to {get,put}_compat_sigset()
ppc: switch to {get,put}_compat_sigset()
parisc: switch to {get,put}_compat_sigset()
get_compat_sigset()
get rid of {get,put}_compat_itimerspec()
io_getevents: Use timespec64 to represent timeouts
...
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/ioctl.c | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index b7558f292420..1eec25014f62 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -592,6 +592,44 @@ static int ext4_ioc_getfsmap(struct super_block *sb, | |||
592 | return 0; | 592 | return 0; |
593 | } | 593 | } |
594 | 594 | ||
595 | static long ext4_ioctl_group_add(struct file *file, | ||
596 | struct ext4_new_group_data *input) | ||
597 | { | ||
598 | struct super_block *sb = file_inode(file)->i_sb; | ||
599 | int err, err2=0; | ||
600 | |||
601 | err = ext4_resize_begin(sb); | ||
602 | if (err) | ||
603 | return err; | ||
604 | |||
605 | if (ext4_has_feature_bigalloc(sb)) { | ||
606 | ext4_msg(sb, KERN_ERR, | ||
607 | "Online resizing not supported with bigalloc"); | ||
608 | err = -EOPNOTSUPP; | ||
609 | goto group_add_out; | ||
610 | } | ||
611 | |||
612 | err = mnt_want_write_file(file); | ||
613 | if (err) | ||
614 | goto group_add_out; | ||
615 | |||
616 | err = ext4_group_add(sb, input); | ||
617 | if (EXT4_SB(sb)->s_journal) { | ||
618 | jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal); | ||
619 | err2 = jbd2_journal_flush(EXT4_SB(sb)->s_journal); | ||
620 | jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal); | ||
621 | } | ||
622 | if (err == 0) | ||
623 | err = err2; | ||
624 | mnt_drop_write_file(file); | ||
625 | if (!err && ext4_has_group_desc_csum(sb) && | ||
626 | test_opt(sb, INIT_INODE_TABLE)) | ||
627 | err = ext4_register_li_request(sb, input->group); | ||
628 | group_add_out: | ||
629 | ext4_resize_end(sb); | ||
630 | return err; | ||
631 | } | ||
632 | |||
595 | long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 633 | long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
596 | { | 634 | { |
597 | struct inode *inode = file_inode(filp); | 635 | struct inode *inode = file_inode(filp); |
@@ -776,44 +814,12 @@ mext_out: | |||
776 | 814 | ||
777 | case EXT4_IOC_GROUP_ADD: { | 815 | case EXT4_IOC_GROUP_ADD: { |
778 | struct ext4_new_group_data input; | 816 | struct ext4_new_group_data input; |
779 | int err, err2=0; | ||
780 | |||
781 | err = ext4_resize_begin(sb); | ||
782 | if (err) | ||
783 | return err; | ||
784 | 817 | ||
785 | if (copy_from_user(&input, (struct ext4_new_group_input __user *)arg, | 818 | if (copy_from_user(&input, (struct ext4_new_group_input __user *)arg, |
786 | sizeof(input))) { | 819 | sizeof(input))) |
787 | err = -EFAULT; | 820 | return -EFAULT; |
788 | goto group_add_out; | ||
789 | } | ||
790 | |||
791 | if (ext4_has_feature_bigalloc(sb)) { | ||
792 | ext4_msg(sb, KERN_ERR, | ||
793 | "Online resizing not supported with bigalloc"); | ||
794 | err = -EOPNOTSUPP; | ||
795 | goto group_add_out; | ||
796 | } | ||
797 | |||
798 | err = mnt_want_write_file(filp); | ||
799 | if (err) | ||
800 | goto group_add_out; | ||
801 | 821 | ||
802 | err = ext4_group_add(sb, &input); | 822 | return ext4_ioctl_group_add(filp, &input); |
803 | if (EXT4_SB(sb)->s_journal) { | ||
804 | jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal); | ||
805 | err2 = jbd2_journal_flush(EXT4_SB(sb)->s_journal); | ||
806 | jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal); | ||
807 | } | ||
808 | if (err == 0) | ||
809 | err = err2; | ||
810 | mnt_drop_write_file(filp); | ||
811 | if (!err && ext4_has_group_desc_csum(sb) && | ||
812 | test_opt(sb, INIT_INODE_TABLE)) | ||
813 | err = ext4_register_li_request(sb, input.group); | ||
814 | group_add_out: | ||
815 | ext4_resize_end(sb); | ||
816 | return err; | ||
817 | } | 823 | } |
818 | 824 | ||
819 | case EXT4_IOC_MIGRATE: | 825 | case EXT4_IOC_MIGRATE: |
@@ -1078,8 +1084,7 @@ long ext4_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
1078 | break; | 1084 | break; |
1079 | case EXT4_IOC32_GROUP_ADD: { | 1085 | case EXT4_IOC32_GROUP_ADD: { |
1080 | struct compat_ext4_new_group_input __user *uinput; | 1086 | struct compat_ext4_new_group_input __user *uinput; |
1081 | struct ext4_new_group_input input; | 1087 | struct ext4_new_group_data input; |
1082 | mm_segment_t old_fs; | ||
1083 | int err; | 1088 | int err; |
1084 | 1089 | ||
1085 | uinput = compat_ptr(arg); | 1090 | uinput = compat_ptr(arg); |
@@ -1092,12 +1097,7 @@ long ext4_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
1092 | &uinput->reserved_blocks); | 1097 | &uinput->reserved_blocks); |
1093 | if (err) | 1098 | if (err) |
1094 | return -EFAULT; | 1099 | return -EFAULT; |
1095 | old_fs = get_fs(); | 1100 | return ext4_ioctl_group_add(file, &input); |
1096 | set_fs(KERNEL_DS); | ||
1097 | err = ext4_ioctl(file, EXT4_IOC_GROUP_ADD, | ||
1098 | (unsigned long) &input); | ||
1099 | set_fs(old_fs); | ||
1100 | return err; | ||
1101 | } | 1101 | } |
1102 | case EXT4_IOC_MOVE_EXT: | 1102 | case EXT4_IOC_MOVE_EXT: |
1103 | case EXT4_IOC_RESIZE_FS: | 1103 | case EXT4_IOC_RESIZE_FS: |