Message ID | 1416970736-26623-8-git-send-email-wangshilong1991@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Oops, sorry for sending this twice, just entered one more *.patch… > > I did send these patches a long while ago, but due to some reasons, > they were not merged, these are important fixes for fsck, without > these patches, extent tree rebuilding did not work with snapshots. > > Also, /tests/fsck-tests.sh's extent tree rebuild test could always > detect failure without these patches, unluckily, it need extra > enviroment setting, so i supposed it was always 'NOTRUN'! > > last patch fix a regression for root rebuilding, root rebuilding > should be at first, because if root(extent root eg) corrupted, > root items also won't succeed. > > patches are based on David's integration-20141125 > > Wang Shilong (3): > Btrfs-progs: fsck: deal with snapshot one by one when rebuilding > extent tree > Btrfs-progs: fsck: add ability to rebuild extent tree with snapshots > Btrfs-progs, fsck: move root items repair after root rebuilding > > cmds-check.c | 412 +++++++++++++++++++++++++++++++++++++++++++---------------- > 1 file changed, 303 insertions(+), 109 deletions(-) > > -- > 2.1.0 > Best Regards, Wang Shilong -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/cmds-check.c b/cmds-check.c index a102752..ae9005e 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -7987,22 +7987,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. @@ -8101,6 +8085,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)
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> --- cmds-check.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)