[PATCH 4.9 092/171] Btrfs: fix removal logic of the tree mod log that leads to use-after-free issues