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
This commit is contained in:
Kirk McKusick 2021-11-15 16:03:08 -08:00
parent f10a8d0971
commit 9e9dcac95a

View file

@ -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;