summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorgavin <gavin@FreeBSD.org>2010-03-17 20:27:35 +0000
committergavin <gavin@FreeBSD.org>2010-03-17 20:27:35 +0000
commit48254a4d73e08ae0374a0f54f0b2813a746c988f (patch)
treeb01561c2ec5287c27c150a870c8a03357d16127f /sbin
parent03b9b6f6a61712bb3175ebe0ad989c117793fd41 (diff)
downloadFreeBSD-src-48254a4d73e08ae0374a0f54f0b2813a746c988f.zip
FreeBSD-src-48254a4d73e08ae0374a0f54f0b2813a746c988f.tar.gz
Merge r203835 from head:
When growing a UFS1 filesystem, we need to initialise all inodes in any new cylinder groups that are created. When the filesystem is first created, newfs always initialises the first two blocks of inodes, and then in the UFS1 case will also initialise the remaining inode blocks. The changes in growfs.c 1.23 broke the initialisation of all inodes, seemingly based on this implementation detail in newfs(8). The result was that instead of initialising all inodes, we would actually end up initialising all but the first two blocks of inodes. If the filesystem was grown into empty (all-zeros) space then the resulting filesystem was fine, however when grown onto non-zeroed space the filesystem produced would appear to have massive corruption on the first fsck after growing. A test case for this problem can be found in the PR audit trail. Fix this by once again initialising all inodes in the UFS1 case. PR: bin/115174 Submitted by: "Nate Eldredge" <nge cs.hmc.edu> Reviewed by: mjacob
Diffstat (limited to 'sbin')
-rw-r--r--sbin/growfs/growfs.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c
index bf803ac..ef055f1 100644
--- a/sbin/growfs/growfs.c
+++ b/sbin/growfs/growfs.c
@@ -445,13 +445,11 @@ initcg(int cylno, time_t utime, int fso, unsigned int Nflag)
acg.cg_cs.cs_nifree--;
}
/*
- * XXX Newfs writes out two blocks of initialized inodes
- * unconditionally. Should we check here to make sure that they
- * were actually written?
+ * For the old file system, we have to initialize all the inodes.
*/
if (sblock.fs_magic == FS_UFS1_MAGIC) {
bzero(iobuf, sblock.fs_bsize);
- for (i = 2 * sblock.fs_frag; i < sblock.fs_ipg / INOPF(&sblock);
+ for (i = 0; i < sblock.fs_ipg / INOPF(&sblock);
i += sblock.fs_frag) {
dp1 = (struct ufs1_dinode *)iobuf;
#ifdef FSIRAND
OpenPOWER on IntegriCloud