summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2014-04-12 22:53:53 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-04-12 22:53:53 -0400
commit40c406c74eb9eed58ae7d4d12a0197f7279c9499 (patch)
tree157b73fd979f8a95d0f15d0ca721113fdd21b66d /fs
parent847c6c422aa0ae81a5517a9558ec2737806dca48 (diff)
downloadop-kernel-dev-40c406c74eb9eed58ae7d4d12a0197f7279c9499.zip
op-kernel-dev-40c406c74eb9eed58ae7d4d12a0197f7279c9499.tar.gz
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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index f24ef86..96e0a4bc8 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)
if (mode & FALLOC_FL_PUNCH_HOLE)
return ext4_punch_hole(inode, offset, len);
- if (mode & FALLOC_FL_COLLAPSE_RANGE)
- return ext4_collapse_range(inode, offset, len);
-
ret = ext4_convert_inline_data(inode);
if (ret)
return ret;
@@ -4892,6 +4889,9 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
return -EOPNOTSUPP;
+ if (mode & FALLOC_FL_COLLAPSE_RANGE)
+ return ext4_collapse_range(inode, offset, len);
+
if (mode & FALLOC_FL_ZERO_RANGE)
return ext4_zero_range(file, offset, len, mode);
OpenPOWER on IntegriCloud