[PATCH] Btrfs: check next slot type in log_one_extent()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>

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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux