Skip to content

Commit a9b1fc8

Browse files
Liu Bokdave
authored andcommitted
Btrfs: fix endless loop in balancing block groups
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 <[email protected]> Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 3dc09ec commit a9b1fc8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

fs/btrfs/relocation.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4200,9 +4200,11 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
42004200
err = PTR_ERR(trans);
42014201
goto out_free;
42024202
}
4203-
err = qgroup_fix_relocated_data_extents(trans, rc);
4204-
if (err < 0) {
4205-
btrfs_abort_transaction(trans, err);
4203+
ret = qgroup_fix_relocated_data_extents(trans, rc);
4204+
if (ret < 0) {
4205+
btrfs_abort_transaction(trans, ret);
4206+
if (!err)
4207+
err = ret;
42064208
goto out_free;
42074209
}
42084210
btrfs_commit_transaction(trans, rc->extent_root);

0 commit comments

Comments
 (0)