[PATCH 5.4 038/434] Btrfs: fix removal logic of the tree mod log that leads to use-after-free issues