All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liu Bo <bo.li.liu@oracle.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: error out if generic_bin_search get invalid arguments
Date: Thu, 23 Jun 2016 10:38:32 -0700	[thread overview]
Message-ID: <20160623173832.GA13924@localhost.localdomain> (raw)
In-Reply-To: <20160623085152.GU4915@twin.jikos.cz>

On Thu, Jun 23, 2016 at 10:51:52AM +0200, David Sterba wrote:
> On Wed, Jun 22, 2016 at 06:32:19PM -0700, Liu Bo wrote:
> > With btrfs-corrupt-block, one can set btree node/leaf's field, if
> > we assign a negative value to node/leaf, we can get various hangs,
> > eg. if extent_root's nritems is -2ULL, then we get stuck in
> >  btrfs_read_block_groups() because it has a while loop and
> > btrfs_search_slot() on extent_root will always return the first
> >  child.
> > 
> > This lets us know what's happening and returns a EINVAL to callers
> > instead of returning the first item.
> > 
> > Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> > ---
> >  fs/btrfs/ctree.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
> > index c49a500..915d224 100644
> > --- a/fs/btrfs/ctree.c
> > +++ b/fs/btrfs/ctree.c
> > @@ -1770,6 +1770,14 @@ static noinline int generic_bin_search(struct extent_buffer *eb,
> >  	unsigned long map_len = 0;
> >  	int err;
> >  
> > +	if (low > high) {
> > +		btrfs_err(eb->fs_info,
> > +		 "%s: low (%d) < high (%d) eb %llu owner %llu level %d",
> 
> Why is it '<' in the error message?

Err, my typo error.

Thanks,

-liubo

  reply	other threads:[~2016-06-23 17:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23  1:32 [PATCH] Btrfs: error out if generic_bin_search get invalid arguments Liu Bo
2016-06-23  8:51 ` David Sterba
2016-06-23 17:38   ` Liu Bo [this message]
2016-06-23 23:32 ` [PATCH v2] " Liu Bo
2016-07-07 12:11   ` 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=20160623173832.GA13924@localhost.localdomain \
    --to=bo.li.liu@oracle.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /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.