git: 9e9dcac95ad0 - main - Allow forced r/w mount of UFS/FFS filesystem with a bad check hash.

From: Kirk McKusick <mckusick_at_FreeBSD.org>
Date: Tue, 16 Nov 2021 00:03:59 UTC
The branch main has been updated by mckusick:

URL: https://cgit.FreeBSD.org/src/commit/?id=9e9dcac95ad0a6c49a01619f82290fbf512fe25b

commit 9e9dcac95ad0a6c49a01619f82290fbf512fe25b
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2021-11-16 00:03:08 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2021-11-16 00:03:47 +0000

    Allow forced r/w mount of UFS/FFS filesystem with a bad check hash.
    
    Normally a UFS/FFS filesystem with a bad check hash can only be
    mounted read only. With this commit the mount(8) -f (force) option
    can be used to force a read-write mount of a UFS/FFS filesystem with
    a bad check hash. Conveniently the filesystem will proceed to
    update its on-disk superblock with a corrected check hash.
    
    Sponsored by: Netflix
---
 sys/ufs/ffs/ffs_vfsops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index bdaf4c98b090..f2ea6b666fad 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -964,7 +964,7 @@ ffs_mountfs(odevvp, mp, td)
 	}
 	/* fetch the superblock and summary information */
 	loc = STDSB;
-	if ((mp->mnt_flag & MNT_ROOTFS) != 0)
+	if ((mp->mnt_flag & (MNT_ROOTFS | MNT_FORCE)) != 0)
 		loc = STDSB_NOHASHFAIL;
 	if ((error = ffs_sbget(devvp, &fs, loc, M_UFSMNT, ffs_use_bread)) != 0)
 		goto out;