Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Nov 2018 00:58:07 +0000 (UTC)
From:      Kirk McKusick <mckusick@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r340927 - head/sys/ufs/ffs
Message-ID:  <201811260058.wAQ0w7MU099202@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mckusick
Date: Mon Nov 26 00:58:07 2018
New Revision: 340927
URL: https://svnweb.freebsd.org/changeset/base/340927

Log:
  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

Modified:
  head/sys/ufs/ffs/ffs_subr.c
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/sys/ufs/ffs/ffs_subr.c
==============================================================================
--- head/sys/ufs/ffs/ffs_subr.c	Sun Nov 25 19:37:00 2018	(r340926)
+++ head/sys/ufs/ffs/ffs_subr.c	Mon Nov 26 00:58:07 2018	(r340927)
@@ -276,6 +276,12 @@ readsuper(void *devfd, struct fs **fsp, off_t sblocklo
 	    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 "

Modified: head/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vfsops.c	Sun Nov 25 19:37:00 2018	(r340926)
+++ head/sys/ufs/ffs/ffs_vfsops.c	Mon Nov 26 00:58:07 2018	(r340927)
@@ -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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811260058.wAQ0w7MU099202>