]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
Btrfs: add missing extents release on file extent cluster relocation error
authorFilipe Manana <fdmanana@suse.com>
Wed, 9 Oct 2019 16:43:45 +0000 (17:43 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 12 Nov 2019 17:46:59 +0000 (18:46 +0100)
commitf37ff7f5ef71f7881c061963c8bd4298753c4c5f
tree65fc8c9bb79208cb7f537780ebf778f08b04a7f7
parent97797b1c33bf9d288a8704a371b8f38bf09c92e0
Btrfs: add missing extents release on file extent cluster relocation error

BugLink: https://bugs.launchpad.net/bugs/1850456
commit 44db1216efe37bf670f8d1019cdc41658d84baf5 upstream.

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: 8b62f87bad9c ("Btrfs: rework outstanding_extents")
CC: stable@vger.kernel.org # 4.19+
Signed-off-by: Filipe Manana <fdmanana@suse.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>
Signed-off-by: Connor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
fs/btrfs/relocation.c