Make VOP_RECLAIM do the last unlock of the vnode.

VOP_RECLAIM naturally has exclusive access to the vnode, so having it
locked on entry is not strictly necessary -- but it means if there
are any final operations that must be done on the vnode, such as
ffs_update, requiring exclusive access to it, we can now kassert that
the vnode is locked in those operations.

We can't just have the caller release the last lock because some file
systems don't use genfs_lock, and require the vnode to remain valid
for VOP_UNLOCK to work, notably unionfs.
This commit is contained in:
riastradh 2017-05-26 14:20:59 +00:00
parent 4629a84de8
commit 7f7aad09bd
33 changed files with 158 additions and 96 deletions

View File

@ -5537,7 +5537,7 @@ zfs_netbsd_inactive(void *v)
static int
zfs_netbsd_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
@ -5546,6 +5546,7 @@ zfs_netbsd_reclaim(void *v)
int error;
KASSERT(vp != NULL);
VOP_UNLOCK(vp);
zp = VTOZ(vp);
KASSERT(zp != NULL);
zfsvfs = zp->z_zfsvfs;

View File

@ -1,4 +1,4 @@
/* $NetBSD: coda_vnops.c,v 1.105 2017/04/26 03:02:48 riastradh Exp $ */
/* $NetBSD: coda_vnops.c,v 1.106 2017/05/26 14:21:00 riastradh Exp $ */
/*
*
@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.105 2017/04/26 03:02:48 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.106 2017/05/26 14:21:00 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1632,12 +1632,14 @@ int
coda_reclaim(void *v)
{
/* true args */
struct vop_reclaim_args *ap = v;
struct vop_reclaim_v2_args *ap = v;
vnode_t *vp = ap->a_vp;
struct cnode *cp = VTOC(vp);
/* upcall decl */
/* locals */
VOP_UNLOCK(vp);
/*
* Forced unmount/flush will let vnodes with non zero use be destroyed!
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: advnops.c,v 1.49 2017/04/11 14:24:59 riastradh Exp $ */
/* $NetBSD: advnops.c,v 1.50 2017/05/26 14:21:00 riastradh Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.49 2017/04/11 14:24:59 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.50 2017/05/26 14:21:00 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -866,12 +866,14 @@ adosfs_inactive(void *v)
int
adosfs_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *sp = v;
struct vnode *vp;
struct anode *ap;
VOP_UNLOCK(sp->a_vp);
#ifdef ADOSFS_DIAGNOSTIC
printf("(reclaim 0)");
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd9660_node.c,v 1.36 2017/04/11 14:24:59 riastradh Exp $ */
/* $NetBSD: cd9660_node.c,v 1.37 2017/05/26 14:21:00 riastradh Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1994
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cd9660_node.c,v 1.36 2017/04/11 14:24:59 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: cd9660_node.c,v 1.37 2017/05/26 14:21:00 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -125,12 +125,14 @@ cd9660_inactive(void *v)
int
cd9660_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
struct lwp *a_l;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
VOP_UNLOCK(vp);
if (prtactive && vp->v_usecount > 1)
vprint("cd9660_reclaim: pushing active", vp);
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: efs_vnops.c,v 1.37 2017/04/11 14:24:59 riastradh Exp $ */
/* $NetBSD: efs_vnops.c,v 1.38 2017/05/26 14:21:00 riastradh Exp $ */
/*
* Copyright (c) 2006 Stephen M. Rumble <rumble@ephemeral.org>
@ -17,7 +17,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: efs_vnops.c,v 1.37 2017/04/11 14:24:59 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: efs_vnops.c,v 1.38 2017/05/26 14:21:00 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -575,13 +575,15 @@ efs_inactive(void *v)
static int
efs_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
const struct vnodeop_desc *a_desc;
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct efs_inode *eip = EFS_VTOI(vp);
VOP_UNLOCK(vp);
genfs_node_destroy(vp);
pool_put(&efs_inode_pool, eip);
vp->v_data = NULL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: filecore_node.c,v 1.29 2017/04/11 14:24:59 riastradh Exp $ */
/* $NetBSD: filecore_node.c,v 1.30 2017/05/26 14:21:00 riastradh Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1994
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: filecore_node.c,v 1.29 2017/04/11 14:24:59 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: filecore_node.c,v 1.30 2017/05/26 14:21:00 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -237,13 +237,15 @@ filecore_inactive(void *v)
int
filecore_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
struct lwp *a_l;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct filecore_node *ip = VTOI(vp);
VOP_UNLOCK(vp);
if (prtactive && vp->v_usecount > 1)
vprint("filecore_reclaim: pushing active", vp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hfs_vnops.c,v 1.33 2016/08/20 12:37:07 hannken Exp $ */
/* $NetBSD: hfs_vnops.c,v 1.34 2017/05/26 14:21:00 riastradh Exp $ */
/*-
* Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@ -101,7 +101,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hfs_vnops.c,v 1.33 2016/08/20 12:37:07 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: hfs_vnops.c,v 1.34 2017/05/26 14:21:00 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_ipsec.h"
@ -1019,12 +1019,14 @@ hfs_vop_readlink(void *v) {
int
hfs_vop_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp;
struct hfsnode *hp;
VOP_UNLOCK(ap->a_vp);
DPRINTF(("VOP = hfs_vop_reclaim()\n"));
vp = ap->a_vp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: msdosfs_denode.c,v 1.54 2017/04/11 14:24:59 riastradh Exp $ */
/* $NetBSD: msdosfs_denode.c,v 1.55 2017/05/26 14:21:00 riastradh Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.54 2017/04/11 14:24:59 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.55 2017/05/26 14:21:00 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -532,12 +532,14 @@ deextend(struct denode *dep, u_long length, kauth_cred_t cred)
int
msdosfs_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct denode *dep = VTODE(vp);
VOP_UNLOCK(vp);
#ifdef MSDOSFS_DEBUG
printf("msdosfs_reclaim(): dep %p, file %s, refcnt %ld\n",
dep, dep->de_Name, dep->de_refcnt);

View File

@ -1,4 +1,4 @@
/* $NetBSD: nilfs_vnops.c,v 1.35 2017/04/26 03:02:48 riastradh Exp $ */
/* $NetBSD: nilfs_vnops.c,v 1.36 2017/05/26 14:21:00 riastradh Exp $ */
/*
* Copyright (c) 2008, 2009 Reinoud Zandijk
@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifndef lint
__KERNEL_RCSID(0, "$NetBSD: nilfs_vnops.c,v 1.35 2017/04/26 03:02:48 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: nilfs_vnops.c,v 1.36 2017/05/26 14:21:00 riastradh Exp $");
#endif /* not lint */
@ -99,12 +99,14 @@ nilfs_inactive(void *v)
int
nilfs_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct nilfs_node *nilfs_node = VTOI(vp);
VOP_UNLOCK(vp);
DPRINTF(NODE, ("nilfs_reclaim called for node %p\n", nilfs_node));
if (prtactive && vp->v_usecount > 1)
vprint("nilfs_reclaim(): pushing active", vp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntfs_vnops.c,v 1.61 2017/04/11 14:24:59 riastradh Exp $ */
/* $NetBSD: ntfs_vnops.c,v 1.62 2017/05/26 14:21:00 riastradh Exp $ */
/*
* Copyright (c) 1992, 1993
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ntfs_vnops.c,v 1.61 2017/04/11 14:24:59 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: ntfs_vnops.c,v 1.62 2017/05/26 14:21:00 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -229,7 +229,7 @@ ntfs_inactive(void *v)
int
ntfs_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
@ -238,6 +238,8 @@ ntfs_reclaim(void *v)
const int attrlen = strlen(fp->f_attrname);
int error;
VOP_UNLOCK(vp);
dprintf(("ntfs_reclaim: vnode: %p, ntnode: %llu\n", vp,
(unsigned long long)ip->i_number));

View File

@ -1,4 +1,4 @@
/* $NetBSD: ptyfs_vnops.c,v 1.53 2017/04/11 14:24:59 riastradh Exp $ */
/* $NetBSD: ptyfs_vnops.c,v 1.54 2017/05/26 14:21:00 riastradh Exp $ */
/*
* Copyright (c) 1993, 1995
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.53 2017/04/11 14:24:59 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.54 2017/05/26 14:21:00 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -219,11 +219,13 @@ const struct vnodeopv_desc ptyfs_vnodeop_opv_desc =
int
ptyfs_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
VOP_UNLOCK(vp);
vp->v_data = NULL;
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: puffs_vnops.c,v 1.210 2017/04/26 03:02:48 riastradh Exp $ */
/* $NetBSD: puffs_vnops.c,v 1.211 2017/05/26 14:21:01 riastradh Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.210 2017/04/26 03:02:48 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.211 2017/05/26 14:21:01 riastradh Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@ -1443,7 +1443,7 @@ callreclaim(struct puffs_mount *pmp, puffs_cookie_t ck, int nlookup)
int
puffs_vnop_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
const struct vnodeop_desc *a_desc;
struct vnode *a_vp;
} */ *ap = v;
@ -1451,6 +1451,8 @@ puffs_vnop_reclaim(void *v)
struct puffs_mount *pmp = MPTOPUFFSMP(vp->v_mount);
bool notifyserver = true;
VOP_UNLOCK(vp);
/*
* first things first: check if someone is trying to reclaim the
* root vnode. do not allow that to travel to userspace.

View File

@ -1,4 +1,4 @@
/* $NetBSD: smbfs_node.c,v 1.55 2017/04/11 14:25:00 riastradh Exp $ */
/* $NetBSD: smbfs_node.c,v 1.56 2017/05/26 14:21:01 riastradh Exp $ */
/*
* Copyright (c) 2000-2001 Boris Popov
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.55 2017/04/11 14:25:00 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.56 2017/05/26 14:21:01 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -213,7 +213,7 @@ out:
int
smbfs_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
struct thread *a_p;
} */ *ap = v;
@ -222,6 +222,8 @@ smbfs_reclaim(void *v)
struct smbnode *np = VTOSMB(vp);
struct smbmount *smp = VTOSMBFS(vp);
VOP_UNLOCK(vp);
if (prtactive && vp->v_usecount > 1)
vprint("smbfs_reclaim(): pushing active", vp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysvbfs_vnops.c,v 1.62 2017/04/26 03:02:48 riastradh Exp $ */
/* $NetBSD: sysvbfs_vnops.c,v 1.63 2017/05/26 14:21:01 riastradh Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vnops.c,v 1.62 2017/04/26 03:02:48 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vnops.c,v 1.63 2017/05/26 14:21:01 riastradh Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -697,13 +697,15 @@ int
sysvbfs_reclaim(void *v)
{
extern struct pool sysvbfs_node_pool;
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct sysvbfs_node *bnode = vp->v_data;
struct bfs *bfs = bnode->bmp->bfs;
VOP_UNLOCK(vp);
DPRINTF("%s:\n", __func__);
if (bnode->removed) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: tmpfs_vnops.c,v 1.132 2017/04/26 03:02:48 riastradh Exp $ */
/* $NetBSD: tmpfs_vnops.c,v 1.133 2017/05/26 14:21:01 riastradh Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.132 2017/04/26 03:02:48 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.133 2017/05/26 14:21:01 riastradh Exp $");
#include <sys/param.h>
#include <sys/dirent.h>
@ -1060,13 +1060,16 @@ tmpfs_inactive(void *v)
int
tmpfs_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *ap = v;
vnode_t *vp = ap->a_vp;
tmpfs_mount_t *tmp = VFS_TO_TMPFS(vp->v_mount);
tmpfs_node_t *node = VP_TO_TMPFS_NODE(vp);
/* Unlock vnode. We still have exclusive access to it. */
VOP_UNLOCK(vp);
/* Disassociate inode from vnode. */
node->tn_vnode = NULL;
vp->v_data = NULL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: udf_vnops.c,v 1.104 2017/04/26 03:02:48 riastradh Exp $ */
/* $NetBSD: udf_vnops.c,v 1.105 2017/05/26 14:21:01 riastradh Exp $ */
/*
* Copyright (c) 2006, 2008 Reinoud Zandijk
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.104 2017/04/26 03:02:48 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.105 2017/05/26 14:21:01 riastradh Exp $");
#endif /* not lint */
@ -129,13 +129,15 @@ udf_inactive(void *v)
int
udf_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct udf_node *udf_node = VTOI(vp);
int refcnt;
VOP_UNLOCK(vp);
DPRINTF(NODE, ("udf_reclaim called for node %p\n", udf_node));
if (prtactive && vp->v_usecount > 1)
vprint("udf_reclaim(): pushing active", vp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: union_vnops.c,v 1.69 2017/05/24 09:55:18 hannken Exp $ */
/* $NetBSD: union_vnops.c,v 1.70 2017/05/26 14:21:01 riastradh Exp $ */
/*
* Copyright (c) 1992, 1993, 1994, 1995
@ -72,7 +72,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.69 2017/05/24 09:55:18 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.70 2017/05/26 14:21:01 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1577,12 +1577,14 @@ union_inactive(void *v)
int
union_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct vnode *uvp = UPPERVP(vp);
VOP_UNLOCK(vp);
if (uvp != NULL) {
mutex_enter(uvp->v_interlock);
KASSERT(vp->v_interlock == uvp->v_interlock);

View File

@ -1478,10 +1478,12 @@ unionfs_inactive(void *v)
static int
unionfs_reclaim(void *v)
{
struct vop_reclaim_args *ap = v;
struct vop_reclaim_v2_args *ap = v;
/* UNIONFS_INTERNAL_DEBUG("unionfs_reclaim: enter\n"); */
VOP_UNLOCK(ap->a_vp);
unionfs_noderem(ap->a_vp);
/* UNIONFS_INTERNAL_DEBUG("unionfs_reclaim: leave\n"); */

View File

@ -1,4 +1,4 @@
/* $NetBSD: v7fs_vnops.c,v 1.25 2017/04/26 03:02:49 riastradh Exp $ */
/* $NetBSD: v7fs_vnops.c,v 1.26 2017/05/26 14:21:01 riastradh Exp $ */
/*-
* Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: v7fs_vnops.c,v 1.25 2017/04/26 03:02:49 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: v7fs_vnops.c,v 1.26 2017/05/26 14:21:01 riastradh Exp $");
#if defined _KERNEL_OPT
#include "opt_v7fs.h"
#endif
@ -1032,7 +1032,7 @@ v7fs_reclaim(void *v)
{
/*This vnode is no longer referenced by kernel. */
extern struct pool v7fs_node_pool;
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *a = v;
struct vnode *vp = a->a_vp;
@ -1040,6 +1040,8 @@ v7fs_reclaim(void *v)
struct v7fs_self *fs = v7node->v7fsmount->core;
struct v7fs_inode *inode = &v7node->inode;
VOP_UNLOCK(vp);
DPRINTF("%p #%d\n", vp, inode->inode_number);
if (v7fs_inode_nlink(inode) == 0) {
v7fs_datablock_size_change(fs, 0, inode);

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_vnode.c,v 1.88 2017/05/17 12:46:14 hannken Exp $ */
/* $NetBSD: vfs_vnode.c,v 1.89 2017/05/26 14:20:59 riastradh Exp $ */
/*-
* Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@ -156,7 +156,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.88 2017/05/17 12:46:14 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.89 2017/05/26 14:20:59 riastradh Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -1573,7 +1573,6 @@ vcache_reclaim(vnode_t *vp)
* Note that the VOP_INACTIVE will not unlock the vnode.
*/
VOP_INACTIVE(vp, &recycle);
VOP_UNLOCK(vp);
if (VOP_RECLAIM(vp)) {
vnpanic(vp, "%s: cannot reclaim", __func__);
}

View File

@ -1,4 +1,4 @@
# $NetBSD: vnode_if.src,v 1.74 2017/04/26 03:02:49 riastradh Exp $
# $NetBSD: vnode_if.src,v 1.75 2017/05/26 14:21:00 riastradh Exp $
#
# Copyright (c) 1992, 1993
# The Regents of the University of California. All rights reserved.
@ -395,11 +395,12 @@ vop_inactive {
};
#
#% reclaim vp U U U
#% reclaim vp L U U
#
vop_reclaim {
VERSION 2
FSTRANS=NO
IN LOCKED=NO struct vnode *vp;
IN LOCKED=YES struct vnode *vp;
};
#

View File

@ -1,4 +1,4 @@
/* $NetBSD: fdesc_vnops.c,v 1.128 2017/04/11 14:25:00 riastradh Exp $ */
/* $NetBSD: fdesc_vnops.c,v 1.129 2017/05/26 14:21:01 riastradh Exp $ */
/*
* Copyright (c) 1992, 1993
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.128 2017/04/11 14:25:00 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.129 2017/05/26 14:21:01 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -855,12 +855,14 @@ fdesc_inactive(void *v)
int
fdesc_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct fdescnode *fd = VTOFDESC(vp);
VOP_UNLOCK(vp);
vp->v_data = NULL;
kmem_free(fd, sizeof(struct fdescnode));

View File

@ -1,4 +1,4 @@
/* $NetBSD: layer_vnops.c,v 1.65 2017/05/24 09:54:40 hannken Exp $ */
/* $NetBSD: layer_vnops.c,v 1.66 2017/05/26 14:21:01 riastradh Exp $ */
/*
* Copyright (c) 1999 National Aeronautics & Space Administration
@ -170,7 +170,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.65 2017/05/24 09:54:40 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.66 2017/05/26 14:21:01 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -705,7 +705,7 @@ layer_revoke(void *v)
int
layer_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
struct lwp *a_l;
} */ *ap = v;
@ -714,6 +714,8 @@ layer_reclaim(void *v)
struct layer_node *xp = VTOLAYER(vp);
struct vnode *lowervp = xp->layer_lowervp;
VOP_UNLOCK(vp);
/*
* Note: in vop_reclaim, the node's struct lock has been
* decomissioned, so we have to be careful about calling

View File

@ -1,4 +1,4 @@
/* $NetBSD: kernfs_vnops.c,v 1.157 2017/04/11 14:25:01 riastradh Exp $ */
/* $NetBSD: kernfs_vnops.c,v 1.158 2017/05/26 14:21:01 riastradh Exp $ */
/*
* Copyright (c) 1992, 1993
@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.157 2017/04/11 14:25:01 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.158 2017/05/26 14:21:01 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1074,12 +1074,14 @@ kernfs_inactive(void *v)
int
kernfs_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct kernfs_node *kfs = VTOKERN(vp);
VOP_UNLOCK(vp);
vp->v_data = NULL;
mutex_enter(&kfs_lock);
TAILQ_REMOVE(&VFSTOKERNFS(vp->v_mount)->nodelist, kfs, kfs_list);

View File

@ -1,4 +1,4 @@
/* $NetBSD: procfs_vnops.c,v 1.196 2017/04/11 14:25:01 riastradh Exp $ */
/* $NetBSD: procfs_vnops.c,v 1.197 2017/05/26 14:21:01 riastradh Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@ -105,7 +105,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.196 2017/04/11 14:25:01 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.197 2017/05/26 14:21:01 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -438,12 +438,14 @@ procfs_inactive(void *v)
int
procfs_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct pfsnode *pfs = VTOPFS(vp);
VOP_UNLOCK(vp);
/*
* To interlock with procfs_revoke_vnodes().
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: spec_vnops.c,v 1.171 2017/04/12 06:43:56 martin Exp $ */
/* $NetBSD: spec_vnops.c,v 1.172 2017/05/26 14:21:02 riastradh Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.171 2017/04/12 06:43:56 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.172 2017/05/26 14:21:02 riastradh Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@ -1096,10 +1096,12 @@ spec_inactive(void *v)
int
spec_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp __diagused = ap->a_vp;
struct vnode *vp = ap->a_vp;
VOP_UNLOCK(vp);
KASSERT(vp->v_mount == dead_rootmount);
return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_node.c,v 1.120 2017/04/11 14:25:01 riastradh Exp $ */
/* $NetBSD: nfs_node.c,v 1.121 2017/05/26 14:21:02 riastradh Exp $ */
/*
* Copyright (c) 1989, 1993
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_node.c,v 1.120 2017/04/11 14:25:01 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_node.c,v 1.121 2017/05/26 14:21:02 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_nfs.h"
@ -216,12 +216,14 @@ nfs_inactive(void *v)
int
nfs_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct nfsnode *np = VTONFS(vp);
VOP_UNLOCK(vp);
if (prtactive && vp->v_usecount > 1)
vprint("nfs_reclaim: pushing active", vp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rumpfs.c,v 1.148 2017/04/26 03:02:49 riastradh Exp $ */
/* $NetBSD: rumpfs.c,v 1.149 2017/05/26 14:21:00 riastradh Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Antti Kantee. All Rights Reserved.
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.148 2017/04/26 03:02:49 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.149 2017/05/26 14:21:00 riastradh Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@ -1613,12 +1613,14 @@ rump_vop_inactive(void *v)
static int
rump_vop_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct rumpfs_node *rn = vp->v_data;
VOP_UNLOCK(vp);
mutex_enter(&reclock);
rn->rn_vp = NULL;
mutex_exit(&reclock);

View File

@ -1,4 +1,4 @@
/* $NetBSD: chfs_vnops.c,v 1.32 2017/04/26 03:02:49 riastradh Exp $ */
/* $NetBSD: chfs_vnops.c,v 1.33 2017/05/26 14:21:02 riastradh Exp $ */
/*-
* Copyright (c) 2010 Department of Software Engineering,
@ -1474,12 +1474,14 @@ chfs_inactive(void *v)
int
chfs_reclaim(void *v)
{
struct vop_reclaim_args *ap = v;
struct vop_reclaim_v2_args *ap = v;
struct vnode *vp = ap->a_vp;
struct chfs_inode *ip = VTOI(vp);
struct chfs_mount *chmp = ip->chmp;
struct chfs_dirent *fd;
VOP_UNLOCK(vp);
mutex_enter(&chmp->chm_lock_mountfields);
mutex_enter(&chmp->chm_lock_vnocache);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext2fs_vnops.c,v 1.126 2017/04/26 03:02:49 riastradh Exp $ */
/* $NetBSD: ext2fs_vnops.c,v 1.127 2017/05/26 14:21:02 riastradh Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.126 2017/04/26 03:02:49 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.127 2017/05/26 14:21:02 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1123,13 +1123,15 @@ bad:
int
ext2fs_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct inode *ip = VTOI(vp);
int error;
VOP_UNLOCK(vp);
/*
* The inode must be freed and updated before being removed
* from its hash chain. Other threads trying to gain a hold

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_vnops.c,v 1.128 2017/03/02 00:43:40 christos Exp $ */
/* $NetBSD: ffs_vnops.c,v 1.129 2017/05/26 14:21:02 riastradh Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ffs_vnops.c,v 1.128 2017/03/02 00:43:40 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ffs_vnops.c,v 1.129 2017/05/26 14:21:02 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@ -540,7 +540,7 @@ ffs_full_fsync(struct vnode *vp, int flags)
int
ffs_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
struct lwp *a_l;
} */ *ap = v;
@ -551,6 +551,8 @@ ffs_reclaim(void *v)
void *data;
int error;
VOP_UNLOCK(vp);
/*
* The inode must be freed and updated before being removed
* from its hash chain. Other threads trying to gain a hold

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vnops.c,v 1.314 2017/04/26 03:02:49 riastradh Exp $ */
/* $NetBSD: lfs_vnops.c,v 1.315 2017/05/26 14:21:02 riastradh Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -125,7 +125,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.314 2017/04/26 03:02:49 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.315 2017/05/26 14:21:02 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@ -1414,7 +1414,7 @@ lfsfifo_close(void *v)
int
lfs_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
@ -1422,6 +1422,8 @@ lfs_reclaim(void *v)
struct lfs *fs;
int error;
VOP_UNLOCK(vp);
ip = VTOI(vp);
fs = ip->i_lfs;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mfs_vnops.c,v 1.57 2017/04/11 14:25:01 riastradh Exp $ */
/* $NetBSD: mfs_vnops.c,v 1.58 2017/05/26 14:21:02 riastradh Exp $ */
/*
* Copyright (c) 1989, 1993
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mfs_vnops.c,v 1.57 2017/04/11 14:25:01 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: mfs_vnops.c,v 1.58 2017/05/26 14:21:02 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -290,13 +290,15 @@ mfs_inactive(void *v)
int
mfs_reclaim(void *v)
{
struct vop_reclaim_args /* {
struct vop_reclaim_v2_args /* {
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct mfsnode *mfsp = VTOMFS(vp);
int refcnt;
VOP_UNLOCK(vp);
mutex_enter(&mfs_lock);
vp->v_data = NULL;
refcnt = --mfsp->mfs_refcnt;