git: cf1a6ffceec4 - stable/13 - Allow forced r/w mount of UFS/FFS filesystem with a bad check hash.

From: Kirk McKusick <mckusick_at_FreeBSD.org>
Date: Wed, 17 Aug 2022 22:49:25 UTC
The branch stable/13 has been updated by mckusick:

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

commit cf1a6ffceec484f33807bab4bdb85d60b73ecff3
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2021-11-16 00:03:08 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2022-08-17 22:49:09 +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.
    
    (cherry picked from commit 9e9dcac95ad0a6c49a01619f82290fbf512fe25b)
---
 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 5592f5e59c0d..5daf8e0e607e 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -986,7 +986,7 @@ ffs_mountfs(struct vnode *odevvp, struct mount *mp, struct thread *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;