Skip to content

Commit

Permalink
Off by one fix for btrfs_drop_extents
Browse files Browse the repository at this point in the history
One of my old patches introduces a new bug to
btrfs_drop_extents(changeset 275). Inline extents are not truncated
properly when "extent_end == end", it can trigger the BUG_ON at
file.c:600.  I hope I don't introduce new bug this time.

---

Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Yan authored and Chris Mason committed Sep 25, 2008
1 parent f6dbff5 commit 6e3b966
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,9 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans,
search_start = (extent_end + mask) & ~mask;
} else
search_start = extent_end;
if (end < extent_end && start > key.offset && found_inline) {
if (end <= extent_end && start >= key.offset && found_inline) {
*hint_byte = EXTENT_MAP_INLINE;
continue;
}
if (end < extent_end && end >= key.offset) {
if (found_extent) {
Expand Down

0 comments on commit 6e3b966

Please sign in to comment.