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

> 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.

It looks like uvm_vnp_setsize() tosses necessary page if newsize isn't
on page boundary.

enami.
Index: uvm_vnode.c
===================================================================
RCS file: /cvsroot/syssrc/sys/uvm/uvm_vnode.c,v
retrieving revision 1.45
diff -u -r1.45 uvm_vnode.c
--- uvm_vnode.c	2001/02/18 19:40:25	1.45
+++ uvm_vnode.c	2001/02/21 05:53:08
@@ -1015,6 +1015,7 @@
 	voff_t newsize;
 {
 	struct uvm_vnode *uvn = &vp->v_uvm;
+	voff_t pgend = round_page(newsize);
 	UVMHIST_FUNC("uvm_vnp_setsize"); UVMHIST_CALLED(ubchist);
 
 	simple_lock(&uvn->u_obj.vmobjlock);
@@ -1026,8 +1027,8 @@
 	 * toss some pages...
 	 */
 
-	if (uvn->u_size > newsize && uvn->u_size != VSIZENOTSET) {
-		(void) uvn_flush(&uvn->u_obj, newsize, 0, PGO_FREE);
+	if (uvn->u_size > pgend && uvn->u_size != VSIZENOTSET) {
+		(void) uvn_flush(&uvn->u_obj, pgend, 0, PGO_FREE);
 	}
 	uvn->u_size = newsize;
 	simple_unlock(&uvn->u_obj.vmobjlock);