Regarding the subject, you can write plain 'assert', no need to spell
it exactly as it's in the code.

On Wed, Dec 16, 2020 at 11:22:10AM -0500, Josef Bacik wrote:
> A weird KASAN problem that Zygo reported

Please add the relevant part of the report to the changelog and/or link
to the report itself.

> could have been easily caught
> if we checked for basic things in our backref freeing code.  We have two
> methods of freeing a backref node
> 
> - btrfs_backref_free_node: this just is kfree() essentially.
> - btrfs_backref_drop_node: this actually unlinks the node and cleans up
>   everything and then calls btrfs_backref_free_node().
> 
> We should mostly be using btrfs_backref_drop_node(), to make sure the
> node is properly unlinked from the backref cache, and only use
> btrfs_backref_free_node() when we know the node isn't actually linked to
> the backref cache.  We made a mistake here and thus got the KASAN splat.
> Make this style of issue easier to find by adding some ASSERT()'s to
> btrfs_backref_free_node() and adjusting our deletion stuff to properly
> init the list so we can rely on list_empty() checks working properly.
> 
> Signed-off-by: Josef Bacik <jo...@toxicpanda.com>

Reply via email to