From owner-svn-src-head@freebsd.org Thu Feb 8 23:14:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6095F0E0C5; Thu, 8 Feb 2018 23:14:25 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8CB388497E; Thu, 8 Feb 2018 23:14:25 +0000 (UTC) (envelope-from mckusick@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 879271CB9C; Thu, 8 Feb 2018 23:14:25 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w18NEPV0025219; Thu, 8 Feb 2018 23:14:25 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w18NEP8F025216; Thu, 8 Feb 2018 23:14:25 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201802082314.w18NEP8F025216@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Thu, 8 Feb 2018 23:14:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329052 - head/sbin/fsck_ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sbin/fsck_ffs X-SVN-Commit-Revision: 329052 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Feb 2018 23:14:26 -0000 Author: mckusick Date: Thu Feb 8 23:14:24 2018 New Revision: 329052 URL: https://svnweb.freebsd.org/changeset/base/329052 Log: Include files missed in 329051. Modified: head/sbin/fsck_ffs/fsck.h head/sbin/fsck_ffs/globs.c head/sbin/fsck_ffs/main.c Modified: head/sbin/fsck_ffs/fsck.h ============================================================================== --- head/sbin/fsck_ffs/fsck.h Thu Feb 8 23:06:58 2018 (r329051) +++ head/sbin/fsck_ffs/fsck.h Thu Feb 8 23:14:24 2018 (r329052) @@ -315,6 +315,7 @@ extern int Zflag; /* zero empty data blocks */ extern int inoopt; /* trim out unused inodes */ extern char ckclean; /* only do work if not cleanly unmounted */ extern int cvtlevel; /* convert to newer file system format */ +extern int ckhashadd; /* check hashes to be added */ extern int bkgrdcheck; /* determine if background check is possible */ extern int bkgrdsumadj; /* whether the kernel have ability to adjust superblock summary */ extern char usedsoftdep; /* just fix soft dependency inconsistencies */ Modified: head/sbin/fsck_ffs/globs.c ============================================================================== --- head/sbin/fsck_ffs/globs.c Thu Feb 8 23:06:58 2018 (r329051) +++ head/sbin/fsck_ffs/globs.c Thu Feb 8 23:14:24 2018 (r329052) @@ -87,6 +87,7 @@ int Zflag; /* zero empty data blocks */ int inoopt; /* trim out unused inodes */ char ckclean; /* only do work if not cleanly unmounted */ int cvtlevel; /* convert to newer file system format */ +int ckhashadd; /* check hashes to be added */ int bkgrdcheck; /* determine if background check is possible */ int bkgrdsumadj; /* whether the kernel have ability to adjust superblock summary */ char usedsoftdep; /* just fix soft dependency inconsistencies */ Modified: head/sbin/fsck_ffs/main.c ============================================================================== --- head/sbin/fsck_ffs/main.c Thu Feb 8 23:06:58 2018 (r329051) +++ head/sbin/fsck_ffs/main.c Thu Feb 8 23:14:24 2018 (r329052) @@ -43,6 +43,7 @@ static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14 #include __FBSDID("$FreeBSD$"); +#define IN_RTLD /* So we pickup the P_OSREL defines */ #include #include #include @@ -440,7 +441,46 @@ checkfilesys(char *filesys) flush(fswritefd, &sblk); fsmodified = ofsmodified; } - + /* + * If the filesystem was run on an old kernel that did not + * support check hashes, clear the check-hash flags so that + * we do not try to verify them. + */ + if ((sblock.fs_flags & FS_METACKHASH) == 0) + sblock.fs_metackhash = 0; + /* + * If we are running on a kernel that can provide check hashes + * that are not yet enabled for the filesystem and we are + * running manually without the -y flag, offer to add any + * supported check hashes that are not already enabled. + */ + ckhashadd = 0; + if (preen == 0 && yflag == 0 && sblock.fs_magic != FS_UFS1_MAGIC && + fswritefd != -1 && getosreldate() >= P_OSREL_CK_CYLGRP) { + if ((sblock.fs_metackhash & CK_CYLGRP) == 0 && + reply("ADD CYLINDER GROUP CHECK-HASH PROTECTION") != 0) + ckhashadd |= CK_CYLGRP; +#ifdef notyet + if ((sblock.fs_metackhash & CK_SUPERBLOCK) == 0 && + getosreldate() >= P_OSREL_CK_SUPERBLOCK && + reply("ADD SUPERBLOCK CHECK-HASH PROTECTION") != 0) + ckhashadd |= CK_SUPERBLOCK; + if ((sblock.fs_metackhash & CK_INODE) == 0 && + getosreldate() >= P_OSREL_CK_INODE && + reply("ADD INODE CHECK-HASH PROTECTION") != 0) + ckhashadd |= CK_INODE; + if ((sblock.fs_metackhash & CK_INDIR) == 0 && + getosreldate() >= P_OSREL_CK_INDIR && + reply("ADD INDIRECT BLOCK CHECK-HASH PROTECTION") != 0) + ckhashadd |= CK_INDIR; + if ((sblock.fs_metackhash & CK_DIR) == 0 && + getosreldate() >= P_OSREL_CK_DIR && + reply("ADD DIRECTORY CHECK-HASH PROTECTION") != 0) + ckhashadd |= CK_DIR; +#endif /* notyet */ + if (ckhashadd != 0) + sblock.fs_flags |= FS_METACKHASH; + } /* * Cleared if any questions answered no. Used to decide if * the superblock should be marked clean.