Module Name:    src
Committed By:   hannken
Date:           Thu Jan 13 10:28:38 UTC 2011

Modified Files:
        src/sys/miscfs/genfs: layer_vnops.c

Log Message:
Layer_revoke(): change previous to always take an extra reference on the
lower vnode before passing down the VOP_REVOKE().  This way VOP_REVOKE()
on a layered file system always inactivates and closes the lower vnode.

Should finally fix PR kern/43456.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/miscfs/genfs/layer_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/miscfs/genfs/layer_vnops.c
diff -u src/sys/miscfs/genfs/layer_vnops.c:1.45 src/sys/miscfs/genfs/layer_vnops.c:1.46
--- src/sys/miscfs/genfs/layer_vnops.c:1.45	Mon Jan 10 11:11:03 2011
+++ src/sys/miscfs/genfs/layer_vnops.c	Thu Jan 13 10:28:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: layer_vnops.c,v 1.45 2011/01/10 11:11:03 hannken Exp $	*/
+/*	$NetBSD: layer_vnops.c,v 1.46 2011/01/13 10:28:38 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.45 2011/01/10 11:11:03 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.46 2011/01/13 10:28:38 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -658,19 +658,16 @@
 	} */ *ap = v;
 	struct vnode *vp = ap->a_vp;
 	struct vnode *lvp = LAYERVPTOLOWERVP(vp);
-	int i, n, error;
+	int 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.
+	 * to determine if a vnode is active.  Take an extra reference on
+	 * the lower vnode so it will always close and inactivate.
 	 */
-	n = vp->v_usecount - lvp->v_usecount;
-	for (i = 0; i < n; i++)
-		vref(lvp);
+	vref(lvp);
 	error = LAYERFS_DO_BYPASS(vp, ap);
-	for (i = 0; i < n; i++)
-		vrele(lvp);
+	vrele(lvp);
 
 	return error;
 }

Reply via email to