Subject: Re: Status of NEW_BUFQ_STRATEGY?
To: Urban Boquist <urban@boquist.net>
From: Bang Jun-Young <junyoung@mogua.com>
List: current-users
Date: 11/01/2002 17:31:46
--ew6BAiZeqk4r7MaW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Nov 01, 2002 at 09:15:38AM +0100, Urban Boquist wrote:
> enami> Urban Boquist <urban@boquist.net> writes:
> >> --- trap (number 6) --- bufq_prio_get(c07a689c,1,c0420bf0,c02332e6)
> >> at bufq_prio_get+0x5b
> 
> enami> Is this repeatable?  I have two machine with this option
> enami> enabled but it runs without panic (both uses wd).
> 
> Yup, totally repeatable on this machine. But it doesn't happen at all
> on another machine of mine. I'll try a kernel with QUEUEDEBUG.

Is it still repeatable with the latest kernel? My machine used to
suffer from a repeatable fatal error (only when softdep was enabled),
but it's gone automagically at some time between 10/20 ~ 10/31.

Attached is a workaround for a softdep problem I had. It prevents pending 
inode and block counts being negative. 

Jun-Young

-- 
Bang Jun-Young <junyoung@mogua.com>

--ew6BAiZeqk4r7MaW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="ffs_softdep.c.diff"

Index: ffs_softdep.c
===================================================================
RCS file: /cvsroot/syssrc/sys/ufs/ffs/ffs_softdep.c,v
retrieving revision 1.35
diff -u -r1.35 ffs_softdep.c
--- ffs_softdep.c	2002/09/27 15:38:04	1.35
+++ ffs_softdep.c	2002/10/29 13:34:32
@@ -35,6 +35,8 @@
 #include <sys/cdefs.h>
 __KERNEL_RCSID(0, "$NetBSD: ffs_softdep.c,v 1.35 2002/09/27 15:38:04 provos Exp $");
 
+#include "opt_bufq.h"
+
 #include <sys/param.h>
 #include <sys/buf.h>
 #include <sys/callout.h>
@@ -2350,6 +2352,12 @@
 			allerror = error;
 		ffs_blkfree(&tip, bn, fs->fs_bsize);
 		fs->fs_pendingblocks -= nblocks;
+#ifdef NEW_BUFQ_STRATEGY
+		if (fs->fs_pendingblocks < 0)
+			printf("handle_workitem_freeblocks (%d): pending "
+			    "error: blocks %d files %d\n", __LINE__,
+			    fs->fs_pendingblocks, fs->fs_pendinginodes);
+#endif
 		blocksreleased += nblocks;
 	}
 	/*
@@ -2361,6 +2369,15 @@
 		bsize = blksize(fs, &tip, i);
 		ffs_blkfree(&tip, bn, bsize);
 		fs->fs_pendingblocks -= btodb(bsize);
+#ifdef NEW_BUFQ_STRATEGY
+		if (fs->fs_pendingblocks < 0) {
+			printf("handle_workitem_freeblocks (%d): pending "
+			    "error: blocks %d files %d size %d\n", __LINE__,
+			    fs->fs_pendingblocks, fs->fs_pendinginodes,
+			    bsize);
+			fs->fs_pendingblocks = 0;
+		}
+#endif
 		blocksreleased += btodb(bsize);
 	}
 	lockmgr(&tip.i_gnode.g_glock, LK_RELEASE, NULL);
@@ -2449,6 +2466,11 @@
 		}
 		ffs_blkfree(ip, nb, fs->fs_bsize);
 		fs->fs_pendingblocks -= nblocks;
+#ifdef NEW_BUFQ_STRATEGY
+		if (fs->fs_pendingblocks < 0)
+			printf("indir_trunc: pending error: blocks %d files "
+			    "%d\n", fs->fs_pendingblocks, fs->fs_pendinginodes);
+#endif
 		*countp += nblocks;
 	}
 	bp->b_flags |= B_INVAL | B_NOCACHE;
@@ -3211,6 +3233,14 @@
 	tip.i_dev = freefile->fx_devvp->v_rdev;
 	tip.i_fs = freefile->fx_fs;
 	freefile->fx_fs->fs_pendinginodes -= 1;
+#ifdef NEW_BUFQ_STRATEGY
+	if (freefile->fx_fs->fs_pendinginodes < 0) {
+		printf("handle_workitem_freefile: pending error: blocks %d "
+		    "files %d\n", freefile->fx_fs->fs_pendingblocks,
+		    freefile->fx_fs->fs_pendinginodes);
+		freefile->fx_fs->fs_pendinginodes = 0;
+	}
+#endif
 	vp.v_data = &tip;
 	vp.v_mount = freefile->fx_devvp->v_specmountpoint;
 	tip.i_vnode = &vp;

--ew6BAiZeqk4r7MaW--