Subject: Re: Strange/weird '*fs' effects in -current (1.5Q till now)
To: enami tsugutomo <enami@sm.sony.co.jp>
From: Chuck Silvers <chuq@chuq.com>
List: current-users
Date: 02/20/2001 08:07:48
hi,

this change may fix the problem for write(), but we need to take care of
the case where the file is modified via mmap() as well.  further, this
change will result in a flush per syscall even if the application is doing
eg. 1-byte write() calls, which is bad.  I'm guessing a better fix will be
somewhere in the truncate path rather than the write path, but I'm not
sure what the actual bug is yet.

this is the same problem that manuel pointed out a while back, and it's
next on my list to fix.  I'll get to it in the next week unless you'd like
to continue working on it.

-Chuck


On Tue, Feb 20, 2001 at 11:19:06PM +0900, enami tsugutomo wrote:
> > >From ktrace and tcpdump output, kernel doesn't issue necessary nfs
> > write rpc before truncate.
> 
> It looks like the following diff (flush the page if it is an async i/o
> and is the very last page) fixes at least the mutt test case for me.
> 
> enami.
> 
> Index: nfs_bio.c
> ===================================================================
> RCS file: /cvsroot/syssrc/sys/nfs/nfs_bio.c,v
> retrieving revision 1.62
> diff -u -r1.62 nfs_bio.c
> --- nfs_bio.c	2001/02/18 15:52:32	1.62
> +++ nfs_bio.c	2001/02/20 14:12:13
> @@ -627,7 +627,8 @@
>  			    PGO_CLEANIT|PGO_SYNCIO);
>  			simple_unlock(&vp->v_uvm.u_obj.vmobjlock);
>  		} else if ((oldoff & ~(nmp->nm_wsize - 1)) !=
> -		    (uio->uio_offset & ~(nmp->nm_wsize - 1))) {
> +		    (uio->uio_offset & ~(nmp->nm_wsize - 1)) ||
> +		    uio->uio_resid == 0) {
>  			simple_lock(&vp->v_uvm.u_obj.vmobjlock);
>  			rv = vp->v_uvm.u_obj.pgops->pgo_flush(
>  			    &vp->v_uvm.u_obj,