On Tue, Jul 16, 2024 at 06:45:49PM +0930, Qu Wenruo wrote: > commit 1645c283a87c61f84b2bffd81f50724df959b11a upstream. > > [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. > > Cc: stable@xxxxxxxxxxxxxxx # 6.6 > Link: https://github.com/kdave/btrfs-progs/pull/622 > Reviewed-by: Josef Bacik <josef@xxxxxxxxxxxxxx> > [ Fix a conflict due to header cleanup. ] > Signed-off-by: Qu Wenruo <wqu@xxxxxxxx> > Signed-off-by: David Sterba <dsterba@xxxxxxxx> > --- > fs/btrfs/tree-checker.c | 39 +++++++++++++++++++++++++++++++++++++++ > 1 file changed, 39 insertions(+) Now queued up, thanks. greg k-h