Skip to content

Commit

Permalink
btrfs_drop_extents: handle BTRFS_INODE_REF_KEY types
Browse files Browse the repository at this point in the history
It's possible "key.type == BTRFS_INODE_REF_KEY" and "key.offset >= end".

Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Yan authored and Chris Mason committed Sep 25, 2008
1 parent 068fe39 commit 7261009
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,11 +507,12 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans,
slot = path->slots[0];
ret = 0;
btrfs_item_key_to_cpu(leaf, &key, slot);

if (key.offset >= end || key.objectid != inode->i_ino) {
if (btrfs_key_type(&key) == BTRFS_EXTENT_DATA_KEY &&
key.offset >= end) {
goto out;
}
if (btrfs_key_type(&key) > BTRFS_EXTENT_DATA_KEY) {
if (btrfs_key_type(&key) > BTRFS_EXTENT_DATA_KEY ||
key.objectid != inode->i_ino) {
goto out;
}
if (recow) {
Expand Down

0 comments on commit 7261009

Please sign in to comment.