Re: [PATCH 1/1] btrfs: Handle owner mismatch gracefully when walking up tree

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

 



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.



[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