summaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-05-23 09:30:13 +0200
committerTheodore Ts'o <tytso@mit.edu>2020-06-03 23:16:55 -0400
commitcddf8a2c4a8286ae60fc866eab59c8bc524e93a0 (patch)
treec3f18f1243c85c5f3d67aa2d4f7afc44f3feccb8 /fs/ext4
parent2732881894714f545ffac42dad7ba7730069874d (diff)
downloadlinux-cddf8a2c4a8286ae60fc866eab59c8bc524e93a0.tar.gz
linux-cddf8a2c4a8286ae60fc866eab59c8bc524e93a0.tar.bz2
linux-cddf8a2c4a8286ae60fc866eab59c8bc524e93a0.zip
fs: move fiemap range validation into the file systems instances
Replace fiemap_check_flags with a fiemap_prep helper that also takes the inode and mapped range, and performs the sanity check and truncation previously done in fiemap_check_range. This way the validation is inside the file system itself and thus properly works for the stacked overlayfs case as well. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Link: https://lore.kernel.org/r/20200523073016.2944131-7-hch@lst.de Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/extents.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index b365c8b407c4..cea083efb650 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4938,8 +4938,9 @@ int ext4_get_es_cache(struct inode *inode, struct fiemap_extent_info *fieinfo,
fieinfo->fi_flags &= ~FIEMAP_FLAG_CACHE;
}
- if (fiemap_check_flags(fieinfo, FIEMAP_FLAG_SYNC))
- return -EBADR;
+ error = fiemap_prep(inode, fieinfo, start, &len, FIEMAP_FLAG_SYNC);
+ if (error)
+ return error;
error = ext4_fiemap_check_ranges(inode, start, &len);
if (error)