Subject: Patch to avoid [rare/inadvised] uvm pagecleaner deadlocks over NFS
To: None <tech-net@netbsd.org>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: tech-net
Date: 09/18/2003 16:44:05
The following patch prevents uvm from deadlocking against itself when
paging out NFS pages. This is theoretically possible, but **extremely**
unlikely, unless you are running NFS over local loopback (127.0.0.1),
in which case it's very easy to trigger.

It just so happens that one of the regression-tests I usually run
before commiting changes to the networking stack, is to do copy/diffs
cycles through NFS mounts over local-loopback. I've been running with
this patch for the best part of a year; it hasn't hurt performance or
reliability, and so I would like to commit it.

Comments? (Aside from the whitespace?)  Is it worth adding a note to
the preceding commen text?



Index: sys/nfs/nfs_bio.c
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_bio.c,v
retrieving revision 1.109
diff -u -r1.109 nfs_bio.c
--- sys/nfs/nfs_bio.c	2003/09/17 09:11:12	1.109
+++ sys/nfs/nfs_bio.c	2003/09/18 21:34:16
@@ -844,7 +844,7 @@
 		/*
 		 * Ensure that the queue never grows too large.
 		 */
-
+	  if (curproc != uvm.pagedaemon_proc)
 		while (nmp->nm_bufqlen >= 2*nfs_numasync) {
 			nmp->nm_bufqwant = TRUE;
 			error = ltsleep(&nmp->nm_bufq,