We still need to do all of the accounting cleanup for pending block
groups if we abort. So set the ret to trans->aborted so if we aborted
the cleanup happens and everybody is happy.
Reviewed-by: Omar Sandoval <osandov@xxxxxx>
Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
---
fs/btrfs/extent-tree.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 91e45cb14d45..ac282eb535a8 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -10359,9 +10359,15 @@ void btrfs_create_pending_block_groups(struct btrfs_trans_handle *trans)
struct btrfs_root *extent_root = fs_info->extent_root;
struct btrfs_block_group_item item;
struct btrfs_key key;
- int ret = 0;
+ int ret;
bool can_flush_pending_bgs = trans->can_flush_pending_bgs;
+ /*
+ * If we aborted the transaction with pending bg's we need to just
+ * cleanup the list and carry on.
+ */
+ ret = trans->aborted;
+
trans->can_flush_pending_bgs = false;
while (!list_empty(&trans->new_bgs)) {
block_group = list_first_entry(&trans->new_bgs,
--
2.14.3