Module Name: src
Committed By: hannken
Date: Sun Jun 6 08:01:32 UTC 2010
Modified Files:
src/doc: CHANGES
src/share/man/man9: vnode.9
src/sys/fs/udf: udf_subr.c
src/sys/fs/union: union_subr.c
src/sys/fs/unionfs: unionfs_subr.c
src/sys/kern: vfs_subr.c vfs_vnops.c
src/sys/miscfs/genfs: genfs_vnops.c layer.h layer_subr.c layer_vnops.c
src/sys/miscfs/umapfs: umap_vnops.c
src/sys/sys: param.h vnode.h
Log Message:
Change layered file systems to always pass the locking VOP's down to the
leaf file system. Remove now unused member v_vnlock from struct vnode.
Welcome to 5.99.30
Discussed on tech-kern.
To generate a diff of this commit:
cvs rdiff -u -r1.1399 -r1.1400 src/doc/CHANGES
cvs rdiff -u -r1.48 -r1.49 src/share/man/man9/vnode.9
cvs rdiff -u -r1.104 -r1.105 src/sys/fs/udf/udf_subr.c
cvs rdiff -u -r1.35 -r1.36 src/sys/fs/union/union_subr.c
cvs rdiff -u -r1.5 -r1.6 src/sys/fs/unionfs/unionfs_subr.c
cvs rdiff -u -r1.403 -r1.404 src/sys/kern/vfs_subr.c
cvs rdiff -u -r1.171 -r1.172 src/sys/kern/vfs_vnops.c
cvs rdiff -u -r1.177 -r1.178 src/sys/miscfs/genfs/genfs_vnops.c
cvs rdiff -u -r1.13 -r1.14 src/sys/miscfs/genfs/layer.h
cvs rdiff -u -r1.28 -r1.29 src/sys/miscfs/genfs/layer_subr.c
cvs rdiff -u -r1.39 -r1.40 src/sys/miscfs/genfs/layer_vnops.c
cvs rdiff -u -r1.48 -r1.49 src/sys/miscfs/umapfs/umap_vnops.c
cvs rdiff -u -r1.364 -r1.365 src/sys/sys/param.h
cvs rdiff -u -r1.218 -r1.219 src/sys/sys/vnode.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1399 src/doc/CHANGES:1.1400
--- src/doc/CHANGES:1.1399 Fri Jun 4 09:10:53 2010
+++ src/doc/CHANGES Sun Jun 6 08:01:30 2010
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1399 $>
+# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1400 $>
#
#
# [Note: This file does not mention every change made to the NetBSD source tree.
@@ -624,3 +624,4 @@
[mrg 20100527]
atf(7): Import 0.9. [jmmv 20100604]
dhcpcd(8): Import dhcpcd-5.2.4. [roy 20100604]
+ vnode(9): Remove member v_vnlock. [hannken 20100605]
Index: src/share/man/man9/vnode.9
diff -u src/share/man/man9/vnode.9:1.48 src/share/man/man9/vnode.9:1.49
--- src/share/man/man9/vnode.9:1.48 Sun May 30 13:50:16 2010
+++ src/share/man/man9/vnode.9 Sun Jun 6 08:01:31 2010
@@ -1,4 +1,4 @@
-.\" $NetBSD: vnode.9,v 1.48 2010/05/30 13:50:16 ahoka Exp $
+.\" $NetBSD: vnode.9,v 1.49 2010/06/06 08:01:31 hannken Exp $
.\"
.\" Copyright (c) 2001, 2005, 2006 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd May 30, 2010
+.Dd June 6, 2010
.Dt VNODE 9
.Os
.Sh NAME
@@ -161,7 +161,6 @@
enum vtype v_type; /* vnode type */
enum vtagtype v_tag; /* type of underlying data */
struct vnlock v_lock; /* lock for this vnode */
- struct vnlock *v_vnlock; /* pointer to lock */
void *v_data; /* private data for fs */
struct klist v_klist; /* notes attached to vnode */
};
@@ -434,7 +433,7 @@
.El
.Pp
All vnode locking operations use
-.Em v_vnlock .
+.Em v_lock .
This lock is acquired by calling
.Xr vn_lock 9
and released by calling
@@ -462,7 +461,7 @@
of big-lock SMP locking or a uni-processor machine.
The lock may be held while sleeping.
While the
-.Em v_vnlock
+.Em v_lock
is acquired, the holder is guaranteed that the vnode will not be
reclaimed or invalidated.
Most file system functions require that you hold the vnode lock on entry.
@@ -470,23 +469,6 @@
.Xr lock 9
for details on the kernel locking API.
.Pp
-For leaf file systems (such as ffs, lfs, msdosfs, etc),
-.Em v_vnlock
-will point to
-.Em v_lock .
-For stacked file systems,
-.Em v_vnlock
-will generally point to
-.Em v_vlock
-of the lowest file system.
-Additionally, the implementation of the vnode lock is the
-responsibility of the individual file systems and
-.Em v_vnlock
-may also be NULL indicating that a leaf node does not export a lock
-for vnode locking.
-In this case, stacked file systems (such as nullfs) must call the
-underlying file system directly for locking.
-.Pp
Each file system underlying a vnode allocates its own private area and
hangs it from
.Em v_data .
Index: src/sys/fs/udf/udf_subr.c
diff -u src/sys/fs/udf/udf_subr.c:1.104 src/sys/fs/udf/udf_subr.c:1.105
--- src/sys/fs/udf/udf_subr.c:1.104 Thu Feb 25 16:15:57 2010
+++ src/sys/fs/udf/udf_subr.c Sun Jun 6 08:01:31 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_subr.c,v 1.104 2010/02/25 16:15:57 reinoud Exp $ */
+/* $NetBSD: udf_subr.c,v 1.105 2010/06/06 08:01:31 hannken Exp $ */
/*
* Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.104 2010/02/25 16:15:57 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.105 2010/06/06 08:01:31 hannken Exp $");
#endif /* not lint */
@@ -5452,7 +5452,7 @@
/* recycle udf_node */
udf_dispose_node(udf_node);
- vlockmgr(nvp->v_vnlock, LK_RELEASE);
+ vlockmgr(&nvp->v_lock, LK_RELEASE);
nvp->v_data = NULL;
ungetnewvnode(nvp);
@@ -5548,7 +5548,7 @@
/* recycle udf_node */
udf_dispose_node(udf_node);
- vlockmgr(nvp->v_vnlock, LK_RELEASE);
+ vlockmgr(&nvp->v_lock, LK_RELEASE);
nvp->v_data = NULL;
ungetnewvnode(nvp);
@@ -5883,7 +5883,7 @@
udf_do_unreserve_space(ump, NULL, vpart_num, 1);
error_out_unlock:
- vlockmgr(nvp->v_vnlock, LK_RELEASE);
+ vlockmgr(&nvp->v_lock, LK_RELEASE);
error_out_unget:
nvp->v_data = NULL;
Index: src/sys/fs/union/union_subr.c
diff -u src/sys/fs/union/union_subr.c:1.35 src/sys/fs/union/union_subr.c:1.36
--- src/sys/fs/union/union_subr.c:1.35 Fri Jan 8 11:35:09 2010
+++ src/sys/fs/union/union_subr.c Sun Jun 6 08:01:31 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: union_subr.c,v 1.35 2010/01/08 11:35:09 pooka Exp $ */
+/* $NetBSD: union_subr.c,v 1.36 2010/06/06 08:01:31 hannken Exp $ */
/*
* Copyright (c) 1994
@@ -72,7 +72,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.35 2010/01/08 11:35:09 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.36 2010/06/06 08:01:31 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -532,7 +532,6 @@
(*vpp)->v_vflag |= vflag;
(*vpp)->v_iflag |= iflag;
- (*vpp)->v_vnlock = NULL; /* Make upper layers call VOP_LOCK */
if (uppervp)
(*vpp)->v_type = uppervp->v_type;
else
Index: src/sys/fs/unionfs/unionfs_subr.c
diff -u src/sys/fs/unionfs/unionfs_subr.c:1.5 src/sys/fs/unionfs/unionfs_subr.c:1.6
--- src/sys/fs/unionfs/unionfs_subr.c:1.5 Fri Jan 8 11:35:09 2010
+++ src/sys/fs/unionfs/unionfs_subr.c Sun Jun 6 08:01:31 2010
@@ -110,10 +110,6 @@
unp->un_uppervp = uppervp;
unp->un_lowervp = lowervp;
unp->un_dvp = dvp;
- if (uppervp != NULLVP)
- vp->v_vnlock = uppervp->v_vnlock;
- else
- vp->v_vnlock = lowervp->v_vnlock;
if (path != NULL) {
unp->un_path = (char *)
@@ -156,7 +152,6 @@
lvp = unp->un_lowervp;
uvp = unp->un_uppervp;
unp->un_lowervp = unp->un_uppervp = NULLVP;
- vp->v_vnlock = &(vp->v_lock);
vp->v_data = NULL;
if (lvp != NULLVP)
@@ -490,9 +485,8 @@
*/
mutex_enter(&vp->v_interlock);
unp->un_uppervp = uvp;
- vp->v_vnlock = uvp->v_vnlock;
- lockcnt = lvp->v_vnlock->vl_recursecnt +
- rw_write_held(&lvp->v_vnlock->vl_lock);
+ lockcnt = lvp->v_lock.vl_recursecnt +
+ rw_write_held(&lvp->v_lock.vl_lock);
if (lockcnt <= 0)
panic("unionfs: no exclusive lock");
mutex_exit(&vp->v_interlock);
Index: src/sys/kern/vfs_subr.c
diff -u src/sys/kern/vfs_subr.c:1.403 src/sys/kern/vfs_subr.c:1.404
--- src/sys/kern/vfs_subr.c:1.403 Thu May 27 23:58:38 2010
+++ src/sys/kern/vfs_subr.c Sun Jun 6 08:01:31 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_subr.c,v 1.403 2010/05/27 23:58:38 pooka Exp $ */
+/* $NetBSD: vfs_subr.c,v 1.404 2010/06/06 08:01:31 hannken Exp $ */
/*-
* Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.403 2010/05/27 23:58:38 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.404 2010/06/06 08:01:31 hannken Exp $");
#include "opt_ddb.h"
#include "opt_compat_netbsd.h"
@@ -649,7 +649,6 @@
KASSERT(LIST_EMPTY(&vp->v_dnclist));
vp->v_type = VNON;
- vp->v_vnlock = &vp->v_lock;
vp->v_tag = tag;
vp->v_op = vops;
insmntque(vp, mp);
@@ -1951,7 +1950,6 @@
mutex_enter(&vp->v_interlock);
vp->v_op = dead_vnodeop_p;
vp->v_tag = VT_NON;
- vp->v_vnlock = &vp->v_lock;
KNOTE(&vp->v_klist, NOTE_REVOKE);
vp->v_iflag &= ~(VI_XLOCK | VI_FREEING);
vp->v_vflag &= ~VV_LOCKSWORK;
@@ -2732,7 +2730,7 @@
char bf[96];
int flag;
- vl = (vp->v_vnlock != NULL ? vp->v_vnlock : &vp->v_lock);
+ vl = &vp->v_lock;
flag = vp->v_iflag | vp->v_vflag | vp->v_uflag;
snprintb(bf, sizeof(bf), vnode_flagbits, flag);
@@ -3300,7 +3298,7 @@
ARRAY_PRINT(vp->v_type, vnode_types), vp->v_type,
vp->v_mount, vp->v_mountedhere);
- (*pr)("v_lock %p v_vnlock %p\n", &vp->v_lock, vp->v_vnlock);
+ (*pr)("v_lock %p\n", &vp->v_lock);
if (full) {
struct buf *bp;
Index: src/sys/kern/vfs_vnops.c
diff -u src/sys/kern/vfs_vnops.c:1.171 src/sys/kern/vfs_vnops.c:1.172
--- src/sys/kern/vfs_vnops.c:1.171 Fri Apr 23 15:38:46 2010
+++ src/sys/kern/vfs_vnops.c Sun Jun 6 08:01:31 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_vnops.c,v 1.171 2010/04/23 15:38:46 pooka Exp $ */
+/* $NetBSD: vfs_vnops.c,v 1.172 2010/06/06 08:01:31 hannken Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.171 2010/04/23 15:38:46 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.172 2010/06/06 08:01:31 hannken Exp $");
#include "veriexec.h"
@@ -827,10 +827,8 @@
u_int
vn_setrecurse(struct vnode *vp)
{
- struct vnlock *lkp;
- lkp = (vp->v_vnlock != NULL ? vp->v_vnlock : &vp->v_lock);
- atomic_inc_uint(&lkp->vl_canrecurse);
+ atomic_inc_uint(&vp->v_lock.vl_canrecurse);
return 0;
}
@@ -841,10 +839,8 @@
void
vn_restorerecurse(struct vnode *vp, u_int flags)
{
- struct vnlock *lkp;
- lkp = (vp->v_vnlock != NULL ? vp->v_vnlock : &vp->v_lock);
- atomic_dec_uint(&lkp->vl_canrecurse);
+ atomic_dec_uint(&vp->v_lock.vl_canrecurse);
}
/*
Index: src/sys/miscfs/genfs/genfs_vnops.c
diff -u src/sys/miscfs/genfs/genfs_vnops.c:1.177 src/sys/miscfs/genfs/genfs_vnops.c:1.178
--- src/sys/miscfs/genfs/genfs_vnops.c:1.177 Thu Apr 8 15:56:26 2010
+++ src/sys/miscfs/genfs/genfs_vnops.c Sun Jun 6 08:01:31 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: genfs_vnops.c,v 1.177 2010/04/08 15:56:26 pooka Exp $ */
+/* $NetBSD: genfs_vnops.c,v 1.178 2010/06/06 08:01:31 hannken Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.177 2010/04/08 15:56:26 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.178 2010/06/06 08:01:31 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -294,7 +294,7 @@
mutex_exit(&vp->v_interlock);
}
- return (vlockmgr(vp->v_vnlock, flags));
+ return (vlockmgr(&vp->v_lock, flags));
}
/*
@@ -311,7 +311,7 @@
KASSERT(ap->a_flags == 0);
- return (vlockmgr(vp->v_vnlock, LK_RELEASE));
+ return (vlockmgr(&vp->v_lock, LK_RELEASE));
}
/*
@@ -325,7 +325,7 @@
} */ *ap = v;
struct vnode *vp = ap->a_vp;
- return (vlockstatus(vp->v_vnlock));
+ return (vlockstatus(&vp->v_lock));
}
/*
Index: src/sys/miscfs/genfs/layer.h
diff -u src/sys/miscfs/genfs/layer.h:1.13 src/sys/miscfs/genfs/layer.h:1.14
--- src/sys/miscfs/genfs/layer.h:1.13 Wed Jan 30 09:50:23 2008
+++ src/sys/miscfs/genfs/layer.h Sun Jun 6 08:01:31 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: layer.h,v 1.13 2008/01/30 09:50:23 ad Exp $ */
+/* $NetBSD: layer.h,v 1.14 2010/06/06 08:01:31 hannken Exp $ */
/*
* Copyright (c) 1999 National Aeronautics & Space Administration
@@ -117,33 +117,6 @@
#define LAYERFS_RESFLAGS 0x00000fff /* flags reserved for layerfs */
#define LAYERFS_REMOVED 0x00000001 /* Did a remove on this node */
-/*
- * The following macros handle upperfs-specific locking. They are needed
- * when the lowerfs does not export a struct lock for locking use by the
- * upper layers. These macros are inteded for adjusting the upperfs
- * struct lock to reflect changes in the underlying vnode's lock state.
- */
-#define LAYERFS_UPPERLOCK(v, f, r) do { \
- if ((v)->v_vnlock == NULL) \
- r = vlockmgr(&(v)->v_lock, (f)); \
- else \
- r = 0; \
- } while (0)
-
-#define LAYERFS_UPPERUNLOCK(v, f, r) do { \
- if ((v)->v_vnlock == NULL) \
- r = vlockmgr(&(v)->v_lock, (f) | LK_RELEASE); \
- else \
- r = 0; \
- } while (0)
-
-#define LAYERFS_UPPERISLOCKED(v, r) do { \
- if ((v)->v_vnlock == NULL) \
- r = vlockstatus(&(v)->v_lock); \
- else \
- r = -1; \
- } while (0)
-
#define LAYERFS_DO_BYPASS(vp, ap) \
(*MOUNTTOLAYERMOUNT((vp)->v_mount)->layerm_bypass)((ap))
Index: src/sys/miscfs/genfs/layer_subr.c
diff -u src/sys/miscfs/genfs/layer_subr.c:1.28 src/sys/miscfs/genfs/layer_subr.c:1.29
--- src/sys/miscfs/genfs/layer_subr.c:1.28 Fri Jan 8 11:35:10 2010
+++ src/sys/miscfs/genfs/layer_subr.c Sun Jun 6 08:01:31 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: layer_subr.c,v 1.28 2010/01/08 11:35:10 pooka Exp $ */
+/* $NetBSD: layer_subr.c,v 1.29 2010/06/06 08:01:31 hannken Exp $ */
/*
* Copyright (c) 1999 National Aeronautics & Space Administration
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: layer_subr.c,v 1.28 2010/01/08 11:35:10 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: layer_subr.c,v 1.29 2010/06/06 08:01:31 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -170,10 +170,7 @@
* We must not let vget() try to lock the layer
* vp, since the lower vp is already locked and
* locking the layer vp will involve locking
- * the lower vp (whether or not they actually
- * share a lock). Instead, take the layer vp's
- * lock separately afterward, but only if it
- * does not share the lower vp's lock.
+ * the lower vp.
*/
error = vget(vp, LK_INTERLOCK | LK_NOWAIT);
if (error) {
@@ -181,7 +178,6 @@
mutex_enter(&lmp->layerm_hashlock);
goto loop;
}
- LAYERFS_UPPERLOCK(vp, LK_EXCLUSIVE, error);
return (vp);
}
}
@@ -249,21 +245,6 @@
}
/*
- * Now lock the new node. We rely on the fact that we were passed
- * a locked vnode. If the lower node is exporting a struct lock
- * (v_vnlock != NULL) then we just set the upper v_vnlock to the
- * lower one, and both are now locked. If the lower node is exporting
- * NULL, then we copy that up and manually lock the upper node.
- *
- * LAYERFS_UPPERLOCK already has the test, so we use it after copying
- * up the v_vnlock from below.
- */
-
- vp->v_vnlock = lowervp->v_vnlock;
- LAYERFS_UPPERLOCK(vp, LK_EXCLUSIVE, error);
- KASSERT(error == 0);
-
- /*
* Insert the new node into the hash.
* Add a reference to the lower node.
*/
Index: src/sys/miscfs/genfs/layer_vnops.c
diff -u src/sys/miscfs/genfs/layer_vnops.c:1.39 src/sys/miscfs/genfs/layer_vnops.c:1.40
--- src/sys/miscfs/genfs/layer_vnops.c:1.39 Fri Jan 8 11:35:10 2010
+++ src/sys/miscfs/genfs/layer_vnops.c Sun Jun 6 08:01:31 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: layer_vnops.c,v 1.39 2010/01/08 11:35:10 pooka Exp $ */
+/* $NetBSD: layer_vnops.c,v 1.40 2010/06/06 08:01:31 hannken Exp $ */
/*
* Copyright (c) 1999 National Aeronautics & Space Administration
@@ -232,7 +232,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.39 2010/01/08 11:35:10 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.40 2010/06/06 08:01:31 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -254,10 +254,7 @@
* This is the 08-June-99 bypass routine, based on the 10-Apr-92 bypass
* routine by John Heidemann.
* The new element for this version is that the whole nullfs
- * system gained the concept of locks on the lower node, and locks on
- * our nodes. When returning from a call to the lower layer, we may
- * need to update lock state ONLY on our layer. The LAYERFS_UPPER*LOCK()
- * macros provide this functionality.
+ * system gained the concept of locks on the lower node.
* The 10-Apr-92 version was optimized for speed, throwing away some
* safety checks. It should still always work, but it's not as
* robust to programmer errors.
@@ -290,7 +287,7 @@
} */ *ap = v;
int (**our_vnodeop_p)(void *);
struct vnode **this_vp_p;
- int error, error1;
+ int error;
struct vnode *old_vps[VDESC_MAX_VPS], *vp0;
struct vnode **vps_p[VDESC_MAX_VPS];
struct vnode ***vppp;
@@ -368,8 +365,6 @@
break; /* bail out at end of list */
if (old_vps[i]) {
*(vps_p[i]) = old_vps[i];
- if (reles & VDESC_VP0_WILLUNLOCK)
- LAYERFS_UPPERUNLOCK(*(vps_p[i]), 0, error1);
if (reles & VDESC_VP0_WILLRELE)
vrele(*(vps_p[i]));
}
@@ -588,9 +583,8 @@
}
/*
- * We need to process our own vnode lock and then clear the
- * interlock flag as it applies only to our vnode, not the
- * vnodes below us on the stack.
+ * We need to clear the interlock flag as it applies only to our vnode,
+ * not the vnodes below us on the stack.
*/
int
layer_lock(void *v)
@@ -600,48 +594,16 @@
int a_flags;
struct proc *a_p;
} */ *ap = v;
- struct vnode *vp = ap->a_vp, *lowervp;
- int flags = ap->a_flags, error;
+ struct vnode *vp = ap->a_vp;
- if (flags & LK_INTERLOCK) {
+ if (ap->a_flags & LK_INTERLOCK) {
mutex_exit(&vp->v_interlock);
- flags &= ~LK_INTERLOCK;
+ ap->a_flags &= ~LK_INTERLOCK;
}
- if (vp->v_vnlock != NULL) {
- /*
- * The lower level has exported a struct lock to us. Use
- * it so that all vnodes in the stack lock and unlock
- * simultaneously. Note: we don't DRAIN the lock as DRAIN
- * decommissions the lock - just because our vnode is
- * going away doesn't mean the struct lock below us is.
- * LK_EXCLUSIVE is fine.
- */
- return (vlockmgr(vp->v_vnlock, flags));
- } else {
- /*
- * Ahh well. It would be nice if the fs we're over would
- * export a struct lock for us to use, but it doesn't.
- *
- * To prevent race conditions involving doing a lookup
- * on "..", we have to lock the lower node, then lock our
- * node. Most of the time it won't matter that we lock our
- * node (as any locking would need the lower one locked
- * first).
- */
- lowervp = LAYERVPTOLOWERVP(vp);
- error = VOP_LOCK(lowervp, flags);
- if (error)
- return (error);
- if ((error = vlockmgr(&vp->v_lock, flags))) {
- VOP_UNLOCK(lowervp, 0);
- }
- return (error);
- }
+ return LAYERFS_DO_BYPASS(vp, ap);
}
-/*
- */
int
layer_unlock(void *v)
{
@@ -651,19 +613,8 @@
struct proc *a_p;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
- int flags = ap->a_flags;
-
- if (flags & LK_INTERLOCK) {
- mutex_exit(&vp->v_interlock);
- flags &= ~LK_INTERLOCK;
- }
- if (vp->v_vnlock != NULL) {
- return (vlockmgr(vp->v_vnlock, ap->a_flags | LK_RELEASE));
- } else {
- VOP_UNLOCK(LAYERVPTOLOWERVP(vp), flags);
- return (vlockmgr(&vp->v_lock, flags | LK_RELEASE));
- }
+ return LAYERFS_DO_BYPASS(vp, ap);
}
int
@@ -673,16 +624,8 @@
struct vnode *a_vp;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
- int lkstatus;
-
- if (vp->v_vnlock != NULL)
- return vlockstatus(vp->v_vnlock);
- lkstatus = VOP_ISLOCKED(LAYERVPTOLOWERVP(vp));
- if (lkstatus)
- return lkstatus;
-
- return vlockstatus(&vp->v_lock);
+ return LAYERFS_DO_BYPASS(vp, ap);
}
/*
Index: src/sys/miscfs/umapfs/umap_vnops.c
diff -u src/sys/miscfs/umapfs/umap_vnops.c:1.48 src/sys/miscfs/umapfs/umap_vnops.c:1.49
--- src/sys/miscfs/umapfs/umap_vnops.c:1.48 Fri Jan 8 11:35:11 2010
+++ src/sys/miscfs/umapfs/umap_vnops.c Sun Jun 6 08:01:31 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: umap_vnops.c,v 1.48 2010/01/08 11:35:11 pooka Exp $ */
+/* $NetBSD: umap_vnops.c,v 1.49 2010/06/06 08:01:31 hannken Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umap_vnops.c,v 1.48 2010/01/08 11:35:11 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umap_vnops.c,v 1.49 2010/06/06 08:01:31 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -124,7 +124,7 @@
kauth_cred_t savecredp = 0, savecompcredp = 0;
kauth_cred_t compcredp = 0;
struct vnode **this_vp_p;
- int error, error1;
+ int error;
struct vnode *old_vps[VDESC_MAX_VPS], *vp0;
struct vnode **vps_p[VDESC_MAX_VPS];
struct vnode ***vppp;
@@ -261,8 +261,6 @@
break; /* bail out at end of list */
if (old_vps[i]) {
*(vps_p[i]) = old_vps[i];
- if (reles & VDESC_VP0_WILLUNLOCK)
- LAYERFS_UPPERUNLOCK(*(vps_p[i]), 0, error1);
if (reles & VDESC_VP0_WILLRELE)
vrele(*(vps_p[i]));
}
Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.364 src/sys/sys/param.h:1.365
--- src/sys/sys/param.h:1.364 Sun May 2 05:31:47 2010
+++ src/sys/sys/param.h Sun Jun 6 08:01:32 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.364 2010/05/02 05:31:47 dholland Exp $ */
+/* $NetBSD: param.h,v 1.365 2010/06/06 08:01:32 hannken Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@@ -63,7 +63,7 @@
* 2.99.9 (299000900)
*/
-#define __NetBSD_Version__ 599002900 /* NetBSD 5.99.29 */
+#define __NetBSD_Version__ 599003000 /* NetBSD 5.99.30 */
#define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
(m) * 1000000) + (p) * 100) <= __NetBSD_Version__)
Index: src/sys/sys/vnode.h
diff -u src/sys/sys/vnode.h:1.218 src/sys/sys/vnode.h:1.219
--- src/sys/sys/vnode.h:1.218 Fri Apr 30 10:03:14 2010
+++ src/sys/sys/vnode.h Sun Jun 6 08:01:32 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: vnode.h,v 1.218 2010/04/30 10:03:14 pooka Exp $ */
+/* $NetBSD: vnode.h,v 1.219 2010/06/06 08:01:32 hannken Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -139,7 +139,7 @@
* n namecache_lock
* s syncer_data_lock
* u locked by underlying filesystem
- * v v_vnlock
+ * v v_lock
* x v_interlock + bufcache_lock to modify, either to inspect
*
* Each underlying filesystem allocates its own private area and hangs
@@ -177,7 +177,6 @@
enum vtype v_type; /* :: vnode type */
enum vtagtype v_tag; /* :: type of underlying data */
struct vnlock v_lock; /* v: lock for this vnode */
- struct vnlock *v_vnlock; /* v: pointer to lock */
void *v_data; /* :: private data for fs */
struct klist v_klist; /* i: notes attached to vnode */
};
@@ -193,20 +192,13 @@
typedef struct vnode vnode_t;
/*
- * All vnode locking operations should use vp->v_vnlock. For leaf filesystems
- * (such as ffs, lfs, msdosfs, etc), vp->v_vnlock = &vp->v_lock. For
- * stacked filesystems, vp->v_vnlock may equal lowervp->v_vnlock.
- *
- * vp->v_vnlock may also be NULL, which indicates that a leaf node does not
- * export a struct lock for vnode locking. Stacked filesystems (such as
- * nullfs) must call the underlying fs for locking. See layerfs_ routines
- * for examples.
+ * All vnode locking operations should use vp->v_lock.
*
* All filesystems must (pretend to) understand lockmanager flags.
*/
/*
- * Vnode flags. The first set are locked by vp->v_vnlock or are stable.
+ * Vnode flags. The first set are locked by vp->v_lock or are stable.
* VSYSTEM is only used to skip vflush()ing quota files. VISTTY is used
* when reading dead vnodes.
*/