From: Yan Date: Tue, 5 Feb 2008 20:40:36 +0000 (-0500) Subject: btrfs_drop_extents: handle BTRFS_INODE_REF_KEY types X-Git-Tag: firefly_0821_release~15789^2~11^2~55^2~56^2~30^2~292 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7261009ceaee65e4683be6e474d1ea85a1b1b26c;p=firefly-linux-kernel-4.4.55.git btrfs_drop_extents: handle BTRFS_INODE_REF_KEY types It's possible "key.type == BTRFS_INODE_REF_KEY" and "key.offset >= end". Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 184bde1cfc3d..bfa4149c053d 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -507,11 +507,12 @@ next_slot: 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) {