svn commit: r328644 - head/sys/ufs/ffs

Kirk McKusick mckusick at FreeBSD.org
Wed Jan 31 23:13:38 UTC 2018


Author: mckusick
Date: Wed Jan 31 23:13:37 2018
New Revision: 328644
URL: https://svnweb.freebsd.org/changeset/base/328644

Log:
  When reading a cylinder group, break out reporting of check hash errors
  from other types of errors so that the error is correctly reported.

Modified:
  head/sys/ufs/ffs/ffs_alloc.c

Modified: head/sys/ufs/ffs/ffs_alloc.c
==============================================================================
--- head/sys/ufs/ffs/ffs_alloc.c	Wed Jan 31 22:49:50 2018	(r328643)
+++ head/sys/ufs/ffs/ffs_alloc.c	Wed Jan 31 23:13:37 2018	(r328644)
@@ -2635,16 +2635,31 @@ ffs_getcg(fs, devvp, cg, bpp, cgpp)
 	if (error != 0)
 		return (error);
 	cgp = (struct cg *)bp->b_data;
-	if (((fs->fs_metackhash & CK_CYLGRP) != 0 &&
+	if ((fs->fs_metackhash & CK_CYLGRP) != 0 &&
 	    (bp->b_flags & B_CKHASH) != 0 &&
-	    cgp->cg_ckhash != bp->b_ckhash) ||
-	    !cg_chkmagic(cgp) || cgp->cg_cgx != cg) {
+	    cgp->cg_ckhash != bp->b_ckhash) {
 		sfs = ffs_getmntstat(devvp);
 		printf("UFS %s%s (%s) cylinder checksum failed: cg %u, cgp: "
 		    "0x%x != bp: 0x%jx\n",
 		    devvp->v_type == VCHR ? "" : "snapshot of ",
 		    sfs->f_mntfromname, sfs->f_mntonname,
 		    cg, cgp->cg_ckhash, (uintmax_t)bp->b_ckhash);
+		bp->b_flags &= ~B_CKHASH;
+		bp->b_flags |= B_INVAL | B_NOCACHE;
+		brelse(bp);
+		return (EIO);
+	}
+	if (!cg_chkmagic(cgp) || cgp->cg_cgx != cg) {
+		sfs = ffs_getmntstat(devvp);
+		printf("UFS %s%s (%s)",
+		    devvp->v_type == VCHR ? "" : "snapshot of ",
+		    sfs->f_mntfromname, sfs->f_mntonname);
+		if (!cg_chkmagic(cgp))
+			printf(" cg %u: bad magic number 0x%x should be 0x%x\n",
+			    cg, cgp->cg_magic, CG_MAGIC);
+		else
+			printf(": wrong cylinder group cg %u != cgx %u\n", cg,
+			    cgp->cg_cgx);
 		bp->b_flags &= ~B_CKHASH;
 		bp->b_flags |= B_INVAL | B_NOCACHE;
 		brelse(bp);


More information about the svn-src-all mailing list