tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: very bad behavior on overquota writes



On Thu, Nov 22, 2012 at 12:46:54PM +0100, Manuel Bouyer wrote:
> Index: uvm/uvm_vnode.c
> ===================================================================
> RCS file: /cvsroot/src/sys/uvm/uvm_vnode.c,v
> retrieving revision 1.97.8.1
> diff -u -p -u -r1.97.8.1 uvm_vnode.c
> --- uvm/uvm_vnode.c   11 Jun 2012 21:25:02 -0000      1.97.8.1
> +++ uvm/uvm_vnode.c   22 Nov 2012 11:31:25 -0000
> @@ -351,7 +351,7 @@ uvm_vnp_setsize(struct vnode *vp, voff_t
>       KASSERT(oldsize != VSIZENOTSET || pgend > oldsize);
>  
>       if (oldsize > pgend) {
> -             (void) uvn_put(uobj, pgend, 0, PGO_FREE | PGO_SYNCIO);
> +             (void) uvn_put(uobj, pgend, oldsize, PGO_FREE | PGO_SYNCIO);
>               mutex_enter(uobj->vmobjlock);
>       }
>       vp->v_size = vp->v_writesize = newsize;

I found that VOP_PUTPAGES wants page-aligned boundaries, so this needs to be
changed to:
+               (void) uvn_put(uobj, pgend, round_page(oldsize),
+                   PGO_FREE | PGO_SYNCIO);


-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index