Subject: nfs vs pagedaemon
To: None <chuq@chuq.com>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 04/05/2003 00:45:16
--NextPart-20030405004413-0045500
Content-Type: Text/Plain; charset=us-ascii

hi,

when nfsv3 unwritten pages are putpage'ed asynchronously (ie. !PGO_SYNC),
pages will be written with UNSTABLE, marked as NEEDCOMMIT and
kept dirty (ie. !PG_CLEAN).

however, with PGO_FREE, the pages will be free'ed immediately when i/o is done.
pagedaemon actually does putpages(PGO_CLEANIT|PGO_FREE) and i think that
uncommitted pages can be free'ed.

i think attached patch solves this problem. is this correct?

thanks.

YAMAMOTO Takashi

--NextPart-20030405004413-0045500
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="nfs.redirty.diff"

Index: nfs_bio.c
===================================================================
--- nfs_bio.c	(revision 6)
+++ nfs_bio.c	(working copy)
@@ -1077,7 +1077,13 @@
 		nfs_add_tobecommitted_range(vp, off, cnt);
 		simple_lock(&uobj->vmobjlock);
 		for (i = 0; i < npages; i++) {
-			pgs[i]->flags &= ~PG_CLEAN;
+			if (pgs[i]->flags & PG_PAGEOUT) {
+				uvmexp.paging--;
+				uvm_lock_pageq();
+				uvm_pagedeactivate(pgs[i]);
+				uvm_unlock_pageq();
+			}
+			pgs[i]->flags &= ~(PG_CLEAN | PG_PAGEOUT | PG_RELEASED);
 		}
 		simple_unlock(&uobj->vmobjlock);
 		if (np->n_pushhi - np->n_pushlo > nfs_commitsize) {

--NextPart-20030405004413-0045500--