diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2016-09-14 22:19:05 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-09-26 12:08:44 -0400 |
commit | 02794222c4132ac003e7281fb71f4ec1645ffc87 (patch) | |
tree | cefd45556357dba00b53425d9ab018da2d8e1a31 | |
parent | 6bdf131fac2336adb1a628f992ba32384f653a55 (diff) |
Btrfs: kill BUG_ON in run_delayed_tree_ref
In a corrupted btrfs image, we can come across this BUG_ON and
get an unreponsive system, but if we return errors instead,
its caller can handle everything gracefully by aborting the current
transaction.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/extent-tree.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 73fb91f9d797..3d3b193a396c 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -2352,7 +2352,13 @@ static int run_delayed_tree_ref(struct btrfs_trans_handle *trans, | |||
2352 | ins.type = BTRFS_EXTENT_ITEM_KEY; | 2352 | ins.type = BTRFS_EXTENT_ITEM_KEY; |
2353 | } | 2353 | } |
2354 | 2354 | ||
2355 | BUG_ON(node->ref_mod != 1); | 2355 | if (node->ref_mod != 1) { |
2356 | btrfs_err(root->fs_info, | ||
2357 | "btree block(%llu) has %d references rather than 1: action %d ref_root %llu parent %llu", | ||
2358 | node->bytenr, node->ref_mod, node->action, ref_root, | ||
2359 | parent); | ||
2360 | return -EIO; | ||
2361 | } | ||
2356 | if (node->action == BTRFS_ADD_DELAYED_REF && insert_reserved) { | 2362 | if (node->action == BTRFS_ADD_DELAYED_REF && insert_reserved) { |
2357 | BUG_ON(!extent_op || !extent_op->update_flags); | 2363 | BUG_ON(!extent_op || !extent_op->update_flags); |
2358 | ret = alloc_reserved_tree_block(trans, root, | 2364 | ret = alloc_reserved_tree_block(trans, root, |