Subject: Re: Status of NEW_BUFQ_STRATEGY?
To: Perry E. Metzger <perry@piermont.com>
From: Bang Jun-Young <junyoung@netbsd.org>
List: tech-kern
Date: 11/28/2002 09:52:34
--mojUlQ0s9EVzWg2t
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Wed, Nov 27, 2002 at 12:18:07PM -0500, Perry E. Metzger wrote:
> 
> Bang Jun-Young <junyoung@netbsd.org> writes:
> > On Tue, Nov 26, 2002 at 09:36:14PM +0100, Juergen Hannken-Illjes wrote:
> > > Bang Jun-Young <junyoung@mogua.com> had a problem with softdep
> > > enabled (pending blocks/files < 0). As I have not heard
> > > anything I suppose this problem is also fixed.
> > 
> > Unfortunately, the problem still remains. 
> 
> Could you explain what the problem is (and what its consequences are?)

When I use SOFTDEP+NEW_BUFQ_STRATEGY together, I get the following
error on system shutdown quite frequently:

syncing disks... done
/u0: unmount pending error: blocks -4 files -1

As Martin said, that is not harmful, but it causes annoying fsck on
the next boot. I'm attaching a temporary workaround.

Jun-Young

-- 
Bang Jun-Young <junyoung@netbsd.org>

--mojUlQ0s9EVzWg2t
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;

--mojUlQ0s9EVzWg2t--