Skip to content

Commit

Permalink
Btrfs: fix endless loop in balancing block groups
Browse files Browse the repository at this point in the history
Qgroup function may overwrite the saved error 'err' with 0
in case quota is not enabled, and this ends up with a
endless loop in balance because we keep going back to balance
the same block group.

It really should use 'ret' instead.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Liu Bo authored and David Sterba committed Sep 1, 2016
1 parent 3dc09ec commit a9b1fc8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions fs/btrfs/relocation.c
Original file line number Diff line number Diff line change
Expand Up @@ -4200,9 +4200,11 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
err = PTR_ERR(trans);
goto out_free;
}
err = qgroup_fix_relocated_data_extents(trans, rc);
if (err < 0) {
btrfs_abort_transaction(trans, err);
ret = qgroup_fix_relocated_data_extents(trans, rc);
if (ret < 0) {
btrfs_abort_transaction(trans, ret);
if (!err)
err = ret;
goto out_free;
}
btrfs_commit_transaction(trans, rc->extent_root);
Expand Down

0 comments on commit a9b1fc8

Please sign in to comment.