From owner-svn-src-all@freebsd.org Thu Nov 16 21:28:16 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02391DE9C9E; Thu, 16 Nov 2017 21:28:16 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D07896B236; Thu, 16 Nov 2017 21:28:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAGLSEcU019178; Thu, 16 Nov 2017 21:28:14 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAGLSEpZ019174; Thu, 16 Nov 2017 21:28:14 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201711162128.vAGLSEpZ019174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 16 Nov 2017 21:28:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325903 - in head: sbin/fsck_ffs sbin/newfs sys/sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: sbin/fsck_ffs sbin/newfs sys/sys X-SVN-Commit-Revision: 325903 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Nov 2017 21:28:16 -0000 Author: imp Date: Thu Nov 16 21:28:14 2017 New Revision: 325903 URL: https://svnweb.freebsd.org/changeset/base/325903 Log: Only try to enable CK_CLYGRP if we're running on kernel newer than 1200046, the first version that supports this feature. If we set it, then use an old kernel, we'll break the 'contract' of having checksummed cylinder groups this flag signifies. To avoid creating something with an inconsistent state, don't turn the flag on in these cases. The first full fsck with a new kernel will turn this on. Spnsored by: Netflix Differential Revision: https://reviews.freebsd.org/D13114 Modified: head/sbin/fsck_ffs/pass5.c head/sbin/newfs/mkfs.c head/sbin/newfs/newfs.c head/sys/sys/param.h Modified: head/sbin/fsck_ffs/pass5.c ============================================================================== --- head/sbin/fsck_ffs/pass5.c Thu Nov 16 19:07:19 2017 (r325902) +++ head/sbin/fsck_ffs/pass5.c Thu Nov 16 21:28:14 2017 (r325903) @@ -35,6 +35,7 @@ static const char sccsid[] = "@(#)pass5.c 8.9 (Berkele #include __FBSDID("$FreeBSD$"); +#define IN_RTLD /* So we pickup the P_OSREL defines */ #include #include @@ -73,6 +74,7 @@ pass5(void) newcg->cg_niblk = fs->fs_ipg; if (preen == 0 && yflag == 0 && fs->fs_magic == FS_UFS2_MAGIC && fswritefd != -1 && (fs->fs_metackhash & CK_CYLGRP) == 0 && + getosreldate() >= P_OSREL_CK_CLYGRP && reply("ADD CYLINDER GROUP CHECKSUM PROTECTION") != 0) { fs->fs_metackhash |= CK_CYLGRP; rewritecg = 1; Modified: head/sbin/newfs/mkfs.c ============================================================================== --- head/sbin/newfs/mkfs.c Thu Nov 16 19:07:19 2017 (r325902) +++ head/sbin/newfs/mkfs.c Thu Nov 16 21:28:14 2017 (r325903) @@ -44,6 +44,7 @@ static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3 #include __FBSDID("$FreeBSD$"); +#define IN_RTLD /* So we pickup the P_OSREL defines */ #include #include #include @@ -495,7 +496,7 @@ restart: /* * Set flags for metadata that is being check-hashed. */ - if (Oflag > 1) + if (Oflag > 1 && getosreldate() >= P_OSREL_CK_CLYGRP) sblock.fs_metackhash = CK_CYLGRP; /* Modified: head/sbin/newfs/newfs.c ============================================================================== --- head/sbin/newfs/newfs.c Thu Nov 16 19:07:19 2017 (r325902) +++ head/sbin/newfs/newfs.c Thu Nov 16 21:28:14 2017 (r325903) @@ -398,10 +398,6 @@ main(int argc, char *argv[]) if (pp != NULL) pp->p_size *= secperblk; } - if (getosreldate() < __FreeBSD_version) { - warnx("%s is newer than the running kernel and may not be compatible", - getprogname()); - } mkfs(pp, special); ufs_disk_close(&disk); if (!jflag) Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Thu Nov 16 19:07:19 2017 (r325902) +++ head/sys/sys/param.h Thu Nov 16 21:28:14 2017 (r325903) @@ -84,6 +84,7 @@ #define P_OSREL_SHUTDOWN_ENOTCONN 1100077 #define P_OSREL_MAP_GUARD 1200035 #define P_OSREL_WRFSBASE 1200041 +#define P_OSREL_CK_CLYGRP 1200046 #define P_OSREL_VMTOTAL64 1200054 #define P_OSREL_MAJOR(x) ((x) / 100000)