Clean up fsck_ffs error message output.

When fsck_ffs is creating a lost+found directory it must allocate
an inode and a filesystem block. If it encounters a cylinder group
with a bad check hash, it complains twice: once for the inode and
again for the filesystem block.

This change suppresses the second complaint.

Reported by:  Chuck Silvers
Tested by:    Chuck Silvers
MFC after:    1 week
Sponsored by: Netflix
This commit is contained in:
Kirk McKusick 2021-04-26 18:42:48 -07:00
parent f5ff282bc0
commit 689724cb23

View File

@ -948,6 +948,7 @@ check_cgmagic(int cg, struct bufarea *cgbp, int request_rebuild)
{
struct cg *cgp = cgbp->b_un.b_cg;
uint32_t cghash, calchash;
static int prevfailcg = -1;
/*
* Extended cylinder group checks.
@ -973,9 +974,14 @@ check_cgmagic(int cg, struct bufarea *cgbp, int request_rebuild)
cgp->cg_initediblk <= sblock.fs_ipg))) {
return (1);
}
pfatal("CYLINDER GROUP %d: INTEGRITY CHECK FAILED", cg);
if (!request_rebuild)
if (prevfailcg == cg)
return (0);
prevfailcg = cg;
pfatal("CYLINDER GROUP %d: INTEGRITY CHECK FAILED", cg);
if (!request_rebuild) {
printf("\n");
return (0);
}
if (!reply("REBUILD CYLINDER GROUP")) {
printf("YOU WILL NEED TO RERUN FSCK.\n");
rerun = 1;