linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: Christoph Anton Mitterer <calestyo@scientia.net>,
	Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: <linux-btrfs@vger.kernel.org>
Subject: Re: bad extent [5993525264384, 5993525280768), type mismatch with chunk
Date: Mon, 23 Nov 2015 09:10:40 +0800	[thread overview]
Message-ID: <56526790.6020907@cn.fujitsu.com> (raw)
In-Reply-To: <1448175373.7143.24.camel@scientia.net>



Christoph Anton Mitterer wrote on 2015/11/22 07:56 +0100:
> Hey Qu.
>
>
> On Sun, 2015-11-22 at 10:04 +0800, Qu Wenruo wrote:
>> If any of you can recompile btrfs-progs and use gdb to debug it,
>> would
>> anyone please to investigate where did the wrong_chunk_type is set?
>> It is in the function check_extent_type():
>
> Not 100% what you want... AFAIU, you just want to see whether that line
> is reached?
>
> If didn't re-compile but used the btrfs-tools-dbg package, but I guess
> that should do.
>
> In the debian version that line seems to be at:
> 4374
> 4375 /* Check if the type of extent matches with its chunk */
> 4376 static void check_extent_type(struct extent_record *rec)
> 4377 {
> ...
> 4419                         bg_type = BTRFS_BLOCK_GROUP_METADATA;
> 4420                 if (!(bg_cache->flags & bg_type))
> 4421                         rec->wrong_chunk_type = 1;
> 4422         }
> 4423 }
>
> Running:
> # gdb btrfs
> (gdb) dir /root/btrfs-tools-4.3
> Source directories searched: /root/btrfs-tools-4.3:$cdir:$cwd
> (gdb) break cmds-check.c:4421
> Breakpoint 1 at 0x41d859: file cmds-check.c, line 4421.
> (gdb) run check /dev/mapper/data-b
> Starting program: /bin/btrfs check /dev/mapper/data-b
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
>
> ... in fact reaches that breakpoint:
> Breakpoint 1, check_extent_type (rec=rec@entry=0x884290) at cmds-check.c:4423
> 4423	}

Normally you can use -dbg package, but as you experienced, a lot of 
reasons like optimization from compiler can cause such situation.

That's why I recommended to compile the package from scratch.

And if you want to compile, it's also recommended to disable unrelated 
component by disabling document(needs xmlto and ascii) and convert(needs 
a lot of ext2 related headers).
"./configure --disable-convert --disable-documentation" should do the trick.

Also, you won't want compiler to do extra optimization, so after 
configuration, you'd better edit Makefile and change optimization level 
to 0, by changing the "-O1" (o and one) to "-O0" (o and zero) of CFLAGS.

Then make, compiler will complain about the optimization level as some 
headers need it, but that's OK and won't cause anything wrong.

After make, you won't need to install the btrfs-progs, you can just use 
gdb to debug local ./btrfsck and add new breakpoints to do the trick.

Thanks,
Qu

>
> ... but the error message ("bad extent [5993525264384, 5993525280768),
> type mismatch with chunk") doesn't seem to be printed at that stage...
>
>
> If I continue, it goes for a while:
>
> Breakpoint 1, check_extent_type (rec=rec@entry=0x884290) at cmds-check.c:4423
> 4423	}
> (gdb) cont 100000
> Will ignore next 99999 crossings of breakpoint 1.  Continuing.
>
> and so on for at least several million crossings... I then removed the
> breakpoint and after a longer while the usual error messages came up.
>
>
> Does that help?
>
> Chris.
>

  reply	other threads:[~2015-11-23  1:10 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-12 21:51 bad extent [5993525264384, 5993525280768), type mismatch with chunk Christoph Anton Mitterer
2015-11-12 22:23 ` Christoph Anton Mitterer
2015-11-13  2:13 ` Qu Wenruo
2015-11-13  2:26   ` Christoph Anton Mitterer
2015-11-13  2:52     ` Qu Wenruo
2015-11-13  3:03       ` Christoph Anton Mitterer
2015-11-13  3:23         ` Qu Wenruo
2015-11-13  3:31           ` Christoph Anton Mitterer
2015-11-13  3:44           ` Christoph Anton Mitterer
2015-11-13  3:57       ` Christoph Anton Mitterer
2015-11-13  7:05         ` Duncan
2015-11-13  9:55           ` Christoph Anton Mitterer
2015-11-13 11:37             ` Christoph Anton Mitterer
     [not found]       ` <564F48FE.4000400@laposte.net>
2015-11-20 19:24         ` Christoph Anton Mitterer
2015-11-21  0:47           ` Qu Wenruo
2015-11-21  1:08             ` Lukas Pirl
2015-11-22  2:04               ` Qu Wenruo
2015-11-22  6:56                 ` Christoph Anton Mitterer
2015-11-23  1:10                   ` Qu Wenruo [this message]
2015-11-23 18:12                     ` Christoph Anton Mitterer
2015-11-24  0:46                       ` Qu Wenruo
2015-11-24  1:53                         ` Christoph Anton Mitterer
2015-11-24  2:09                           ` Qu Wenruo
2015-11-24  2:48                             ` Christoph Anton Mitterer
2015-11-24  2:54                               ` Qu Wenruo
2015-11-24  3:02                                 ` Christoph Anton Mitterer
2015-11-24  5:35                                   ` Qu Wenruo
2015-11-24 18:25                                     ` Christoph Anton Mitterer
2015-11-25  0:02                                       ` Qu Wenruo
2015-11-25  0:59                                       ` Qu Wenruo
2015-11-25  3:35                                         ` Christoph Anton Mitterer
2015-11-25  4:16                                           ` Christoph Anton Mitterer
2015-11-24 17:39                         ` David Sterba
2015-11-22 10:17                 ` Laurent Bonnaud
2015-11-23  1:00                   ` Qu Wenruo
2015-11-24 13:15                     ` Laurent Bonnaud
2015-11-24 23:46                       ` Qu Wenruo
2015-11-25  9:05                         ` Laurent Bonnaud
2015-12-03 17:13                           ` Laurent Bonnaud
2015-12-04  0:47                             ` Qu Wenruo
2015-12-11 13:22                               ` Laurent Bonnaud
2015-12-11 14:21                               ` Laurent Bonnaud
2015-12-14  0:53                                 ` Qu Wenruo
2015-12-14 12:47                                 ` Laurent Bonnaud
2015-12-15  1:16                                   ` Qu Wenruo
2015-11-24 23:53                       ` Qu Wenruo
2015-11-14  1:22 ` Qu Wenruo
2015-11-14  2:29   ` Christoph Anton Mitterer
2015-11-15  1:29     ` Qu Wenruo
2015-11-15  3:24       ` Christoph Anton Mitterer
2016-02-16  0:14 ` Ángel González
2016-02-16  1:38   ` Qu Wenruo
2016-02-16 22:21     ` Ángel González
2016-02-17  7:26       ` Qu Wenruo
2016-02-17 23:56         ` Ángel González

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=56526790.6020907@cn.fujitsu.com \
    --to=quwenruo@cn.fujitsu.com \
    --cc=calestyo@scientia.net \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.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;
as well as URLs for NNTP newsgroup(s).