Add layer_revoke() that adjusts the lower vnode use count to be at least as
high as the upper vnode count before passing down the VOP_REVOKE(). This way vclean() check for active (vp->v_usecount > 1) vnodes gets it right. Should fix PR kern/43456.
This commit is contained in:
parent
2304727048
commit
b89d0815aa
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: layer_extern.h,v 1.26 2010/07/02 08:09:51 hannken Exp $ */
|
||||
/* $NetBSD: layer_extern.h,v 1.27 2011/01/10 11:11:03 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 National Aeronautics & Space Administration
|
||||
|
@ -113,6 +113,7 @@ int layer_access(void *);
|
|||
int layer_open(void *);
|
||||
int layer_remove(void *);
|
||||
int layer_rename(void *);
|
||||
int layer_revoke(void *);
|
||||
int layer_rmdir(void *);
|
||||
int layer_getpages(void *);
|
||||
int layer_putpages(void *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: layer_vnops.c,v 1.44 2011/01/02 10:38:02 hannken Exp $ */
|
||||
/* $NetBSD: layer_vnops.c,v 1.45 2011/01/10 11:11:03 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.44 2011/01/02 10:38:02 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.45 2011/01/10 11:11:03 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -649,6 +649,32 @@ layer_rmdir(void *v)
|
|||
return error;
|
||||
}
|
||||
|
||||
int
|
||||
layer_revoke(void *v)
|
||||
{
|
||||
struct vop_revoke_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_flags;
|
||||
} */ *ap = v;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct vnode *lvp = LAYERVPTOLOWERVP(vp);
|
||||
int i, n, error;
|
||||
|
||||
/*
|
||||
* We will most likely end up in vclean which uses the v_usecount
|
||||
* to determine if a vnode is active. So we have to adjust the
|
||||
* lower vp's usecount to be at least as high as our usecount.
|
||||
*/
|
||||
n = vp->v_usecount - lvp->v_usecount;
|
||||
for (i = 0; i < n; i++)
|
||||
vref(lvp);
|
||||
error = LAYERFS_DO_BYPASS(vp, ap);
|
||||
for (i = 0; i < n; i++)
|
||||
vrele(lvp);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
int
|
||||
layer_reclaim(void *v)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: null_vnops.c,v 1.36 2010/07/02 08:09:51 hannken Exp $ */
|
||||
/* $NetBSD: null_vnops.c,v 1.37 2011/01/10 11:11:03 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 National Aeronautics & Space Administration
|
||||
|
@ -80,7 +80,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: null_vnops.c,v 1.36 2010/07/02 08:09:51 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: null_vnops.c,v 1.37 2011/01/10 11:11:03 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -109,6 +109,7 @@ const struct vnodeopv_entry_desc null_vnodeop_entries[] = {
|
|||
{ &vop_print_desc, layer_print },
|
||||
{ &vop_remove_desc, layer_remove },
|
||||
{ &vop_rename_desc, layer_rename },
|
||||
{ &vop_revoke_desc, layer_revoke },
|
||||
{ &vop_rmdir_desc, layer_rmdir },
|
||||
|
||||
{ &vop_open_desc, layer_open }, /* mount option handling */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: overlay_vnops.c,v 1.17 2010/07/02 08:09:51 hannken Exp $ */
|
||||
/* $NetBSD: overlay_vnops.c,v 1.18 2011/01/10 11:11:03 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999, 2000 National Aeronautics & Space Administration
|
||||
|
@ -67,7 +67,7 @@
|
|||
*
|
||||
* Ancestors:
|
||||
* @(#)lofs_vnops.c 1.2 (Berkeley) 6/18/92
|
||||
* $Id: overlay_vnops.c,v 1.17 2010/07/02 08:09:51 hannken Exp $
|
||||
* $Id: overlay_vnops.c,v 1.18 2011/01/10 11:11:03 hannken Exp $
|
||||
* ...and...
|
||||
* @(#)null_vnodeops.c 1.20 92/07/07 UCLA Ficus project
|
||||
*/
|
||||
|
@ -126,7 +126,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: overlay_vnops.c,v 1.17 2010/07/02 08:09:51 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: overlay_vnops.c,v 1.18 2011/01/10 11:11:03 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -158,6 +158,7 @@ const struct vnodeopv_entry_desc overlay_vnodeop_entries[] = {
|
|||
{ &vop_print_desc, layer_print },
|
||||
{ &vop_remove_desc, layer_remove },
|
||||
{ &vop_rename_desc, layer_rename },
|
||||
{ &vop_revoke_desc, layer_revoke },
|
||||
{ &vop_rmdir_desc, layer_rmdir },
|
||||
|
||||
{ &vop_open_desc, layer_open }, /* mount option handling */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: umap_vnops.c,v 1.50 2010/07/02 08:09:51 hannken Exp $ */
|
||||
/* $NetBSD: umap_vnops.c,v 1.51 2011/01/10 11:11:04 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -39,7 +39,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: umap_vnops.c,v 1.50 2010/07/02 08:09:51 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: umap_vnops.c,v 1.51 2011/01/10 11:11:04 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -93,6 +93,7 @@ const struct vnodeopv_entry_desc umap_vnodeop_entries[] = {
|
|||
{ &vop_setattr_desc, layer_setattr },
|
||||
{ &vop_access_desc, layer_access },
|
||||
{ &vop_remove_desc, layer_remove },
|
||||
{ &vop_revoke_desc, layer_revoke },
|
||||
{ &vop_rmdir_desc, layer_rmdir },
|
||||
|
||||
{ &vop_bwrite_desc, layer_bwrite },
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: t_nullpts.c,v 1.4 2010/07/03 08:18:30 jmmv Exp $ */
|
||||
/* $NetBSD: t_nullpts.c,v 1.5 2011/01/10 11:11:04 hannken Exp $ */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
|
@ -113,11 +113,10 @@ ATF_TC_BODY(nullrevoke, tc)
|
|||
*/
|
||||
rump_sys_close(ptg.sfd);
|
||||
|
||||
/* revoke slave tty. boom */
|
||||
atf_tc_expect_signal(-1, "PR kern/43456");
|
||||
/* revoke slave tty. */
|
||||
rump_sys_revoke(path);
|
||||
|
||||
/* done? */
|
||||
/* done */
|
||||
}
|
||||
|
||||
ATF_TP_ADD_TCS(tp)
|
||||
|
|
Loading…
Reference in New Issue