From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Josef Bacik <josef@toxicpanda.com>,
dsterba@suse.cz, linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH v2 02/12] btrfs-progs: do not infinite loop on corrupt keys with lowmem mode
Date: Tue, 24 Aug 2021 07:34:33 +0800 [thread overview]
Message-ID: <d4ec5a5f-45c6-7d25-6137-b3206880763c@gmx.com> (raw)
In-Reply-To: <029e900b-500c-937f-322e-1d64b3259355@toxicpanda.com>
On 2021/8/24 上午2:44, Josef Bacik wrote:
> On 8/23/21 11:04 AM, David Sterba wrote:
>> On Thu, Aug 19, 2021 at 01:42:39PM +0800, Qu Wenruo wrote:
>>>
>>>
>>> On 2021/8/19 上午5:33, Josef Bacik wrote:
>>>> By enabling the lowmem checks properly I uncovered the case where test
>>>> 007 will infinite loop at the detection stage. This is because when
>>>> checking the inode item we will just btrfs_next_item(), and because we
>>>> ignore check tree block failures at read time we don't get an -EIO from
>>>> btrfs_next_leaf. Generally what check usually does is validate the
>>>> leaves/nodes as we hit them, but in this case we're not doing that.
>>>> Fix
>>>> this by checking the leaf if we move to the next one and if it fails
>>>> bail. This allows us to pass the 007 test with lowmem.
>>>
>>> Doesn't this mean btrfs_next_item() is not doing what it should do?
>>>
>>> Normally we would expect btrfs_next_item() to return -EIO other than
>>> manually checking the returned leaf.
>>
>> That's an interesting point, I think we rely on that behaviour
>> elsewhere too.
>>
>
> This is the result of how we deal with corrupt blocks. We will happily
> read corrupt blocks with check, because we expect check to do it's own
> btrfs_check_node/btrfs_check_leaf(). The problem here is that if the
> block is corrupt it's still in cache, and so btrfs_next_leaf() will
> return it because the buffer is marked uptodate.
Shouldn't we prevent the corrupted block from entering the cache?
>
> It looks like search does the extra check_block() specifically to catch
> this case, so I'll fix next_leaf to do the same thing as well. Thanks,
OK for now I think it's fine to have the extra check.
It won't cause any harm even if we solved the cache problem in the future.
Thanks,
Qu
>
> Josef
next prev parent reply other threads:[~2021-08-23 23:34 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-18 21:33 [PATCH v2 00/12] btrfs-progs: make check handle invalid bg items Josef Bacik
2021-08-18 21:33 ` [PATCH v2 01/12] btrfs-progs: fix running lowmem check tests Josef Bacik
2021-08-19 5:40 ` Qu Wenruo
2021-08-23 14:54 ` David Sterba
2021-08-18 21:33 ` [PATCH v2 02/12] btrfs-progs: do not infinite loop on corrupt keys with lowmem mode Josef Bacik
2021-08-19 5:42 ` Qu Wenruo
2021-08-23 15:04 ` David Sterba
2021-08-23 18:44 ` Josef Bacik
2021-08-23 23:34 ` Qu Wenruo [this message]
2021-08-18 21:33 ` [PATCH v2 03/12] btrfs-progs: propagate fs root errors in " Josef Bacik
2021-08-19 5:43 ` Qu Wenruo
2021-08-18 21:33 ` [PATCH v2 04/12] btrfs-progs: propagate extent item " Josef Bacik
2021-08-19 5:45 ` Qu Wenruo
2021-08-18 21:33 ` [PATCH v2 05/12] btrfs-progs: do not double add unaligned extent records Josef Bacik
2021-08-18 21:33 ` [PATCH v2 06/12] btrfs-progs: add the ability to corrupt block group items Josef Bacik
2021-08-18 21:33 ` [PATCH v2 07/12] btrfs-progs: add the ability to corrupt fields of the super block Josef Bacik
2021-08-23 14:59 ` David Sterba
2021-08-18 21:33 ` [PATCH v2 08/12] btrfs-progs: make check detect and fix invalid used for block groups Josef Bacik
2021-08-19 5:54 ` Qu Wenruo
2021-08-18 21:33 ` [PATCH v2 09/12] btrfs-progs: make check detect and fix problems with super_bytes_used Josef Bacik
2021-08-19 5:56 ` Qu Wenruo
2021-08-18 21:33 ` [PATCH v2 10/12] btrfs-progs: check btrfs_super_used in lowmem check Josef Bacik
2021-08-19 5:57 ` Qu Wenruo
2021-08-18 21:33 ` [PATCH v2 11/12] btrfs-progs: add a test image with a corrupt block group item Josef Bacik
2021-08-18 21:33 ` [PATCH v2 12/12] btrfs-progs: add a test image with an invalid super bytes_used Josef Bacik
2021-08-23 18:31 ` [PATCH v2 00/12] btrfs-progs: make check handle invalid bg items 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=d4ec5a5f-45c6-7d25-6137-b3206880763c@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=dsterba@suse.cz \
--cc=josef@toxicpanda.com \
--cc=kernel-team@fb.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).