|
Filipe Manana |
3bc5cf |
From: Filipe Manana <fdmanana@suse.com>
|
|
Filipe Manana |
3bc5cf |
Date: Wed, 9 Oct 2019 17:43:45 +0100
|
|
Filipe Manana |
3bc5cf |
Git-commit: 44db1216efe37bf670f8d1019cdc41658d84baf5
|
|
Filipe Manana |
3bc5cf |
Patch-mainline: 5.4
|
|
Filipe Manana |
3bc5cf |
Subject: [PATCH] Btrfs: add missing extents release on file extent cluster
|
|
Filipe Manana |
3bc5cf |
relocation error
|
|
Filipe Manana |
3bc5cf |
References: bsc#1159483
|
|
Filipe Manana |
3bc5cf |
|
|
Filipe Manana |
3bc5cf |
If we error out when finding a page at relocate_file_extent_cluster(), we
|
|
Filipe Manana |
3bc5cf |
need to release the outstanding extents counter on the relocation inode,
|
|
Filipe Manana |
3bc5cf |
set by the previous call to btrfs_delalloc_reserve_metadata(), otherwise
|
|
Filipe Manana |
3bc5cf |
the inode's block reserve size can never decrease to zero and metadata
|
|
Filipe Manana |
3bc5cf |
space is leaked. Therefore add a call to btrfs_delalloc_release_extents()
|
|
Filipe Manana |
3bc5cf |
in case we can't find the target page.
|
|
Filipe Manana |
3bc5cf |
|
|
Filipe Manana |
3bc5cf |
Fixes: 8b62f87bad9c ("Btrfs: rework outstanding_extents")
|
|
Filipe Manana |
3bc5cf |
CC: stable@vger.kernel.org # 4.19+
|
|
Filipe Manana |
3bc5cf |
Signed-off-by: Filipe Manana <fdmanana@suse.com>
|
|
Filipe Manana |
3bc5cf |
Reviewed-by: David Sterba <dsterba@suse.com>
|
|
Filipe Manana |
3bc5cf |
Signed-off-by: David Sterba <dsterba@suse.com>
|
|
Filipe Manana |
3bc5cf |
---
|
|
Filipe Manana |
3bc5cf |
fs/btrfs/relocation.c | 2 ++
|
|
Filipe Manana |
3bc5cf |
1 file changed, 2 insertions(+)
|
|
Filipe Manana |
3bc5cf |
|
|
Filipe Manana |
3bc5cf |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
|
|
Filipe Manana |
3bc5cf |
index 94651898c559..3d51064e3619 100644
|
|
Filipe Manana |
3bc5cf |
--- a/fs/btrfs/relocation.c
|
|
Filipe Manana |
3bc5cf |
+++ b/fs/btrfs/relocation.c
|
|
Filipe Manana |
3bc5cf |
@@ -3320,6 +3320,8 @@ static int relocate_file_extent_cluster(struct inode *inode,
|
|
Filipe Manana |
3bc5cf |
if (!page) {
|
|
Filipe Manana |
3bc5cf |
btrfs_delalloc_release_metadata(BTRFS_I(inode),
|
|
Filipe Manana |
3bc5cf |
PAGE_SIZE, true);
|
|
Filipe Manana |
3bc5cf |
+ btrfs_delalloc_release_extents(BTRFS_I(inode),
|
|
Filipe Manana |
3bc5cf |
+ PAGE_SIZE, true);
|
|
Filipe Manana |
3bc5cf |
ret = -ENOMEM;
|
|
Filipe Manana |
3bc5cf |
goto out;
|
|
Filipe Manana |
3bc5cf |
}
|
|
Filipe Manana |
3bc5cf |
--
|
|
Filipe Manana |
3bc5cf |
2.16.4
|
|
Filipe Manana |
3bc5cf |
|