Subject: Re: nfs vs pagedaemon
To: None <petrov@netbsd.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 04/07/2003 22:50:16
--NextPart-20030407224137-0053000
Content-Type: Text/Plain; charset=us-ascii

> > 'everything' means you're using swap over nfs?
> 
> Yep. And root and couple other fs'.

i found the problem.
because the file offset that corresponds to the page changes
in the case of swap and we're using byte-range of the file
to track commited/uncommited, we can't do unstable writes+commit for swap.

the attached patch simply attempts stable writes in the case of pageout.
i'll commit this if no one objects.
thanks.

YAMAMOTO Takashi

--NextPart-20030407224137-0053000
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="nfs.stable.freeing.diff"

Index: nfs_bio.c
===================================================================
--- nfs_bio.c	(revision 17)
+++ nfs_bio.c	(revision 18)
@@ -1003,9 +1003,13 @@
 	    for (i = 0; i < npages; i++) {
 		    pgs[i] = uvm_pageratop((vaddr_t)bp->b_data +
 					   (i << PAGE_SHIFT));
+		    KASSERT(pgs[i]->flags & PG_BUSY);
 		    if ((pgs[i]->flags & PG_NEEDCOMMIT) == 0) {
 			    needcommit = FALSE;
 		    }
+		    if (pgs[i]->flags & (PG_RELEASED|PG_PAGEOUT)) {
+			    iomode = NFSV3WRITE_FILESYNC;
+		    }
 	    }
 	    if (!needcommit && iomode == NFSV3WRITE_UNSTABLE) {
 		    for (i = 0; i < npages; i++) {

--NextPart-20030407224137-0053000--