Subject: kern/18972: LFS DIROPs should take account of nbuf
To: None <gnats-bugs@gnats.netbsd.org>
From: None <yamt@mwd.biglobe.ne.jp>
List: netbsd-bugs
Date: 11/09/2002 01:24:22
>Number:         18972
>Category:       kern
>Synopsis:       LFS DIROPs should take account of nbuf
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 08 08:55:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
>Release:        NetBSD 1.6K
>Organization:

>Environment:
	
	
System: NetBSD kaeru 1.6K NetBSD 1.6K (build.kaeru) #170: Sat Nov 9 00:41:22 JST 2002 takashi@kaeru:/usr/home/takashi/work/kernel/build.kaeru i386
Architecture: i386
Machine: i386
>Description:
	LFS doesn't care about nbuf when processing inodes with IN_ADIROP.
	so buf starvation occurs with many DIROPs and the system locks up.
	
>How-To-Repeat:
	set kern.maxvnodes high value and set nbuf low value.
	then do many DIROPs. (eg. create/remove large directory trees.)
>Fix:
	I don't think following patch is so correct,
	but it makes my pc less unstable.

Index: lfs.h
===================================================================
RCS file: /cvs/NetBSD/syssrc/sys/ufs/lfs/lfs.h,v
retrieving revision 1.41
diff -u -p -r1.41 lfs.h
--- lfs.h	2002/07/06 01:30:11	1.41
+++ lfs.h	2002/11/08 16:15:01
@@ -92,7 +92,7 @@
 #define BW_CLEAN	1
 #define MIN_FREE_SEGS	2
 #define LFS_MAX_ACTIVE	10
-#define LFS_MAXDIROP	(desiredvnodes >> 2)
+#define LFS_MAXDIROP	MIN(desiredvnodes >> 2, nbuf >> 2)
 #ifndef LFS_ATIME_IFILE
 # define LFS_ATIME_IFILE 0
 #endif
>Release-Note:
>Audit-Trail:
>Unformatted: