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 22:13:42
yea, I was wondering if that would start to cause problems someday.
calling pgo_flush() with a non-page-aligned address should really be
an error, since pgo_flush() needs to round differently depending on
what it's doing. for PGO_CLEANIT we want to include partial pages
on the ends, for PGO_FREE we want to exclude them, and it doesn't
much matter for PGO_DEACTIVATE. the caller ought to do the appropriate
rounding for the context so that pgo_flush() doesn't have to mess with it.
-Chuck
On Wed, Feb 21, 2001 at 02:56:07PM +0900, enami tsugutomo wrote:
> 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);