Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Nikolay Borisov <nborisov@suse.com>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH 08/25] btrfs: remove BUG_ON() in find_parent_nodes()
Date: Tue, 23 Nov 2021 16:35:30 -0500	[thread overview]
Message-ID: <YZ1eouKhavsSz1p6@localhost.localdomain> (raw)
In-Reply-To: <adf7aeac-5e5c-f58b-b377-ebb6af808677@suse.com>

On Tue, Nov 23, 2021 at 10:53:07PM +0200, Nikolay Borisov wrote:
> 
> 
> On 5.11.21 г. 22:45, Josef Bacik wrote:
> > We search for an extent entry with .offset = -1, which shouldn't be a
> > thing, but corruption happens.  Add an ASSERT() for the developers,
> > return -EUCLEAN for mortals.
> > 
> > Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> > ---
> >  fs/btrfs/backref.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
> > index 12276ff08dd4..7d942f5d6443 100644
> > --- a/fs/btrfs/backref.c
> > +++ b/fs/btrfs/backref.c
> > @@ -1210,7 +1210,12 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
> >  	ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
> >  	if (ret < 0)
> >  		goto out;
> > -	BUG_ON(ret == 0);
> > +	if (ret == 0) {
> > +		/* This shouldn't happen, indicates a bug or fs corruption. */
> > +		ASSERT(ret != 0);
> 
> This can never trigger in this branch, because ret is guaranteed to be 0
> o_O?
> 

It'll always trigger right?  ASSERT(false) == BUG_ON(true), and in this case ret
== 0, so we'll BUG_ON() in this case because it's wrong.  Thanks,

Jsoef

  reply	other threads:[~2021-11-23 21:35 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05 20:45 [PATCH 00/25] btrfs: extent tree v2 prep work for global roots Josef Bacik
2021-11-05 20:45 ` [PATCH 01/25] btrfs: kill BTRFS_FS_BARRIER Josef Bacik
2021-11-18 11:50   ` David Sterba
2021-11-05 20:45 ` [PATCH 02/25] btrfs: rework async transaction committing Josef Bacik
2021-11-18 12:12   ` David Sterba
2021-11-23 17:19     ` David Sterba
2021-11-05 20:45 ` [PATCH 03/25] btrfs: pass fs_info to trace_btrfs_transaction_commit Josef Bacik
2021-11-05 20:45 ` [PATCH 04/25] btrfs: remove trans_handle->root Josef Bacik
2021-11-05 20:45 ` [PATCH 05/25] btrfs: pass the root to add_keyed_refs Josef Bacik
2021-11-05 20:45 ` [PATCH 06/25] btrfs: move comment in find_parent_nodes() Josef Bacik
2021-11-05 20:45 ` [PATCH 07/25] btrfs: remove SANITY_TESTS check form find_parent_nodes Josef Bacik
2021-11-05 20:45 ` [PATCH 08/25] btrfs: remove BUG_ON() in find_parent_nodes() Josef Bacik
2021-11-23 20:53   ` Nikolay Borisov
2021-11-23 21:35     ` Josef Bacik [this message]
2021-11-05 20:45 ` [PATCH 09/25] btrfs: remove BUG_ON(!eie) in find_parent_nodes Josef Bacik
2021-11-05 20:45 ` [PATCH 10/25] btrfs: add a btrfs_block_group_root() helper Josef Bacik
2021-11-05 20:45 ` [PATCH 11/25] btrfs: make remove_extent_backref pass the root Josef Bacik
2021-11-05 20:45 ` [PATCH 12/25] btrfs: use chunk_root in find_free_extent_update_loop Josef Bacik
2021-11-25 10:11   ` Nikolay Borisov
2021-11-05 20:45 ` [PATCH 13/25] btrfs: do not special case the extent root for switch commit roots Josef Bacik
2021-11-05 20:45 ` [PATCH 14/25] btrfs: remove unnecessary extent root check in btrfs_defrag_leaves Josef Bacik
2021-11-05 20:45 ` [PATCH 15/25] btrfs: don't use the extent root in btrfs_chunk_alloc_add_chunk_item Josef Bacik
2021-11-05 20:45 ` [PATCH 16/25] btrfs: don't use extent_root in iterate_extent_inodes Josef Bacik
2021-11-05 20:45 ` [PATCH 17/25] btrfs: don't use the extent_root in flush_space Josef Bacik
2021-11-05 20:45 ` [PATCH 18/25] btrfs: init root block_rsv at init root time Josef Bacik
2021-11-05 20:45 ` [PATCH 19/25] btrfs: stop accessing ->extent_root directly Josef Bacik
2021-11-05 20:45 ` [PATCH 20/25] btrfs: fix csum assert to check objectid of the root Josef Bacik
2021-11-05 20:45 ` [PATCH 21/25] btrfs: set BTRFS_FS_STATE_NO_CSUMS if we fail to load the csum root Josef Bacik
2021-11-25 15:05   ` Nikolay Borisov
2021-11-05 20:45 ` [PATCH 22/25] btrfs: stop accessing ->csum_root directly Josef Bacik
2021-11-05 20:45 ` [PATCH 23/25] btrfs: stop accessing ->free_space_root directly Josef Bacik
2021-11-05 20:45 ` [PATCH 24/25] btrfs: remove useless WARN_ON in record_root_in_trans Josef Bacik
2021-11-05 20:45 ` [PATCH 25/25] btrfs: track the csum, extent, and free space trees in a rb tree Josef Bacik
2021-11-18 12:22   ` David Sterba

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=YZ1eouKhavsSz1p6@localhost.localdomain \
    --to=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox