git: 7ef56fb04984 - main - Avoid unnecessary setting of UFS flag requesting fsck(8) be run.

From: Kirk McKusick <mckusick_at_FreeBSD.org>
Date: Mon, 10 Jan 2022 00:18:42 UTC
The branch main has been updated by mckusick:

URL: https://cgit.FreeBSD.org/src/commit/?id=7ef56fb0498461edf4bf4c482fd8bc6fa126e0e9

commit 7ef56fb0498461edf4bf4c482fd8bc6fa126e0e9
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2022-01-10 00:17:13 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2022-01-10 00:18:28 +0000

    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
---
 sys/ufs/ffs/ffs_subr.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c
index a3b7035e6a96..45fc3aa2cb25 100644
--- a/sys/ufs/ffs/ffs_subr.c
+++ b/sys/ufs/ffs/ffs_subr.c
@@ -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 */