define a pager flag PGO_RECLAIM, similar to FSYNC_RECLAIM, and use it

to skip unnecessary flushing when layered file system vnodes are recycled.
this also prevents a deadlock with the dodgy LFS putpages routine.
fixes the non-LFS part of PR 36150.
This commit is contained in:
chs 2007-04-16 05:14:54 +00:00
parent 7df3bf9f10
commit aba740b225
4 changed files with 17 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: union_vnops.c,v 1.19 2007/02/04 15:03:20 chs Exp $ */
/* $NetBSD: union_vnops.c,v 1.20 2007/04/16 05:14:54 chs Exp $ */
/*
* Copyright (c) 1992, 1993, 1994, 1995
@ -72,7 +72,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.19 2007/02/04 15:03:20 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.20 2007/04/16 05:14:54 chs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -2024,6 +2024,9 @@ union_putpages(v)
ap->a_vp = OTHERVP(vp);
simple_unlock(&vp->v_interlock);
if (ap->a_flags & PGO_RECLAIM) {
return 0;
}
simple_lock(&ap->a_vp->v_interlock);
error = VCALL(ap->a_vp, VOFFSET(vop_putpages), ap);
return error;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_subr.c,v 1.286 2007/04/08 11:20:43 hannken Exp $ */
/* $NetBSD: vfs_subr.c,v 1.287 2007/04/16 05:14:54 chs Exp $ */
/*-
* Copyright (c) 1997, 1998, 2004, 2005 The NetBSD Foundation, Inc.
@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.286 2007/04/08 11:20:43 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.287 2007/04/16 05:14:54 chs Exp $");
#include "opt_inet.h"
#include "opt_ddb.h"
@ -696,7 +696,7 @@ vinvalbuf(struct vnode *vp, int flags, kauth_cred_t cred, struct lwp *l,
struct buf *bp, *nbp;
int s, error;
int flushflags = PGO_ALLPAGES | PGO_FREE | PGO_SYNCIO |
(flags & V_SAVE ? PGO_CLEANIT : 0);
(flags & V_SAVE ? PGO_CLEANIT | PGO_RECLAIM : 0);
/* XXXUBC this doesn't look at flags or slp* */
simple_lock(&vp->v_interlock);

View File

@ -1,4 +1,4 @@
/* $NetBSD: layer_vnops.c,v 1.29 2006/12/09 16:11:52 chs Exp $ */
/* $NetBSD: layer_vnops.c,v 1.30 2007/04/16 05:14:54 chs Exp $ */
/*
* Copyright (c) 1999 National Aeronautics & Space Administration
@ -67,8 +67,8 @@
*
* Ancestors:
* @(#)lofs_vnops.c 1.2 (Berkeley) 6/18/92
* $Id: layer_vnops.c,v 1.29 2006/12/09 16:11:52 chs Exp $
* $Id: layer_vnops.c,v 1.29 2006/12/09 16:11:52 chs Exp $
* $Id: layer_vnops.c,v 1.30 2007/04/16 05:14:54 chs Exp $
* $Id: layer_vnops.c,v 1.30 2007/04/16 05:14:54 chs Exp $
* ...and...
* @(#)null_vnodeops.c 1.20 92/07/07 UCLA Ficus project
*/
@ -233,7 +233,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.29 2006/12/09 16:11:52 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.30 2007/04/16 05:14:54 chs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -995,6 +995,9 @@ layer_putpages(v)
ap->a_vp = LAYERVPTOLOWERVP(vp);
simple_unlock(&vp->v_interlock);
if (ap->a_flags & PGO_RECLAIM) {
return 0;
}
simple_lock(&ap->a_vp->v_interlock);
error = VCALL(ap->a_vp, VOFFSET(vop_putpages), ap);
return error;

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_pager.h,v 1.34 2006/02/22 22:28:18 drochner Exp $ */
/* $NetBSD: uvm_pager.h,v 1.35 2007/04/16 05:14:54 chs Exp $ */
/*
*
@ -162,6 +162,7 @@ struct uvm_pagerops {
#define PGO_PASTEOF 0x400 /* allow allocation of pages past EOF */
#define PGO_NOBLOCKALLOC 0x800 /* backing block allocation is not needed */
#define PGO_NOTIMESTAMP 0x1000 /* don't mark object accessed/modified */
#define PGO_RECLAIM 0x2000 /* object is being reclaimed */
/* page we are not interested in getting */
#define PGO_DONTCARE ((struct vm_page *) -1L) /* [get only] */