Move v_writecount adjustment from revoke to reclaim.
This commit is contained in:
parent
853d034c97
commit
2aedd7ca2a
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: union_vnops.c,v 1.67 2017/04/26 03:02:48 riastradh Exp $ */
|
||||
/* $NetBSD: union_vnops.c,v 1.68 2017/05/07 08:22:40 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1994, 1995
|
||||
@ -72,7 +72,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.67 2017/04/26 03:02:48 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.68 2017/05/07 08:22:40 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -1064,13 +1064,8 @@ union_revoke(void *v)
|
||||
} */ *ap = v;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
|
||||
if (UPPERVP(vp)) {
|
||||
mutex_enter(UPPERVP(vp)->v_interlock);
|
||||
KASSERT(vp->v_interlock == UPPERVP(vp)->v_interlock);
|
||||
UPPERVP(vp)->v_writecount -= vp->v_writecount;
|
||||
mutex_exit(UPPERVP(vp)->v_interlock);
|
||||
if (UPPERVP(vp))
|
||||
VOP_REVOKE(UPPERVP(vp), ap->a_flags);
|
||||
}
|
||||
if (LOWERVP(vp))
|
||||
VOP_REVOKE(LOWERVP(vp), ap->a_flags);
|
||||
vgone(vp); /* XXXAD?? */
|
||||
@ -1585,8 +1580,17 @@ union_reclaim(void *v)
|
||||
struct vop_reclaim_args /* {
|
||||
struct vnode *a_vp;
|
||||
} */ *ap = v;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct vnode *uvp = UPPERVP(vp);
|
||||
|
||||
union_freevp(ap->a_vp);
|
||||
if (uvp != NULL) {
|
||||
mutex_enter(uvp->v_interlock);
|
||||
KASSERT(vp->v_interlock == uvp->v_interlock);
|
||||
uvp->v_writecount -= vp->v_writecount;
|
||||
mutex_exit(uvp->v_interlock);
|
||||
}
|
||||
|
||||
union_freevp(vp);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: layer_vnops.c,v 1.63 2017/04/26 03:02:49 riastradh Exp $ */
|
||||
/* $NetBSD: layer_vnops.c,v 1.64 2017/05/07 08:21:57 hannken 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.63 2017/04/26 03:02:49 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.64 2017/05/07 08:21:57 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -693,15 +693,8 @@ layer_revoke(void *v)
|
||||
* We will most likely end up in vclean which uses the v_usecount
|
||||
* to determine if a vnode is active. Take an extra reference on
|
||||
* the lower vnode so it will always close and inactivate.
|
||||
* Remove our writecount from the lower vnode.
|
||||
*/
|
||||
vref(lvp);
|
||||
|
||||
mutex_enter(vp->v_interlock);
|
||||
KASSERT(vp->v_interlock == lvp->v_interlock);
|
||||
lvp->v_writecount -= vp->v_writecount;
|
||||
mutex_exit(vp->v_interlock);
|
||||
|
||||
error = LAYERFS_DO_BYPASS(vp, ap);
|
||||
vrele(lvp);
|
||||
|
||||
@ -734,6 +727,12 @@ layer_reclaim(void *v)
|
||||
*/
|
||||
lmp->layerm_rootvp = NULL;
|
||||
}
|
||||
|
||||
mutex_enter(vp->v_interlock);
|
||||
KASSERT(vp->v_interlock == lowervp->v_interlock);
|
||||
lowervp->v_writecount -= vp->v_writecount;
|
||||
mutex_exit(vp->v_interlock);
|
||||
|
||||
/* After this assignment, this node will not be re-used. */
|
||||
xp->layer_lowervp = NULL;
|
||||
kmem_free(vp->v_data, lmp->layerm_size);
|
||||
|
Loading…
Reference in New Issue
Block a user