Author: mjacob Date: Mon Oct 5 01:31:16 2009 New Revision: 197763 URL: http://svn.freebsd.org/changeset/base/197763
Log: The cylinder group tag cg_initediblk needs to match the number of inodes actually initialized. In the growfs case for UFS2, no inodes were actually being initialized and the number of inodes noted as initialized was the number of inodes per group. This created a filesystem that was deemed corrupted because the inodes thus added were full of garbage. MFC after: 1 month Modified: head/sbin/growfs/growfs.c Modified: head/sbin/growfs/growfs.c ============================================================================== --- head/sbin/growfs/growfs.c Mon Oct 5 00:28:47 2009 (r197762) +++ head/sbin/growfs/growfs.c Mon Oct 5 01:31:16 2009 (r197763) @@ -397,11 +397,17 @@ initcg(int cylno, time_t utime, int fso, dupper += howmany(sblock.fs_cssize, sblock.fs_fsize); cs = &fscs[cylno]; memset(&acg, 0, sblock.fs_cgsize); + /* + * Note that we do not set cg_initediblk at all. + * In this extension of a previous filesystem + * we have no inodes initialized for the cylinder + * group at all. The first access to that cylinder + * group will do the correct initialization. + */ acg.cg_time = utime; acg.cg_magic = CG_MAGIC; acg.cg_cgx = cylno; acg.cg_niblk = sblock.fs_ipg; - acg.cg_initediblk = sblock.fs_ipg; acg.cg_ndblk = dmax - cbase; if (sblock.fs_contigsumsize > 0) acg.cg_nclusterblks = acg.cg_ndblk / sblock.fs_frag; @@ -414,7 +420,6 @@ initcg(int cylno, time_t utime, int fso, acg.cg_time = 0; acg.cg_old_niblk = acg.cg_niblk; acg.cg_niblk = 0; - acg.cg_initediblk = 0; acg.cg_old_btotoff = start; acg.cg_old_boff = acg.cg_old_btotoff + sblock.fs_old_cpg * sizeof(int32_t); @@ -2217,6 +2222,7 @@ main(int argc, char **argv) printf("Warning: %jd sector(s) cannot be allocated.\n", (intmax_t)fsbtodb(&sblock, sblock.fs_size % sblock.fs_fpg)); sblock.fs_size = sblock.fs_ncg * sblock.fs_fpg; + maxino -= sblock.fs_ipg; } /* _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"