All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: dsterba@suse.cz, Qu Wenruo <quwenruo@cn.fujitsu.com>,
	Vegard Nossum <vegard.nossum@oracle.com>,
	Chris Mason <clm@fb.com>, Josef Bacik <jbacik@fb.com>,
	David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: BUG: failure at fs/btrfs/ctree.h:337/btrfs_chunk_item_size()!
Date: Sat, 5 Dec 2015 14:52:54 +0800	[thread overview]
Message-ID: <566289C6.5050804@gmx.com> (raw)
In-Reply-To: <20151204131229.GG31035@suse.cz>



On 12/04/2015 09:12 PM, David Sterba wrote:
> On Fri, Dec 04, 2015 at 09:21:59AM +0800, Qu Wenruo wrote:
>>> We do have the alignment check in kernel, but it's in the early phase
>>> where we don't know if nodesize is reliable and print only a warning.
>>>
>> This can be enhanced by the following method:
>
> At minimum, we can promote the 4k alignment checks in
> btrfs_check_super_valid from a warning to an error. The blocks must be
> 4k aligned, regardless of sectorsize or nodesize.
>
>> 1) Check sectorsize first
>>      Only several sector size is valid for current btrfs:
>>      4K, 8K, 16K, 32K, 64K
>>      Just five numbers, quite easy to check.
>
> The sectorsize must be PAGE_SIZE at the moment. This will change with
> Chandan's patchset though.

PAGE_SIZE would be good enough.

>
>>      Or if anyone is going to extend supported sectorsize, we can change
>>      the check to if the number is power of 2 starting from 4K.
>>
>> 2) Check nodesize/leafsize then
>>      It should be aligned to sectorsize.
>
> This particular check is missing but is implicit because of the
> sectorsize == PAGE_SIZE restriction.

But still need to check nodesize/leafsize validation against sectorsize.
Current btrfs is already using large nodesize by default.

For example, 20K nodesize can pass 4K page size check but still wrong.

(And I'm also wrong in previous mail, it's not only aligned to 
sectorisze, but also need to be power of 2)

>
>>      And nodesize must match with leafsize.
>>      Currently, it's done out of check_super_valid(), we can integrate it.
>
> Yeah it's done, then I don't see why we should add it agian.

Just want to move it to check_super_valid(), as it's better to put 
validation check codes together, and that's why we have check_super_valid().

>
>> 3) Check all super root bytenr against *sectorsize*
>>      Yeah, not nodesize.
>>      As some old bad convert will cause metadata extent unaligned to
>>      nodesize(just before my convert rework patch), but only aligned to
>>      sectorsize.
>>      So only check alignment of sectorsize.
>
> While the real check should be against the sectorsize, at the moment I
> think it's covered by the 4k checks anyway. I understand why we can't
> use the nodesize.
>

4K is good enough for x86 family but can't find all problem for 64K page 
size like PPC64 or AArch64.

So it's still better to change the check at least to page size even we 
don't have subpage size support yet.

> So, if we do the warning -> error, we're fine for now. Some of the
> checks you suggest would be good to merge when the subpage blocksize
> patchset is merged.

Right, more accurate check is only needed after subpage patchset.

Thanks,
Qu

> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

  reply	other threads:[~2015-12-05  6:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-15 18:21 BUG: failure at fs/btrfs/ctree.h:337/btrfs_chunk_item_size()! Vegard Nossum
2015-11-30 13:48 ` David Sterba
2015-11-30 16:34   ` David Sterba
2015-11-30 22:05     ` Vegard Nossum
2015-12-01  0:50       ` Qu Wenruo
2015-12-03 17:47         ` David Sterba
2015-12-04  1:21           ` Qu Wenruo
2015-12-04 13:12             ` David Sterba
2015-12-05  6:52               ` Qu Wenruo [this message]
2015-12-03 17:59       ` 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=566289C6.5050804@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=jbacik@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo@cn.fujitsu.com \
    --cc=vegard.nossum@oracle.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 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.