diff mbox series

[1/2] btrfs-progs: block group: do not exclude bytenr adjacent to block group

Message ID 20191118055335.9927-1-Damenly_Su@gmx.com (mailing list archive)
State New, archived
Headers show
Series [1/2] btrfs-progs: block group: do not exclude bytenr adjacent to block group | expand

Commit Message

Su Yue Nov. 18, 2019, 5:53 a.m. UTC
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(-)

Comments

Su Yue Nov. 20, 2019, 6:51 a.m. UTC | #1
Drop those too, will send new version fixed by another method.



On 2019/11/18 at 13:53, damenly.su@gmail.com wrote:

> 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
diff mbox series

Patch

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;