btrfs-progs: check: Don't do early exit if maybe_repair_root_item() can't find needed root extent
PATCH 1/1 btrfs-progs: check: Don't do early exit if maybe_repair_root_item() can't find needed root extent
The whole maybe_repair_root_item() and repair_root_items() functions are introduced to handle an ancient bug in v3.17.
However in certain extent tree corruption case, such early exit would only exit the whole check process early on, preventing user to know what's really wrong about the fs.
So this patch will allow the check to continue, since the ancient bug is no long that common.
--- check/main.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-)
check/main.c +20 -12
@@ -10306,20 +10306,28 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv) err = !!ret; errno = -ret;error ("failed to repair root items: %m" ); - goto close_out; - } -if (repair) { -fprintf (stderr,"Fixed %d roots.\n" , ret); - ret =0 ; - }else if (ret >0 ) { -fprintf (stderr, +/* +* For repair, if we can't repair root items, it's +* fatal. +* But for non-repair, it's pretty rare to hit such +* v3.17 era bug, we want to continue check. +*/ +if (repair) + goto close_out; + err |=1 ; + }else { +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, + ret); +fprintf (stderr,"Please run a filesystem check with the option --repair to fix them.\n" ); - ret =1 ; - err |= ret; - goto close_out; + ret =1 ; + err |= ret; + } } }else {fprintf (stderr,"[1/7] checking root items... skipped\n" );
Signature · 1 line
2.26.2
Quoted 11 lines · Qu Wenruo
The whole
maybe_repair_root_item()andrepair_root_items()functions are introduced to handle an ancient bug in v3.17.However in certain extent tree corruption case, such early exit would only exit the whole check process early on, preventing user to know what's really wrong about the fs.
So this patch will allow the check to continue, since the ancient bug is no long that common.
Signed-off-by Qu Wenruo <[email protected]>
Added to devel, thanks.