Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/union VOP_ABORTOP() has no specific lock requirements...
details: https://anonhg.NetBSD.org/src/rev/cc95c144f84f
branches: trunk
changeset: 771219:cc95c144f84f
user: hannken <hannken%NetBSD.org@localhost>
date: Mon Nov 14 18:42:57 2011 +0000
description:
VOP_ABORTOP() has no specific lock requirements so there is no need
to force locked vnodes here. It should be impossible to come here
with a nil upper node.
Relock the directory vnode after copyup. A locked union node with an
unlocked upper vnode can no longer exist so make FIXUP() an assertion.
diffstat:
sys/fs/union/union_vnops.c | 44 +++++++++++---------------------------------
1 files changed, 11 insertions(+), 33 deletions(-)
diffs (91 lines):
diff -r f21a639794dc -r cc95c144f84f sys/fs/union/union_vnops.c
--- a/sys/fs/union/union_vnops.c Mon Nov 14 18:38:13 2011 +0000
+++ b/sys/fs/union/union_vnops.c Mon Nov 14 18:42:57 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: union_vnops.c,v 1.47 2011/10/18 09:22:53 hannken Exp $ */
+/* $NetBSD: union_vnops.c,v 1.48 2011/11/14 18:42:57 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.47 2011/10/18 09:22:53 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.48 2011/11/14 18:42:57 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -134,7 +134,6 @@
int union_putpages(void *);
int union_kqfilter(void *);
-static void union_fixup(struct union_node *);
static int union_lookup1(struct vnode *, struct vnode **,
struct vnode **, struct componentname *);
@@ -190,23 +189,12 @@
const struct vnodeopv_desc union_vnodeop_opv_desc =
{ &union_vnodeop_p, union_vnodeop_entries };
-#define FIXUP(un) { \
- if (((un)->un_flags & UN_ULOCK) == 0) { \
- union_fixup(un); \
- } \
-}
+#define FIXUP(un) \
+ KASSERT(((un)->un_flags & UN_ULOCK) == UN_ULOCK)
#define NODE_IS_SPECIAL(vp) \
((vp)->v_type == VBLK || (vp)->v_type == VCHR || \
(vp)->v_type == VSOCK || (vp)->v_type == VFIFO)
-static void
-union_fixup(struct union_node *un)
-{
-
- vn_lock(un->un_uppervp, LK_EXCLUSIVE | LK_RETRY);
- un->un_flags |= UN_ULOCK;
-}
-
static int
union_lookup1(struct vnode *udvp, struct vnode **dvpp, struct vnode **vpp,
struct componentname *cnp)
@@ -1248,6 +1236,9 @@
}
error = union_copyup(un, 1, cnp->cn_cred, curlwp);
if (dun->un_uppervp == un->un_dirvp) {
+ vn_lock(dun->un_uppervp,
+ LK_EXCLUSIVE | LK_RETRY);
+ dun->un_flags |= UN_ULOCK;
/*
* During copyup, we dropped the lock on the
* dir and invalidated any saved namei lookup
@@ -1583,24 +1574,11 @@
struct vnode *a_dvp;
struct componentname *a_cnp;
} */ *ap = v;
- int error;
- struct vnode *vp = OTHERVP(ap->a_dvp);
- struct union_node *un = VTOUNION(ap->a_dvp);
- int islocked = un->un_flags & UN_LOCKED;
- int dolock = (vp == LOWERVP(ap->a_dvp));
+
+ KASSERT(UPPERVP(ap->a_dvp) != NULL);
- if (islocked) {
- if (dolock)
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
- else
- FIXUP(VTOUNION(ap->a_dvp));
- }
- ap->a_dvp = vp;
- error = VCALL(vp, VOFFSET(vop_abortop), ap);
- if (islocked && dolock)
- VOP_UNLOCK(vp);
-
- return (error);
+ ap->a_dvp = UPPERVP(ap->a_dvp);
+ return VCALL(ap->a_dvp, VOFFSET(vop_abortop), ap);
}
int
Home |
Main Index |
Thread Index |
Old Index