reset balance need cow block which will insert extent item into
extent tree. If we do this before reinitting extent root, we may
encounter EEIXST.
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
return ret;
}
- ret = reset_balance(trans, fs_info);
- if (ret) {
- fprintf(stderr, "error reseting the pending balance\n");
- return ret;
- }
-
/* Ok we can allocate now, reinit the extent root */
ret = btrfs_fsck_reinit_root(trans, fs_info->extent_root, 0);
if (ret) {
btrfs_extent_post_op(trans, fs_info->extent_root);
}
- return 0;
+ ret = reset_balance(trans, fs_info);
+ if (ret)
+ fprintf(stderr, "error reseting the pending balance\n");
+
+ return ret;
}
static int recow_extent_buffer(struct btrfs_root *root, struct extent_buffer *eb)