diff options
author | Theodore Ts'o <tytso@mit.edu> | 2014-04-12 22:53:53 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-04-12 22:53:53 -0400 |
commit | 40c406c74eb9eed58ae7d4d12a0197f7279c9499 (patch) | |
tree | 157b73fd979f8a95d0f15d0ca721113fdd21b66d /fs | |
parent | 847c6c422aa0ae81a5517a9558ec2737806dca48 (diff) |
ext4: COLLAPSE_RANGE only works on extent-based files
Unfortunately, we weren't checking to make sure of this the inode was
extent-based before attempt operate on it. Hilarity ensues.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Namjae Jeon <namjae.jeon@samsung.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/extents.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index f24ef8697609..96e0a4bc8faa 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -4878,9 +4878,6 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len) | |||
4878 | if (mode & FALLOC_FL_PUNCH_HOLE) | 4878 | if (mode & FALLOC_FL_PUNCH_HOLE) |
4879 | return ext4_punch_hole(inode, offset, len); | 4879 | return ext4_punch_hole(inode, offset, len); |
4880 | 4880 | ||
4881 | if (mode & FALLOC_FL_COLLAPSE_RANGE) | ||
4882 | return ext4_collapse_range(inode, offset, len); | ||
4883 | |||
4884 | ret = ext4_convert_inline_data(inode); | 4881 | ret = ext4_convert_inline_data(inode); |
4885 | if (ret) | 4882 | if (ret) |
4886 | return ret; | 4883 | return ret; |
@@ -4892,6 +4889,9 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len) | |||
4892 | if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) | 4889 | if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) |
4893 | return -EOPNOTSUPP; | 4890 | return -EOPNOTSUPP; |
4894 | 4891 | ||
4892 | if (mode & FALLOC_FL_COLLAPSE_RANGE) | ||
4893 | return ext4_collapse_range(inode, offset, len); | ||
4894 | |||
4895 | if (mode & FALLOC_FL_ZERO_RANGE) | 4895 | if (mode & FALLOC_FL_ZERO_RANGE) |
4896 | return ext4_zero_range(file, offset, len, mode); | 4896 | return ext4_zero_range(file, offset, len, mode); |
4897 | 4897 | ||