From owner-svn-src-head@freebsd.org Tue Oct 10 16:17:04 2017 Return-Path: Delivered-To: svn-src-head@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 CC567E3641A; Tue, 10 Oct 2017 16:17:04 +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 mx1.freebsd.org (Postfix) with ESMTPS id 9959134B8; Tue, 10 Oct 2017 16:17:04 +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 v9AGH3Ag065098; Tue, 10 Oct 2017 16:17:03 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9AGH3fc065096; Tue, 10 Oct 2017 16:17:03 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201710101617.v9AGH3fc065096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Tue, 10 Oct 2017 16:17:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324499 - head/sbin/growfs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sbin/growfs X-SVN-Commit-Revision: 324499 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.23 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: Tue, 10 Oct 2017 16:17:04 -0000 Author: mckusick Date: Tue Oct 10 16:17:03 2017 New Revision: 324499 URL: https://svnweb.freebsd.org/changeset/base/324499 Log: Growfs got missed in r323923 that added a check hash to cylinder groups. This makes the needed changes to add/update cylinder group check hashes when a filesystem is expanded. Reported by: kib and Warner Losh (imp) Reviewed by: kib Tested by: Peter Holm (pho) Modified: head/sbin/growfs/Makefile head/sbin/growfs/growfs.c Modified: head/sbin/growfs/Makefile ============================================================================== --- head/sbin/growfs/Makefile Tue Oct 10 15:46:58 2017 (r324498) +++ head/sbin/growfs/Makefile Tue Oct 10 16:17:03 2017 (r324499) @@ -20,7 +20,7 @@ CFLAGS+= -DFS_DEBUG NO_WCAST_ALIGN= yes .endif -LIBADD= util +LIBADD= ufs util HAS_TESTS= SUBDIR.${MK_TESTS}+= tests Modified: head/sbin/growfs/growfs.c ============================================================================== --- head/sbin/growfs/growfs.c Tue Oct 10 15:46:58 2017 (r324498) +++ head/sbin/growfs/growfs.c Tue Oct 10 16:17:03 2017 (r324499) @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "debug.h" @@ -121,6 +122,7 @@ static void updcsloc(time_t, int, int, unsigned int); static void frag_adjust(ufs2_daddr_t, int); static void updclst(int); static void mount_reload(const struct statfs *stfs); +static void cgckhash(struct cg *); /* * Here we actually start growing the file system. We basically read the @@ -480,6 +482,7 @@ initcg(int cylno, time_t modtime, int fso, unsigned in sblock.fs_cstotal.cs_nifree += acg.cg_cs.cs_nifree; *cs = acg.cg_cs; + cgckhash(&acg); memcpy(iobuf, &acg, sblock.fs_cgsize); memset(iobuf + sblock.fs_cgsize, '\0', sblock.fs_bsize * 3 - sblock.fs_cgsize); @@ -771,6 +774,7 @@ updjcg(int cylno, time_t modtime, int fsi, int fso, un /* * Write the updated "joining" cylinder group back to disk. */ + cgckhash(&acg); wtfs(fsbtodb(&sblock, cgtod(&sblock, cylno)), (size_t)sblock.fs_cgsize, (void *)&acg, fso, Nflag); DBG_PRINT0("jcg written\n"); @@ -1738,4 +1742,18 @@ mount_reload(const struct statfs *stfs) err(9, "%s: cannot reload filesystem%s%s", stfs->f_mntonname, *errmsg != '\0' ? ": " : "", errmsg); } +} + +/* + * Calculate the check-hash of the cylinder group. + */ +static void +cgckhash(cgp) + struct cg *cgp; +{ + + if ((sblock.fs_metackhash & CK_CYLGRP) == 0) + return; + cgp->cg_ckhash = 0; + cgp->cg_ckhash = calculate_crc32c(~0L, (void *)cgp, sblock.fs_cgsize); }