aboutsummaryrefslogtreecommitdiff
path: root/fs/ext4
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2015-05-15 00:24:10 -0400
committerMoyster <oysterized@gmail.com>2018-12-01 23:25:42 +0100
commitfc6b2a210553b1f44fb20418aca478477d4bf5f6 (patch)
tree599d25f38609e847bd9ede9a0d244d9aa6309124 /fs/ext4
parent77d152d0b5ad11e5cba89c49962c748d9d61c2a3 (diff)
ext4: fix an ext3 collapse range regression in xfstests
[ Upstream commit b9576fc3624eb9fc88bec0d0ae883fd78be86239 ] The xfstests test suite assumes that an attempt to collapse range on the range (0, 1) will return EOPNOTSUPP if the file system does not support collapse range. Commit 280227a75b56: "ext4: move check under lock scope to close a race" broke this, and this caused xfstests to fail when run when testing file systems that did not have the extents feature enabled. Reported-by: Eric Whitney <enwlinux@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/extents.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index d609e9cb6..f7ac64eb7 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -5407,6 +5407,14 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len)
loff_t oldsize = i_size_read(inode);
int ret;
+ /*
+ * We need to test this early because xfstests assumes that a
+ * collapse range of (0, 1) will return EOPNOTSUPP if the file
+ * system does not support collapse range.
+ */
+ if (!ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
+ return -EOPNOTSUPP;
+
/* Collapse range works only on fs block size aligned offsets. */
if (offset & (EXT4_CLUSTER_SIZE(sb) - 1) ||
len & (EXT4_CLUSTER_SIZE(sb) - 1))