btrfs: make sure we create all new block groups
authorJosef Bacik <josef@toxicpanda.com>
Fri, 28 Sep 2018 11:18:02 +0000 (07:18 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2018 19:15:14 +0000 (11:15 -0800)
commit0ae66cf18fc52d3f3285b5090b3e4516e4fcc1ed
treef8e1c0ae89d7aef77d1ad0c26e7fb940094138e2
parenta7e3da4918b18ad8ff3848c9054425e8143a991c
btrfs: make sure we create all new block groups

commit 545e3366db823dc3342ca9d7fea803f829c9062f upstream.

Allocating new chunks modifies both the extent and chunk tree, which can
trigger new chunk allocations.  So instead of doing list_for_each_safe,
just do while (!list_empty()) so we make sure we don't exit with other
pending bg's still on our list.

CC: stable@vger.kernel.org # 4.4+
Reviewed-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Liu Bo <bo.liu@linux.alibaba.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>
fs/btrfs/extent-tree.c