提交 6347b3c4 编写于 作者: M Miao Xie 提交者: Chris Mason

Btrfs: fix off-by-one error of the same page check in btrfs_punch_hole()

(start + len) is the start of the adjacent extent, not the end of the current
extent, so we should not use it to check the hole is on the same page or not.
Signed-off-by: NMiao Xie <miaox@cn.fujitsu.com>
Signed-off-by: NChris Mason <chris.mason@fusionio.com>
上级 4b5829a8
...@@ -1867,8 +1867,8 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) ...@@ -1867,8 +1867,8 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len)
u64 drop_end; u64 drop_end;
int ret = 0; int ret = 0;
int err = 0; int err = 0;
bool same_page = (offset >> PAGE_CACHE_SHIFT) == bool same_page = ((offset >> PAGE_CACHE_SHIFT) ==
((offset + len) >> PAGE_CACHE_SHIFT); ((offset + len - 1) >> PAGE_CACHE_SHIFT));
btrfs_wait_ordered_range(inode, offset, len); btrfs_wait_ordered_range(inode, offset, len);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册