diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2025-07-28 16:16:09 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2025-07-28 16:16:09 -0700 |
| commit | c7bfaff47a17ec01d9d8b648a7266103cb7a305b (patch) | |
| tree | 005b3eca0841e98d74597cb8b98333aae394bdf9 /fs/ext2 | |
| parent | block: change blk_get_meta_cap() stub return -ENOIOCTLCMD (diff) | |
| parent | udf: Verify partition map count (diff) | |
| download | linux-c7bfaff47a17ec01d9d8b648a7266103cb7a305b.tar.gz linux-c7bfaff47a17ec01d9d8b648a7266103cb7a305b.zip | |
Merge tag 'fs_for_v6.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull udf and ext2 updates from Jan Kara:
"A few udf and ext2 fixes and cleanups"
* tag 'fs_for_v6.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
udf: Verify partition map count
udf: stop using write_cache_pages
ext2: Handle fiemap on empty files to prevent EINVAL
Diffstat (limited to 'fs/ext2')
| -rw-r--r-- | fs/ext2/inode.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index d35ca26eee3c..e10c376843d7 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -895,9 +895,19 @@ int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, u64 start, u64 len) { int ret; + loff_t i_size; inode_lock(inode); - len = min_t(u64, len, i_size_read(inode)); + i_size = i_size_read(inode); + /* + * iomap_fiemap() returns EINVAL for 0 length. Make sure we don't trim + * length to 0 but still trim the range as much as possible since + * ext2_get_blocks() iterates unmapped space block by block which is + * slow. + */ + if (i_size == 0) + i_size = 1; + len = min_t(u64, len, i_size); ret = iomap_fiemap(inode, fieinfo, start, len, &ext2_iomap_ops); inode_unlock(inode); |
