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
This commit is contained in:
parent
f8b51ca5e9
commit
4bdcc9c7d7
@ -397,11 +397,17 @@ initcg(int cylno, time_t utime, int fso, unsigned int Nflag)
|
||||
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, unsigned int Nflag)
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user