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. Reported-by: Eric Whitney <enwlinux@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
parent
e531d0bceb
commit
b9576fc362
|
@ -5396,6 +5396,14 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len)
|
||||||
loff_t new_size, ioffset;
|
loff_t new_size, ioffset;
|
||||||
int ret;
|
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. */
|
/* Collapse range works only on fs block size aligned offsets. */
|
||||||
if (offset & (EXT4_CLUSTER_SIZE(sb) - 1) ||
|
if (offset & (EXT4_CLUSTER_SIZE(sb) - 1) ||
|
||||||
len & (EXT4_CLUSTER_SIZE(sb) - 1))
|
len & (EXT4_CLUSTER_SIZE(sb) - 1))
|
||||||
|
|
Loading…
Reference in New Issue