]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
btrfs: use btrfs_block_group_cache_done in update_block_group
authorJosef Bacik <josef@toxicpanda.com>
Tue, 24 Sep 2019 20:50:44 +0000 (16:50 -0400)
committerSeth Forshee <seth.forshee@canonical.com>
Mon, 6 Jan 2020 13:29:16 +0000 (07:29 -0600)
commit3aa7e2a28b748e7cc51be7f61a8988cdcad80594
tree7181315ba28abe2cb6c049cde7eb4b507437c3f8
parent085ca4bf0b5fa84218ae33d1551bef2ddd96a684
btrfs: use btrfs_block_group_cache_done in update_block_group

BugLink: https://bugs.launchpad.net/bugs/1858424
commit a60adce85f4bb5c1ef8ffcebadd702cafa2f3696 upstream.

When free'ing extents in a block group we check to see if the block
group is not cached, and then cache it if we need to.  However we'll
just carry on as long as we're loading the cache.  This is problematic
because we are dirtying the block group here.  If we are fast enough we
could do a transaction commit and clear the free space cache while we're
still loading the space cache in another thread.  This truncates the
free space inode, which will keep it from loading the space cache.

Fix this by using the btrfs_block_group_cache_done helper so that we try
to load the space cache unconditionally here, which will result in the
caller waiting for the fast caching to complete and keep us from
truncating the free space inode.

CC: stable@vger.kernel.org # 4.4+
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
fs/btrfs/block-group.c