summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWang Shilong <wangsl.fnst@cn.fujitsu.com>2014-03-06 13:53:57 +0800
committerChris Mason <clm@fb.com>2014-03-21 06:23:35 -0700
commit1c1e57eb8caaadacdd3db5ee263cffb8dc90df8f (patch)
treee96785e2140c479a1387ce6117352487cf010f18
parentbedef66c0b8e1ded5aad6366b648f72d09e080d2 (diff)
Btrfs-progs: fsck: reset balance after reiniting extent root
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>
-rw-r--r--cmds-check.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/cmds-check.c b/cmds-check.c
index 3cf59b61..8a3f2cd6 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -6253,12 +6253,6 @@ static int reinit_extent_tree(struct btrfs_trans_handle *trans,
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) {
@@ -6293,7 +6287,11 @@ static int reinit_extent_tree(struct btrfs_trans_handle *trans,
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)