summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2020-03-04 11:18:23 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-17 10:48:49 +0200
commitd8ecdce1549abc8c8b2a1be06bf86fd6ebaef4be (patch)
tree0ea99132f8aa242b7fec9a50d080aa56b90ca1a4 /fs
parentd3a7c4b8d950d91c4b50e9d941932fe7cb438db2 (diff)
downloadlinux-stable-d8ecdce1549abc8c8b2a1be06bf86fd6ebaef4be.tar.gz
linux-stable-d8ecdce1549abc8c8b2a1be06bf86fd6ebaef4be.tar.bz2
linux-stable-d8ecdce1549abc8c8b2a1be06bf86fd6ebaef4be.zip
btrfs: drop block from cache on error in relocation
commit 8e19c9732ad1d127b5575a10f4fbcacf740500ff upstream. If we have an error while building the backref tree in relocation we'll process all the pending edges and then free the node. However if we integrated some edges into the cache we'll lose our link to those edges by simply freeing this node, which means we'll leak memory and references to any roots that we've found. Instead we need to use remove_backref_node(), which walks through all of the edges that are still linked to this node and free's them up and drops any root references we may be holding. CC: stable@vger.kernel.org # 4.9+ Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/relocation.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index a7f9aa5f05aa..d1c5cd90b182 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -1141,7 +1141,7 @@ out:
free_backref_node(cache, lower);
}
- free_backref_node(cache, node);
+ remove_backref_node(cache, node);
return ERR_PTR(err);
}
ASSERT(!node || !node->detached);