diff options
author | Chris Mason <chris.mason@oracle.com> | 2012-02-07 08:36:38 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2012-02-07 11:34:15 -0500 |
commit | 08e2cb625eb553e1317e137b279eb7547cef6ae8 (patch) | |
tree | 58178e8a1e44fcaa8a2f314cb7780d663e544afc /extent-tree.c | |
parent | f5c4c4f3b75bde259640584761fc74a395056aad (diff) |
btrfs-corrupt-block: add -E option to randomly corrupt the extent_root
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'extent-tree.c')
-rw-r--r-- | extent-tree.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/extent-tree.c b/extent-tree.c index 1f139924..01dfa3f6 100644 --- a/extent-tree.c +++ b/extent-tree.c @@ -1083,7 +1083,9 @@ static int lookup_inline_extent_backref(struct btrfs_trans_handle *trans, ptr += sizeof(struct btrfs_tree_block_info); BUG_ON(ptr > end); } else { - BUG_ON(!(flags & BTRFS_EXTENT_FLAG_DATA)); + if (!(flags & BTRFS_EXTENT_FLAG_DATA)) { + return -EIO; + } } err = -ENOENT; @@ -2120,8 +2122,6 @@ static int __free_extent(struct btrfs_trans_handle *trans, extent_slot = path->slots[0]; } } else { - btrfs_print_leaf(extent_root, path->nodes[0]); - WARN_ON(1); printk(KERN_ERR "btrfs unable to find ref byte nr %llu " "parent %llu root %llu owner %llu offset %llu\n", (unsigned long long)bytenr, @@ -2129,6 +2129,8 @@ static int __free_extent(struct btrfs_trans_handle *trans, (unsigned long long)root_objectid, (unsigned long long)owner_objectid, (unsigned long long)owner_offset); + ret = -EIO; + goto fail; } leaf = path->nodes[0]; @@ -2238,6 +2240,7 @@ static int __free_extent(struct btrfs_trans_handle *trans, mark_free); BUG_ON(ret); } +fail: btrfs_free_path(path); finish_current_insert(trans, extent_root); return ret; |