[Btrfs-devel][PATCH]Fix for btrfs_drop_extents

Yan Zheng yanzheng at 21cn.com
Tue Feb 5 08:24:53 PST 2008


Hello,

It's possible "key.type == BTRFS_INODE_REF_KEY" and "key.offset >= end".

Regards
YZ
---
diff -r ae9d13944c09 file.c
--- a/file.c	Mon Feb 04 10:10:43 2008 -0500
+++ b/file.c	Wed Feb 06 00:12:56 2008 +0800
@@ -510,10 +510,12 @@ next_slot:
 		ret = 0;
 		btrfs_item_key_to_cpu(leaf, &key, slot);

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



More information about the Btrfs-devel mailing list