diff options
author | Wang Shilong <wangshilong1991@gmail.com> | 2014-11-26 10:58:52 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2014-12-10 15:42:52 +0100 |
commit | 1f728b1a514f85d53741d08c965bfbae17576363 (patch) | |
tree | 178efca64b269eae62d4b6034e4de8fa4476f384 /cmds-check.c | |
parent | b3375a7e8b907b7c1095da8cf373746d8d7640f4 (diff) |
Btrfs-progs, fsck: move root items repair after root rebuilding
If some critical roots are corrupt, reapr_root_items() will fail,
this is detected by fsck_tests.sh's extent rebuilding tests.
Signed-off-by: Wang Shilong <wangshilong1991@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'cmds-check.c')
-rw-r--r-- | cmds-check.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/cmds-check.c b/cmds-check.c index 45e3d216..6eea36c2 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -8522,22 +8522,6 @@ int cmd_check(int argc, char **argv) root = info->fs_root; - ret = repair_root_items(info); - if (ret < 0) - goto close_out; - if (repair) { - fprintf(stderr, "Fixed %d roots.\n", ret); - ret = 0; - } else if (ret > 0) { - fprintf(stderr, - "Found %d roots with an outdated root item.\n", - ret); - fprintf(stderr, - "Please run a filesystem check with the option --repair to fix them.\n"); - ret = 1; - goto close_out; - } - /* * repair mode will force us to commit transaction which * will make us fail to load log tree when mounting. @@ -8636,6 +8620,22 @@ int cmd_check(int argc, char **argv) if (ret) fprintf(stderr, "Errors found in extent allocation tree or chunk allocation\n"); + ret = repair_root_items(info); + if (ret < 0) + goto close_out; + if (repair) { + fprintf(stderr, "Fixed %d roots.\n", ret); + ret = 0; + } else if (ret > 0) { + fprintf(stderr, + "Found %d roots with an outdated root item.\n", + ret); + fprintf(stderr, + "Please run a filesystem check with the option --repair to fix them.\n"); + ret = 1; + goto close_out; + } + fprintf(stderr, "checking free space cache\n"); ret = check_space_cache(root); if (ret) |