aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2018-11-26 00:58:07 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2018-11-26 00:58:07 +0000
commita02bd3e38ccefc7c2de92652ebd11d12e53efa85 (patch)
tree61bd58fd1382c3fe313111b0b678ed2dd5d7ec4d /sys
parenta0e9218c019b30a68fe137f8540a8c8da947480b (diff)
downloadsrc-a02bd3e38ccefc7c2de92652ebd11d12e53efa85.tar.gz
src-a02bd3e38ccefc7c2de92652ebd11d12e53efa85.zip
Move the check for the filesystem having been run on a kernel that
predates metadata check hashes so that it is done before deciding whether to compute a check-hash of the superblock. Reported by: Rick Macklem <rmacklem@uoguelph.ca> Sponsored by: Netflix
Notes
Notes: svn path=/head/; revision=340927
Diffstat (limited to 'sys')
-rw-r--r--sys/ufs/ffs/ffs_subr.c6
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c3
2 files changed, 6 insertions, 3 deletions
diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c
index 4efca512905a..e4dbd730b186 100644
--- a/sys/ufs/ffs/ffs_subr.c
+++ b/sys/ufs/ffs/ffs_subr.c
@@ -276,6 +276,12 @@ readsuper(void *devfd, struct fs **fsp, off_t sblockloc, int isaltsblk,
fs->fs_bsize <= MAXBSIZE &&
fs->fs_bsize >= roundup(sizeof(struct fs), DEV_BSIZE) &&
fs->fs_sbsize <= SBLOCKSIZE) {
+ /*
+ * If the filesystem has been run on a kernel without
+ * metadata check hashes, disable them.
+ */
+ if ((fs->fs_flags & FS_METACKHASH) == 0)
+ fs->fs_metackhash = 0;
if (fs->fs_ckhash != (ckhash = ffs_calc_sbhash(fs))) {
#ifdef _KERNEL
res = uprintf("Superblock check-hash failed: recorded "
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 7ecaae231f07..9670d6217e86 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -813,9 +813,6 @@ ffs_mountfs(devvp, mp, td)
if ((error = ffs_sbget(devvp, &fs, -1, M_UFSMNT, ffs_use_bread)) != 0)
goto out;
fs->fs_fmod = 0;
- /* if we ran on a kernel without metadata check hashes, disable them */
- if ((fs->fs_flags & FS_METACKHASH) == 0)
- fs->fs_metackhash = 0;
/* none of these types of check-hashes are maintained by this kernel */
fs->fs_metackhash &= ~(CK_INODE | CK_INDIR | CK_DIR);
/* no support for any undefined flags */