History

ext4: fix an ext3 collapse range regression in xfstests

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.

Theodore Ts'o committed 11 years ago

Commit b9576fc1 parent e531d0b1 file · +8 −0Browse files

Unified · Split

fs/ext4/extents.c+8−0
@@ -5396,6 +5396,14 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len) · 5395 unmodified lines
5396 loff_t new_size, ioffset;5396 loff_t new_size, ioffset;
5397 int ret;5397 int ret;
5398 5398
5399 /*
5400 * We need to test this early because xfstests assumes that a
5401 * collapse range of (0, 1) will return EOPNOTSUPP if the file
5402 * system does not support collapse range.
5403 */
5404 if (!ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
5405 return -EOPNOTSUPP;
5406
5399 /* Collapse range works only on fs block size aligned offsets. */5407 /* Collapse range works only on fs block size aligned offsets. */
5400 if (offset & (EXT4_CLUSTER_SIZE(sb) - 1) ||5408 if (offset & (EXT4_CLUSTER_SIZE(sb) - 1) ||
5401 len & (EXT4_CLUSTER_SIZE(sb) - 1))5409 len & (EXT4_CLUSTER_SIZE(sb) - 1))