Linux-BTRFS Archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: dsterba@suse.cz
Cc: Josef Bacik <josef@toxicpanda.com>,
	linux-btrfs@vger.kernel.org, kernel-team@fb.com,
	lei lu <llfamsec@gmail.com>
Subject: Re: [PATCH] btrfs: make sure that WRITTEN is set on all metadata blocks
Date: Fri, 3 May 2024 07:02:53 +0930	[thread overview]
Message-ID: <0a5cb0b8-617b-4e11-beb3-8a60a2e5bffa@gmx.com> (raw)
In-Reply-To: <20240502122722.GP2585@twin.jikos.cz>



在 2024/5/2 21:57, David Sterba 写道:
> On Thu, May 02, 2024 at 07:15:36AM +0930, Qu Wenruo wrote:
>>
>>
>> 在 2024/4/29 22:33, Josef Bacik 写道:
>>> We previously would call btrfs_check_leaf() if we had the check
>>> integrity code enabled, which meant that we could only run the extended
>>> leaf checks if we had WRITTEN set on the header flags.
>>>
>>> This leaves a gap in our checking, because we could end up with
>>> corruption on disk where WRITTEN isn't set on the leaf, and then the
>>> extended leaf checks don't get run which we rely on to validate all of
>>> the item pointers to make sure we don't access memory outside of the
>>> extent buffer.
>>>
>>> However, since 732fab95abe2 ("btrfs: check-integrity: remove
>>> CONFIG_BTRFS_FS_CHECK_INTEGRITY option") we no longer call
>>> btrfs_check_leaf() from btrfs_mark_buffer_dirty(), which means we only
>>> ever call it on blocks that are being written out, and thus have WRITTEN
>>> set, or that are being read in, which should have WRITTEN set.
>>>
>>> Add checks to make sure we have WRITTEN set appropriately, and then make
>>> sure __btrfs_check_leaf() always does the item checking.  This will
>>> protect us from file systems that have been corrupted and no longer have
>>> WRITTEN set on some of the blocks.
>>>
>>> Reported-by: lei lu <llfamsec@gmail.com>
>>> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
>>
>> Reviewed-by: Qu Wenruo <wqu@suse.com>
>>
>> Is there any real world bug report on this? Or just some code reading
>> exposed this problem?
>
> There is a report.
>
Where?

I searched btrfs ML using this name, but no hit at all.

Thanks,
Qu

      reply	other threads:[~2024-05-02 21:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-29 13:03 [PATCH] btrfs: make sure that WRITTEN is set on all metadata blocks Josef Bacik
2024-04-30 20:37 ` David Sterba
2024-05-01 21:45 ` Qu Wenruo
2024-05-02 12:27   ` David Sterba
2024-05-02 21:32     ` Qu Wenruo [this message]

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=0a5cb0b8-617b-4e11-beb3-8a60a2e5bffa@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 \
    --cc=llfamsec@gmail.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).