summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2004-01-06 04:23:00 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2004-01-06 04:23:00 +0000
commit2a93b8cec68a87b45f96874d997d79df3d8a7483 (patch)
tree9c1a36b3beedbddc9a4f62416d7e0797bc7e79c2 /sys
parent24a4ca6116963009f48b3a9dc80fb2a91cf8f2d7 (diff)
keep track of a vnode's parent dir. ufs only, and unused atm, but
the fun stuff is coming. testing by brad.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_subr.c6
-rw-r--r--sys/sys/vnode.h3
-rw-r--r--sys/ufs/ufs/ufs_lookup.c6
3 files changed, 12 insertions, 3 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 54e92f6bf62..5174da110a9 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.95 2003/07/21 22:44:50 tedu Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.96 2004/01/06 04:22:59 tedu Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -1052,6 +1052,10 @@ vclean(vp, flags, p)
/*
* Reclaim the vnode.
*/
+ if (vp->v_parent) {
+ vrele(vp->v_parent);
+ vp->v_parent = NULL;
+ }
if (VOP_RECLAIM(vp, p))
panic("vclean: cannot reclaim");
if (active) {
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index 41cba99f777..7004d901390 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnode.h,v 1.56 2003/08/05 21:27:15 tedu Exp $ */
+/* $OpenBSD: vnode.h,v 1.57 2004/01/06 04:22:59 tedu Exp $ */
/* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */
/*
@@ -112,6 +112,7 @@ struct vnode {
struct lock v_lock;
struct lock *v_vnlock; /* used for non-locking fs's */
enum vtagtype v_tag; /* type of underlying data */
+ struct vnode *v_parent; /* parent directory */
void *v_data; /* private data for fs */
struct {
struct simplelock vsi_lock; /* lock to protect below */
diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c
index ea0619097ed..7340d071ad3 100644
--- a/sys/ufs/ufs/ufs_lookup.c
+++ b/sys/ufs/ufs/ufs_lookup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ufs_lookup.c,v 1.23 2003/12/28 17:20:16 tedu Exp $ */
+/* $OpenBSD: ufs_lookup.c,v 1.24 2004/01/06 04:22:59 tedu Exp $ */
/* $NetBSD: ufs_lookup.c,v 1.7 1996/02/09 22:36:06 christos Exp $ */
/*
@@ -624,6 +624,10 @@ found:
VOP_UNLOCK(pdp, 0, p);
cnp->cn_flags |= PDIRUNLOCK;
}
+ vref(vdp);
+ if (tdp->v_parent)
+ vrele(tdp->v_parent);
+ tdp->v_parent = vdp;
*vpp = tdp;
}