aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaeho Jeong <daehojeong@google.com>2021-10-27 16:46:11 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2021-10-29 10:36:13 -0700
commitf63551b9e4938f3e0ece4a60b5fb37fbff31972d (patch)
tree0f889a58bda6cb4d23b0fa6b0cf6d1596c2003c6
parentade81b96c9e45b9e72241d732fa36db0cabc1470 (diff)
downloadf2fs-tools-f63551b9e4938f3e0ece4a60b5fb37fbff31972d.tar.gz
f2fs-tools: separate other bugs in fsck_verify
When we check other corrupted bugs in fsck, we use bug_on. So, if major bugs are already detected in fsck_verify(), fsck will false alarm that there are other bugs, even if there are no other bugs. So, let's fix this. Signed-off-by: Daeho Jeong <daehojeong@google.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fsck/fsck.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/fsck/fsck.c b/fsck/fsck.c
index bc11e07..0619519 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -3162,6 +3162,7 @@ int fsck_verify(struct f2fs_sb_info *sbi)
u32 nr_unref_nid = 0;
struct f2fs_fsck *fsck = F2FS_FSCK(sbi);
struct hard_link_node *node = NULL;
+ bool verify_failed = false;
if (c.show_file_map)
return 0;
@@ -3175,7 +3176,7 @@ int fsck_verify(struct f2fs_sb_info *sbi)
} else {
printf(" [Fail] [0x%x]\n",
fsck->chk.wp_inconsistent_zones);
- c.bug_on = 1;
+ verify_failed = true;
}
if (fsck->chk.wp_fixed && c.fix_on)
@@ -3221,8 +3222,7 @@ int fsck_verify(struct f2fs_sb_info *sbi)
printf(" [Ok..] [0x%x]\n", nr_unref_nid);
} else {
printf(" [Fail] [0x%x]\n", nr_unref_nid);
- ret = EXIT_ERR_CODE;
- c.bug_on = 1;
+ verify_failed = true;
}
printf("[FSCK] SIT valid block bitmap checking ");
@@ -3231,8 +3231,7 @@ int fsck_verify(struct f2fs_sb_info *sbi)
printf("[Ok..]\n");
} else {
printf("[Fail]\n");
- ret = EXIT_ERR_CODE;
- c.bug_on = 1;
+ verify_failed = true;
}
printf("[FSCK] Hard link checking for regular file ");
@@ -3240,8 +3239,7 @@ int fsck_verify(struct f2fs_sb_info *sbi)
printf(" [Ok..] [0x%x]\n", fsck->chk.multi_hard_link_files);
} else {
printf(" [Fail] [0x%x]\n", fsck->chk.multi_hard_link_files);
- ret = EXIT_ERR_CODE;
- c.bug_on = 1;
+ verify_failed = true;
}
printf("[FSCK] valid_block_count matching with CP ");
@@ -3249,8 +3247,7 @@ int fsck_verify(struct f2fs_sb_info *sbi)
printf(" [Ok..] [0x%x]\n", (u32)fsck->chk.valid_blk_cnt);
} else {
printf(" [Fail] [0x%x]\n", (u32)fsck->chk.valid_blk_cnt);
- ret = EXIT_ERR_CODE;
- c.bug_on = 1;
+ verify_failed = true;
}
printf("[FSCK] valid_node_count matching with CP (de lookup) ");
@@ -3258,8 +3255,7 @@ int fsck_verify(struct f2fs_sb_info *sbi)
printf(" [Ok..] [0x%x]\n", fsck->chk.valid_node_cnt);
} else {
printf(" [Fail] [0x%x]\n", fsck->chk.valid_node_cnt);
- ret = EXIT_ERR_CODE;
- c.bug_on = 1;
+ verify_failed = true;
}
printf("[FSCK] valid_node_count matching with CP (nat lookup)");
@@ -3267,8 +3263,7 @@ int fsck_verify(struct f2fs_sb_info *sbi)
printf(" [Ok..] [0x%x]\n", fsck->chk.valid_nat_entry_cnt);
} else {
printf(" [Fail] [0x%x]\n", fsck->chk.valid_nat_entry_cnt);
- ret = EXIT_ERR_CODE;
- c.bug_on = 1;
+ verify_failed = true;
}
printf("[FSCK] valid_inode_count matched with CP ");
@@ -3276,8 +3271,7 @@ int fsck_verify(struct f2fs_sb_info *sbi)
printf(" [Ok..] [0x%x]\n", fsck->chk.valid_inode_cnt);
} else {
printf(" [Fail] [0x%x]\n", fsck->chk.valid_inode_cnt);
- ret = EXIT_ERR_CODE;
- c.bug_on = 1;
+ verify_failed = true;
}
printf("[FSCK] free segment_count matched with CP ");
@@ -3286,8 +3280,7 @@ int fsck_verify(struct f2fs_sb_info *sbi)
printf(" [Ok..] [0x%x]\n", fsck->chk.sit_free_segs);
} else {
printf(" [Fail] [0x%x]\n", fsck->chk.sit_free_segs);
- ret = EXIT_ERR_CODE;
- c.bug_on = 1;
+ verify_failed = true;
}
printf("[FSCK] next block offset is free ");
@@ -3295,8 +3288,7 @@ int fsck_verify(struct f2fs_sb_info *sbi)
printf(" [Ok..]\n");
} else {
printf(" [Fail]\n");
- ret = EXIT_ERR_CODE;
- c.bug_on = 1;
+ verify_failed = true;
}
printf("[FSCK] fixing SIT types\n");
@@ -3311,6 +3303,11 @@ int fsck_verify(struct f2fs_sb_info *sbi)
ret = EXIT_ERR_CODE;
}
+ if (verify_failed) {
+ ret = EXIT_ERR_CODE;
+ c.bug_on = 1;
+ }
+
#ifndef WITH_ANDROID
if (nr_unref_nid && !c.ro) {
char ans[255] = {0};