mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02: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:
parent
db4b9eefc8
commit
681e073614
|
|
@ -660,7 +660,7 @@ static int extent_fiemap(struct btrfs_inode *inode,
|
|||
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 @@ static int extent_fiemap(struct btrfs_inode *inode,
|
|||
}
|
||||
|
||||
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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user