btrfs: clear DEAD_RELOC_TREE before dropping the reloc root
authorJosef Bacik <josef@toxicpanda.com>
Fri, 13 Mar 2020 15:44:46 +0000 (11:44 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 23 Mar 2020 16:01:58 +0000 (17:01 +0100)
commitf28de8d8fd376ba57aaed53cdc1a0ba2238e8ebf
tree001c226f54ef3310d71b4dc011ef442dcd6ecc4f
parent1a0afa0ecfc4dbc8d7583d03cafd3f68f781df0c
btrfs: clear DEAD_RELOC_TREE before dropping the reloc root

The DEAD_RELOC_TREE flag is in place in order to avoid a use after free
in init_reloc_root, tracking the presence of reloc_root.  However adding
the explicit tree references in previous patches makes the use after
free impossible because at this point we no longer have a reloc_control
set on the fs_info and thus cannot enter the function.

So move this to be coupled with clearing the root->reloc_root so we're
consistent with all other operations of the reloc root.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ update changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/relocation.c