summaryrefslogtreecommitdiffstats
path: root/fs/ext4/ioctl.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-14 15:59:42 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-14 15:59:42 -0500
commitae9a8c4bdc91202b4236372eed53c54d2297c71b (patch)
tree4596680ee808334d246ad2f93bdd743d76c3741a /fs/ext4/ioctl.c
parent32190f0afbf4f1c0a9142e5a886a078ee0b794fd (diff)
parent232530680290ba94ca37852ab10d9556ea28badf (diff)
Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 updates from Ted Ts'o: - Add support for online resizing of file systems with bigalloc - Fix a two data corruption bugs involving DAX, as well as a corruption bug after a crash during a racing fallocate and delayed allocation. - Finally, a number of cleanups and optimizations. * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: ext4: improve smp scalability for inode generation ext4: add support for online resizing with bigalloc ext4: mention noload when recovering on read-only device Documentation: fix little inconsistencies ext4: convert timers to use timer_setup() jbd2: convert timers to use timer_setup() ext4: remove duplicate extended attributes defs ext4: add ext4_should_use_dax() ext4: add sanity check for encryption + DAX ext4: prevent data corruption with journaling + DAX ext4: prevent data corruption with inline data + DAX ext4: fix interaction between i_size, fallocate, and delalloc after a crash ext4: retry allocations conservatively ext4: Switch to iomap for SEEK_HOLE / SEEK_DATA ext4: Add iomap support for inline data iomap: Add IOMAP_F_DATA_INLINE flag iomap: Switch from blkno to disk offset
Diffstat (limited to 'fs/ext4/ioctl.c')
-rw-r--r--fs/ext4/ioctl.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 75d83471f65c..b7558f292420 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -15,6 +15,7 @@
15#include <linux/mount.h> 15#include <linux/mount.h>
16#include <linux/file.h> 16#include <linux/file.h>
17#include <linux/quotaops.h> 17#include <linux/quotaops.h>
18#include <linux/random.h>
18#include <linux/uuid.h> 19#include <linux/uuid.h>
19#include <linux/uaccess.h> 20#include <linux/uaccess.h>
20#include <linux/delay.h> 21#include <linux/delay.h>
@@ -99,7 +100,6 @@ static long swap_inode_boot_loader(struct super_block *sb,
99 int err; 100 int err;
100 struct inode *inode_bl; 101 struct inode *inode_bl;
101 struct ext4_inode_info *ei_bl; 102 struct ext4_inode_info *ei_bl;
102 struct ext4_sb_info *sbi = EXT4_SB(sb);
103 103
104 if (inode->i_nlink != 1 || !S_ISREG(inode->i_mode)) 104 if (inode->i_nlink != 1 || !S_ISREG(inode->i_mode))
105 return -EINVAL; 105 return -EINVAL;
@@ -158,10 +158,8 @@ static long swap_inode_boot_loader(struct super_block *sb,
158 158
159 inode->i_ctime = inode_bl->i_ctime = current_time(inode); 159 inode->i_ctime = inode_bl->i_ctime = current_time(inode);
160 160
161 spin_lock(&sbi->s_next_gen_lock); 161 inode->i_generation = prandom_u32();
162 inode->i_generation = sbi->s_next_generation++; 162 inode_bl->i_generation = prandom_u32();
163 inode_bl->i_generation = sbi->s_next_generation++;
164 spin_unlock(&sbi->s_next_gen_lock);
165 163
166 ext4_discard_preallocations(inode); 164 ext4_discard_preallocations(inode);
167 165
@@ -291,10 +289,20 @@ flags_err:
291 if (err) 289 if (err)
292 goto flags_out; 290 goto flags_out;
293 291
294 if ((jflag ^ oldflags) & (EXT4_JOURNAL_DATA_FL)) 292 if ((jflag ^ oldflags) & (EXT4_JOURNAL_DATA_FL)) {
293 /*
294 * Changes to the journaling mode can cause unsafe changes to
295 * S_DAX if we are using the DAX mount option.
296 */
297 if (test_opt(inode->i_sb, DAX)) {
298 err = -EBUSY;
299 goto flags_out;
300 }
301
295 err = ext4_change_inode_journal_flag(inode, jflag); 302 err = ext4_change_inode_journal_flag(inode, jflag);
296 if (err) 303 if (err)
297 goto flags_out; 304 goto flags_out;
305 }
298 if (migrate) { 306 if (migrate) {
299 if (flags & EXT4_EXTENTS_FL) 307 if (flags & EXT4_EXTENTS_FL)
300 err = ext4_ext_migrate(inode); 308 err = ext4_ext_migrate(inode);
@@ -862,12 +870,6 @@ group_add_out:
862 int err = 0, err2 = 0; 870 int err = 0, err2 = 0;
863 ext4_group_t o_group = EXT4_SB(sb)->s_groups_count; 871 ext4_group_t o_group = EXT4_SB(sb)->s_groups_count;
864 872
865 if (ext4_has_feature_bigalloc(sb)) {
866 ext4_msg(sb, KERN_ERR,
867 "Online resizing not (yet) supported with bigalloc");
868 return -EOPNOTSUPP;
869 }
870
871 if (copy_from_user(&n_blocks_count, (__u64 __user *)arg, 873 if (copy_from_user(&n_blocks_count, (__u64 __user *)arg,
872 sizeof(__u64))) { 874 sizeof(__u64))) {
873 return -EFAULT; 875 return -EFAULT;