diff options
author | iedowse <iedowse@FreeBSD.org> | 2001-01-15 18:30:40 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2001-01-15 18:30:40 +0000 |
commit | 5cc8ff22fa0677114bfd33f769881dabb84ca4db (patch) | |
tree | 09bf1796322782a26e1cea09661ff15cfb3b988a /sbin/newfs | |
parent | 77edbf4641ec8272ace4ef23c52578a20859f337 (diff) | |
download | FreeBSD-src-5cc8ff22fa0677114bfd33f769881dabb84ca4db.zip FreeBSD-src-5cc8ff22fa0677114bfd33f769881dabb84ca4db.tar.gz |
The ffs superblock includes a 128-byte region for use by temporary
in-core pointers to summary information. An array in this region
(fs_csp) could overflow on filesystems with a very large number of
cylinder groups (~16000 on i386 with 8k blocks). When this happens,
other fields in the superblock get corrupted, and fsck refuses to
check the filesystem.
Solve this problem by replacing the fs_csp array in 'struct fs'
with a single pointer, and add padding to keep the length of the
128-byte region fixed. Update the kernel and userland utilities
to use just this single pointer.
With this change, the kernel no longer makes use of the superblock
fields 'fs_csshift' and 'fs_csmask'. Add a comment to newfs/mkfs.c
to indicate that these fields must be calculated for compatibility
with older kernels.
Reviewed by: mckusick
Diffstat (limited to 'sbin/newfs')
-rw-r--r-- | sbin/newfs/mkfs.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index 7e5ea14..4cf854b 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -633,6 +633,11 @@ next: sblock.fs_csaddr = cgdmin(&sblock, 0); sblock.fs_cssize = fragroundup(&sblock, sblock.fs_ncg * sizeof(struct csum)); + /* + * The superblock fields 'fs_csmask' and 'fs_csshift' are no + * longer used. However, we still initialise them so that the + * filesystem remains compatible with old kernels. + */ i = sblock.fs_bsize / sizeof(struct csum); sblock.fs_csmask = ~(i - 1); for (sblock.fs_csshift = 0; i > 1; i >>= 1) |