On Wed, Aug 01, 2018 at 04:08:01PM +0800, Qu Wenruo wrote:
> @@ -8949,17 +8949,26 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans,
> }
>
> if (eb == root->node) {
> - if (wc->flags[level] & BTRFS_BLOCK_FLAG_FULL_BACKREF)
> + if (wc->flags[level] & BTRFS_BLOCK_FLAG_FULL_BACKREF) {
> parent = eb->start;
> - else
> - BUG_ON(root->root_key.objectid !=
> - btrfs_header_owner(eb));
> + } else if (root->root_key.objectid != btrfs_header_owner(eb)) {
> + btrfs_err_rl(fs_info,
> + "unexpected tree owner, have %llu expect %llu",
> + btrfs_header_owner(eb),
> + root->root_key.objectid);
> + return -EINVAL;
> + }
> } else {
> - if (wc->flags[level + 1] & BTRFS_BLOCK_FLAG_FULL_BACKREF)
> + if (wc->flags[level + 1] & BTRFS_BLOCK_FLAG_FULL_BACKREF) {
> parent = path->nodes[level + 1]->start;
> - else
> - BUG_ON(root->root_key.objectid !=
> - btrfs_header_owner(path->nodes[level + 1]));
> + } else if (root->root_key.objectid !=
> + btrfs_header_owner(path->nodes[level + 1])) {
> + btrfs_err_rl(fs_info,
> + "unexpected tree owner, have %llu expect %llu",
> + btrfs_header_owner(eb),
> + root->root_key.objectid);
> + return -EINVAL;
> + }
Same code in both blocks, please merge them and add a label instead.
The suitable error code is EUCLEAN, as mentioned in the therad.