Avoid unnecessary setting of UFS flag requesting fsck(8) be run.

When the kernel is requested to mount a filesystem with a bad superblock
check hash, it would set the flag in the superblock requesting that the
fsck(8) program be run. The flag is only written to disk as part of a
superblock update. Since the superblock always has its check hash updated
when it is written to disk, the problem for which the flag has been set
will no longer exist. Hence, it is counter-productive to set the flag
as it will just cause an unnecessary run of fsck if it ever gets written.

Sponsored by: Netflix
This commit is contained in:
Kirk McKusick 2022-01-09 16:17:13 -08:00
parent 174d86a01b
commit 7ef56fb049

View file

@ -277,11 +277,8 @@ readsuper(void *devfd, struct fs **fsp, off_t sblockloc, int isaltsblk,
if (fs->fs_ckhash != (ckhash = ffs_calc_sbhash(fs))) {
if (chkhash == STDSB_NOMSG)
return (EINTEGRITY);
if (chkhash == STDSB_NOHASHFAIL_NOMSG) {
fs->fs_flags |= FS_NEEDSFSCK;
fs->fs_fmod = 1;
if (chkhash == STDSB_NOHASHFAIL_NOMSG)
return (0);
}
#ifdef _KERNEL
res = uprintf("Superblock check-hash failed: recorded "
"check-hash 0x%x != computed check-hash 0x%x%s\n",
@ -303,8 +300,6 @@ readsuper(void *devfd, struct fs **fsp, off_t sblockloc, int isaltsblk,
if (chkhash == STDSB)
return (EINTEGRITY);
/* chkhash == STDSB_NOHASHFAIL */
fs->fs_flags |= FS_NEEDSFSCK;
fs->fs_fmod = 1;
return (0);
}
/* Have to set for old filesystems that predate this field */