btrfs-progs: check: error or return value of repair_root_items()
authorSu Yue <suy.fnst@cn.fujitsu.com>
Wed, 27 Sep 2017 06:34:38 +0000 (14:34 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 14 Nov 2017 14:59:00 +0000 (15:59 +0100)
Return value of repair_root_items():
<0 on error
=0 does nothing
>0 if repair is enabled, N roots are repaired;
   else N roots are corrupted.

In the repair mode, there should be no error if the return value is
bigger than 0. This fixes the test fsck/006 again.

Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-check.c

index a5cd1b1..4528b93 100644 (file)
@@ -14813,8 +14813,8 @@ int cmd_check(int argc, char **argv)
 
        if (!init_extent_tree) {
                ret = repair_root_items(info);
-               err |= !!ret;
                if (ret < 0) {
+                       err = !!ret;
                        error("failed to repair root items: %s", strerror(-ret));
                        goto close_out;
                }