public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: tree-checker: add type and sequence check for inline backrefs
Date: Tue, 24 Oct 2023 09:48:27 -0400	[thread overview]
Message-ID: <20231024134827.GA2811083@perftesting> (raw)
In-Reply-To: <23fbab97bd9dbce7869e858cb59d96a7238db57e.1698105469.git.wqu@suse.com>

On Tue, Oct 24, 2023 at 12:41:11PM +1030, Qu Wenruo wrote:
> [BUG]
> There is a bug report that ntfs2btrfs had a bug that it can lead to
> transaction abort and the filesystem flips to read-only.
> 
> [CAUSE]
> For inline backref items, kernel has a strict requirement for their
> ordered, they must follow the following rules:
> 
> - All btrfs_extent_inline_ref::type should be in an ascending order
> 
> - Within the same type, the items should follow a descending order by
>   their sequence number
> 
>   For EXTENT_DATA_REF type, the sequence number is result from
>   hash_extent_data_ref().
>   For other types, their sequence numbers are
>   btrfs_extent_inline_ref::offset.
> 
> Thus if there is any code not following above rules, the resulted
> inline backrefs can prevent the kernel to locate the needed inline
> backref and lead to transaction abort.
> 
> [FIX]
> Ntrfs2btrfs has already fixed the problem, and btrfs-progs has added the
> ability to detect such problems.
> 
> For kernel, let's be more noisy and be more specific about the order, so
> that the next time kernel hits such problem we would reject it in the
> first place, without leading to transaction abort.
> 
> Link: https://github.com/kdave/btrfs-progs/pull/622
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Does fsck catch this?  If not can you update it so it does?  Thanks,

Josef

  reply	other threads:[~2023-10-24 13:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24  2:11 [PATCH] btrfs: tree-checker: add type and sequence check for inline backrefs Qu Wenruo
2023-10-24 13:48 ` Josef Bacik [this message]
2023-10-24 20:36   ` Qu Wenruo
2023-10-24 19:53 ` David Sterba
2023-11-02 19:07 ` Boris Burkov
2023-11-02 20:17   ` Qu Wenruo
2023-11-02 20:19     ` David Sterba
2023-11-02 20:35     ` Boris Burkov
2023-11-02 21:05       ` Qu Wenruo
2023-11-02 21:34         ` Boris Burkov
2023-11-02 21:39           ` Qu Wenruo
2023-11-02 21:46             ` Boris Burkov
2023-11-02 21:47               ` Qu Wenruo
2023-11-03 15:04           ` David Sterba
2023-11-02 20:36 ` Josef Bacik
2023-11-02 20:49   ` Qu Wenruo
2023-11-03 13:45     ` Josef Bacik
  -- strict thread matches above, loose matches on Subject: below --
2024-07-16  9:11 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=20231024134827.GA2811083@perftesting \
    --to=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.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