aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/tree-checker.c
diff options
context:
space:
mode:
authorGravatar Qu Wenruo <wqu@suse.com> 2023-08-03 17:20:42 +0800
committerGravatar David Sterba <dsterba@suse.com> 2023-08-10 17:13:13 +0200
commit05d7ce504545f7874529701664c90814ca645c5d (patch)
tree2591aab455be246dae189bcfba92ade38ecd3389 /fs/btrfs/tree-checker.c
parentbtrfs: avoid race between qgroup tree creation and relocation (diff)
downloadlinux-05d7ce504545f7874529701664c90814ca645c5d.tar.gz
linux-05d7ce504545f7874529701664c90814ca645c5d.tar.bz2
linux-05d7ce504545f7874529701664c90814ca645c5d.zip
btrfs: exit gracefully if reloc roots don't match
[BUG] Syzbot reported a crash that an ASSERT() got triggered inside prepare_to_merge(). [CAUSE] The root cause of the triggered ASSERT() is we can have a race between quota tree creation and relocation. This leads us to create a duplicated quota tree in the btrfs_read_fs_root() path, and since it's treated as fs tree, it would have ROOT_SHAREABLE flag, causing us to create a reloc tree for it. The bug itself is fixed by a dedicated patch for it, but this already taught us the ASSERT() is not something straightforward for developers. [ENHANCEMENT] Instead of using an ASSERT(), let's handle it gracefully and output extra info about the mismatch reloc roots to help debug. Also with the above ASSERT() removed, we can trigger ASSERT(0)s inside merge_reloc_roots() later. Also replace those ASSERT(0)s with WARN_ON()s. CC: stable@vger.kernel.org # 5.15+ Reported-by: syzbot+ae97a827ae1c3336bbb4@syzkaller.appspotmail.com Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/tree-checker.c')
0 files changed, 0 insertions, 0 deletions