diff mbox

Btrfs: check next slot type in log_one_extent()

Message ID 20121118091400.8566b5c7deeec9e5e676c54d@cl.bb4u.ne.jp (mailing list archive)
State New, archived
Headers show

Commit Message

Itaru Kitayama Nov. 18, 2012, 12:14 a.m. UTC
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>

--
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
diff mbox

Patch

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]) {