linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: Josef Bacik <josef@toxicpanda.com>, <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] btrfs: Only require sector size alignment for parent eb bytenr
Date: Wed, 12 Feb 2020 21:00:42 +0800	[thread overview]
Message-ID: <32ea7f20-0b96-66dc-fa37-4a8576562cea@suse.com> (raw)
In-Reply-To: <9d4bfc49-f914-aa2f-2809-a65a267917a4@toxicpanda.com>



On 2020/2/12 下午8:58, Josef Bacik wrote:
> On 2/12/20 12:30 AM, Qu Wenruo wrote:
>> [BUG]
>> A completely sane converted fs will cause kernel warning at balance
>> time:
>>
>> [ 1557.188633] BTRFS info (device sda7): relocating block group
>> 8162107392 flags data
>> [ 1563.358078] BTRFS info (device sda7): found 11722 extents
>> [ 1563.358277] BTRFS info (device sda7): leaf 7989321728 gen 95 total
>> ptrs 213 free space 3458 owner 2
>> [ 1563.358280]     item 0 key (7984947200 169 0) itemoff 16250
>> itemsize 33
>> [ 1563.358281]         extent refs 1 gen 90 flags 2
>> [ 1563.358282]         ref#0: tree block backref root 4
>> [ 1563.358285]     item 1 key (7985602560 169 0) itemoff 16217
>> itemsize 33
>> [ 1563.358286]         extent refs 1 gen 93 flags 258
>> [ 1563.358287]         ref#0: shared block backref parent 7985602560
>> [ 1563.358288]             (parent 7985602560 is NOT ALIGNED to
>> nodesize 16384)
>> [ 1563.358290]     item 2 key (7985635328 169 0) itemoff 16184
>> itemsize 33
>> ...
>> [ 1563.358995] BTRFS error (device sda7): eb 7989321728 invalid extent
>> inline ref type 182
>> [ 1563.358996] ------------[ cut here ]------------
>> [ 1563.359005] WARNING: CPU: 14 PID: 2930 at 0xffffffff9f231766
>>
>> Then with transaction abort, and obviously failed to balance the fs.
>>
>> [CAUSE]
>> That mentioned inline ref type 182 is completely sane, it's
>> BTRFS_SHARED_BLOCK_REF_KEY, it's some extra check making kernel to
>> believe it's invalid.
>>
>> Commit 64ecdb647ddb ("Btrfs: add one more sanity check for shared ref
>> type") introduced extra checks for backref type.
>>
>> One of the requirement is, parent bytenr must be aligned to node size,
>> which is not correct, especially for converted fs or mixed fs.
>>
>> One tree block can start at any bytenr aligned to sector size. Node size
>> should never be an alignment requirement.
>> Thus such bad check is causing above bug.
>>
>> [FIX]
>> Change the alignment requirement from node size alignment to sector size
>> alignment.
>>
>> Also, to make our lives a little easier, also output @iref when
>> btrfs_get_extent_inline_ref_type() failed, so we can locate the item
>> easier.
>>
>> Link: https://bugzilla.kernel.org/show_bug.cgi?id=205475
>> Fixes: 64ecdb647ddb ("Btrfs: add one more sanity check for shared ref
>> type")
>> Signed-off-by: Qu Wenruo <wqu@suse.com>
> 
> We aren't allowed to have nodesize != sectorsize with mixed, exactly
> because you ended up with weirdly sized holes and such.  How is convert
> ending up with this problem?  Thanks,

Chunk can starts at a bytenr which is aligned to sector size only, but
not node size aligned.

Then all its tree blocks can be unaligned to node size, while the offset
inside the chunk is still nodesize aligned.

Thanks,
Qu

> 
> Josef

  reply	other threads:[~2020-02-12 13:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-12  5:30 [PATCH] btrfs: Only require sector size alignment for parent eb bytenr Qu Wenruo
2020-02-12 12:58 ` Josef Bacik
2020-02-12 13:00   ` Qu Wenruo [this message]
2020-02-12 13:00   ` Qu Wenruo

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=32ea7f20-0b96-66dc-fa37-4a8576562cea@suse.com \
    --to=wqu@suse.com \
    --cc=josef@toxicpanda.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 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).