btrfs: tree-checker: check extent buffer owner against owner rootid
[sfrench/cifs-2.6.git] / fs / btrfs / ctree.c
index 6ae1bf7ab27f5f16646531bc3b1ea084036b7f8f..1e24695ede0a1b0e3aedd9712d8f65da774225be 100644 (file)
@@ -16,6 +16,7 @@
 #include "volumes.h"
 #include "qgroup.h"
 #include "tree-mod-log.h"
+#include "tree-checker.h"
 
 static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root
                      *root, struct btrfs_path *path, int level);
@@ -1456,6 +1457,11 @@ read_block_for_search(struct btrfs_root *root, struct btrfs_path *p,
                        btrfs_release_path(p);
                        return -EIO;
                }
+               if (btrfs_check_eb_owner(tmp, root->root_key.objectid)) {
+                       free_extent_buffer(tmp);
+                       btrfs_release_path(p);
+                       return -EUCLEAN;
+               }
 
                if (unlock_up)
                        ret = -EAGAIN;