All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/1] btrfs: Handle owner mismatch gracefully when walking up tree
Date: Mon, 20 Aug 2018 15:56:19 +0200	[thread overview]
Message-ID: <20180820135619.GY24025@twin.jikos.cz> (raw)
In-Reply-To: <20180801080801.13024-1-wqu@suse.com>

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.

      parent reply	other threads:[~2018-08-20 17:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-01  8:08 [PATCH 1/1] btrfs: Handle owner mismatch gracefully when walking up tree Qu Wenruo
2018-08-01 10:08 ` Nikolay Borisov
2018-08-01 11:13   ` Qu Wenruo
2018-08-01 12:12     ` Nikolay Borisov
2018-08-01 12:19       ` Qu Wenruo
2018-08-01 12:36         ` Nikolay Borisov
2018-08-20 13:56 ` David Sterba [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180820135619.GY24025@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.