All of lore.kernel.org
 help / color / mirror / Atom feed
From: damenly.su@gmail.com
To: linux-btrfs@vger.kernel.org
Cc: Damenly_Su@gmx.com
Subject: [PATCH 1/2] btrfs-progs: block group: do not exclude bytenr adjacent to block group
Date: Mon, 18 Nov 2019 13:53:34 +0800	[thread overview]
Message-ID: <20191118055335.9927-1-Damenly_Su@gmx.com> (raw)

From: Su Yue <Damenly_Su@gmx.com>

While checking the image provided by the reporter, the btrfsck aborts:
======================================================================
Opening filesystem to check...
extent_io.c:158: insert_state: BUG_ON `end < start` triggered, value 1
btrfs check(+0xa3fa8)[0x5614c14c7fa8]
btrfs check(+0xa4046)[0x5614c14c8046]
btrfs check(+0xa45f1)[0x5614c14c85f1]
btrfs check(set_extent_bits+0x83)[0x5614c14c8c63]
btrfs check(+0xbfb90)[0x5614c14e3b90]
btrfs check(exclude_super_stripes+0x1fc)[0x5614c14e3de9]
btrfs check(+0xbd85d)[0x5614c14e185d]
btrfs check(btrfs_read_block_groups+0xd3)[0x5614c14e19f5]
btrfs check(btrfs_setup_all_roots+0x454)[0x5614c14d7740]
btrfs check(+0xb4219)[0x5614c14d8219]
btrfs check(open_ctree_fs_info+0x177)[0x5614c14d8415]
btrfs check(+0x693dd)[0x5614c148d3dd]
btrfs check(+0x14dc7)[0x5614c1438dc7]
btrfs check(main+0x126)[0x5614c1439713]
/usr/lib/libc.so.6(__libc_start_main+0xf3)[0x7fe3f1ecf153]
btrfs check(_start+0x2e)[0x5614c1438cce]
[1]    6196 abort (core dumped)
======================================================================

It's excluding super stripes from one block group, the bytenr equals
block group's start + len, so the @num_bytes is 0. Then
add_exclude_extent() calculates the @end is less than the @start
which trigers the abort.

Anyway, the logical bytenr should not be excluded if the block group's
start + len equals it, because it's not belong to the block group.

Link: https://github.com/kdave/btrfs-progs/issues/210
Signed-off-by: Su Yue <Damenly_Su@gmx.com>
---
 extent-tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/extent-tree.c b/extent-tree.c
index f690ae999f37..848fb72f90a4 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -3630,7 +3630,7 @@ int exclude_super_stripes(struct btrfs_fs_info *fs_info,
 		while (nr--) {
 			u64 start, len;
 
-			if (logical[nr] > cache->key.objectid +
+			if (logical[nr] >= cache->key.objectid +
 			    cache->key.offset)
 				continue;
 
-- 
2.23.0


             reply	other threads:[~2019-11-18  5:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18  5:53 damenly.su [this message]
2019-11-18  5:53 ` [PATCH 2/2] btrfs-progs: fuzz-tests: add image trigers abort of open_ctree() damenly.su
2019-11-20  6:51 ` [PATCH 1/2] btrfs-progs: block group: do not exclude bytenr adjacent to block group Su Yue

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=20191118055335.9927-1-Damenly_Su@gmx.com \
    --to=damenly.su@gmail.com \
    --cc=Damenly_Su@gmx.com \
    --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.