Commit a52f4cd2 authored by Liu Bo's avatar Liu Bo Committed by Josef Bacik

Btrfs: fix off-by-one in fiemap

lock_extent/unlock_extent expect an exclusive end.
Tested-by: default avatarDavid Sterba <dsterba@suse.cz>
Signed-off-by: default avatarLiu Bo <bo.li.liu@oracle.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent 60b62978
...@@ -3989,7 +3989,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, ...@@ -3989,7 +3989,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
last_for_get_extent = isize; last_for_get_extent = isize;
} }
lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + len, 0, lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + len - 1, 0,
&cached_state); &cached_state);
em = get_extent_skip_holes(inode, start, last_for_get_extent, em = get_extent_skip_holes(inode, start, last_for_get_extent,
...@@ -4076,7 +4076,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, ...@@ -4076,7 +4076,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
out_free: out_free:
free_extent_map(em); free_extent_map(em);
out: out:
unlock_extent_cached(&BTRFS_I(inode)->io_tree, start, start + len, unlock_extent_cached(&BTRFS_I(inode)->io_tree, start, start + len - 1,
&cached_state, GFP_NOFS); &cached_state, GFP_NOFS);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment