mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-12-04 21:00:56 -06:00
btrfs: use aligned range for locking in extent_fiemap()
The @end parameter for all extent io tree helpers is inclusive, but
the call site in extent_fiemap() is passing an exclusive end into
btrfs_lock_extent(), which will step into the next block unexpectedly.
Pass the inclusive end into btrfs_lock_extent() and
btrfs_unlock_extent().
Fixes: ac3c0d36a2 ("btrfs: make fiemap more efficient and accurate reporting extent sharedness")
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
+2
-2
@@ -660,7 +660,7 @@ restart:
|
||||
range_end = round_up(start + len, sectorsize);
|
||||
prev_extent_end = range_start;
|
||||
|
||||
btrfs_lock_extent(&inode->io_tree, range_start, range_end, &cached_state);
|
||||
btrfs_lock_extent(&inode->io_tree, range_start, range_end - 1, &cached_state);
|
||||
|
||||
ret = fiemap_find_last_extent_offset(inode, path, &last_extent_end);
|
||||
if (ret < 0)
|
||||
@@ -840,7 +840,7 @@ check_eof_delalloc:
|
||||
}
|
||||
|
||||
out_unlock:
|
||||
btrfs_unlock_extent(&inode->io_tree, range_start, range_end, &cached_state);
|
||||
btrfs_unlock_extent(&inode->io_tree, range_start, range_end - 1, &cached_state);
|
||||
|
||||
if (ret == BTRFS_FIEMAP_FLUSH_CACHE) {
|
||||
btrfs_release_path(path);
|
||||
|
||||
Reference in New Issue
Block a user