Add debugging option to always read/write cylinder groups as full

sized blocks. To enable this option, use: `sysctl -w debug.bigcgs=1'.
Add debugging option to disable background writes of cylinder
groups. To enable this option, use: `sysctl -w debug.dobkgrdwrite=0'.
These debugging options should be tried on systems that are panicing
with corrupted cylinder group maps to see if it makes the problem
go away. The set of panics in question are:

	ffs_clusteralloc: map mismatch
	ffs_nodealloccg: map corrupted
	ffs_nodealloccg: block not in map
	ffs_alloccg: map corrupted
	ffs_alloccg: block not in map
	ffs_alloccgblk: cyl groups corrupted
	ffs_alloccgblk: can't find blk in cyl
	ffs_checkblk: partially free fragment

The following panics are less likely to be related to this problem,
but might be helped by these debugging options:

	ffs_valloc: dup alloc
	ffs_blkfree: freeing free block
	ffs_blkfree: freeing free frag
	ffs_vfree: freeing free inode

If you try these options, please report whether they helped reduce your
bitmap corruption panics to Kirk McKusick at <mckusick@mckusick.com>
and to Matt Dillon <dillon@earth.backplane.com>.
This commit is contained in:
Kirk McKusick 2001-04-17 05:37:51 +00:00
parent f0f3f19f05
commit 5819ab3f12
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=75573
2 changed files with 18 additions and 1 deletions

View File

@ -604,6 +604,10 @@ breadn(struct vnode * vp, daddr_t blkno, int size,
* or in biodone() since the I/O is synchronous. We put it
* here.
*/
int dobkgrdwrite = 1;
SYSCTL_INT(_debug, OID_AUTO, dobkgrdwrite, CTLFLAG_RW, &dobkgrdwrite, 0, "");
int
bwrite(struct buf * bp)
{
@ -648,7 +652,7 @@ bwrite(struct buf * bp)
* This optimization eats a lot of memory. If we have a page
* or buffer shortfall we can't do it.
*/
if ((bp->b_xflags & BX_BKGRDWRITE) &&
if (dobkgrdwrite && (bp->b_xflags & BX_BKGRDWRITE) &&
(bp->b_flags & B_ASYNC) &&
!vm_page_count_severe() &&
!buf_dirty_count_severe()) {

View File

@ -499,6 +499,10 @@ ffs_reload(mp, cred, p)
return (0);
}
#include <sys/sysctl.h>
int bigcgs = 0;
SYSCTL_INT(_debug, OID_AUTO, bigcgs, CTLFLAG_RW, &bigcgs, 0, "");
/*
* Common code for mount and mountroot
*/
@ -701,6 +705,11 @@ ffs_mountfs(devvp, mp, p, malloctype)
maxfilesize = (u_int64_t)0x40000000 * fs->fs_bsize - 1; /* XXX */
if (fs->fs_maxfilesize > maxfilesize) /* XXX */
fs->fs_maxfilesize = maxfilesize; /* XXX */
if (bigcgs) {
if (fs->fs_sparecon[0] <= 0)
fs->fs_sparecon[0] = fs->fs_cgsize;
fs->fs_cgsize = fs->fs_bsize;
}
if (ronly == 0) {
if ((fs->fs_flags & FS_DOSOFTDEP) &&
(error = softdep_mount(devvp, mp, fs, cred)) != 0) {
@ -806,6 +815,10 @@ ffs_unmount(mp, mntflags, p)
return (error);
}
fs = ump->um_fs;
if (bigcgs) {
fs->fs_cgsize = fs->fs_sparecon[0];
fs->fs_sparecon[0] = 0;
}
if (fs->fs_ronly == 0) {
fs->fs_clean = fs->fs_flags & (FS_UNCLEAN|FS_NEEDSFSCK) ? 0 : 1;
error = ffs_sbupdate(ump, MNT_WAIT);