Itaru Kitayama
2012-Nov-18  00:14 UTC
[PATCH] Btrfs: check next slot type in log_one_extent()
Btrfs-next fails xfstest 127 when checking length of an extent in 
log_one_extent().  Fix this by doing the item type check.
Signed-off-by: Itaru Kitayama <kitayama@cl.bb4u.ne.jp>
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 40b9efd..0c20bb4 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3207,6 +3207,11 @@ again:
                args->src = path->nodes[0];
 next_slot:
                btrfs_item_key_to_cpu(path->nodes[0], &key,
path->slots[0]);
+               if (key.objectid != btrfs_ino(inode) ||
+                       key.type != BTRFS_EXTENT_DATA_KEY) {
+                       btrfs_release_path(path);
+                       return -ENOENT;
+               }
                num_bytes = btrfs_file_extent_length(path);
                if (args->nr &&
                    args->start_slot + args->nr == path->slots[0]) {
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs"
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html