Commit 44db1216 authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba
Browse files

Btrfs: add missing extents release on file extent cluster relocation error

If we error out when finding a page at relocate_file_extent_cluster(), we
need to release the outstanding extents counter on the relocation inode,
set by the previous call to btrfs_delalloc_reserve_metadata(), otherwise
the inode's block reserve size can never decrease to zero and metadata
space is leaked. Therefore add a call to btrfs_delalloc_release_extents()
in case we can't find the target page.

Fixes: 8b62f87b

 ("Btrfs: rework outstanding_extents")
CC: # 4.19+
Signed-off-by: default avatarFilipe Manana <>
Reviewed-by: default avatarDavid Sterba <>
Signed-off-by: default avatarDavid Sterba <>
parent 431d3988
......@@ -3277,6 +3277,8 @@ static int relocate_file_extent_cluster(struct inode *inode,
if (!page) {
PAGE_SIZE, true);
PAGE_SIZE, true);
ret = -ENOMEM;
goto out;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment