diff options
author | kato <kato@FreeBSD.org> | 1998-01-20 10:02:54 +0000 |
---|---|---|
committer | kato <kato@FreeBSD.org> | 1998-01-20 10:02:54 +0000 |
commit | d49fde64e88ed0930d98ea5752325d23d452a74c (patch) | |
tree | f94a3f25ebb61ec2c816446513a36a8e80e7c635 /sys/fs/unionfs/union_vnops.c | |
parent | 1b94ff548145fb10224df86f77d684ccfa34e93a (diff) | |
download | FreeBSD-src-d49fde64e88ed0930d98ea5752325d23d452a74c.zip FreeBSD-src-d49fde64e88ed0930d98ea5752325d23d452a74c.tar.gz |
- Move SETKLOC and CLEARKLOCK macros into uion.h.
- Set UN_ULOCK in union_lock() when UN_KLOCK is set. Caller expects
that vnode is locked correctly, and may call another function which
expects locked vnode and may unlock the vnode.
- Do not assume the behavior of inside functions in FreeBSD's
vfs_suber.c is same as 4.4BSD-Lite2. Vnode may be locked in
vget() even though flag is zero. (Locked vnode is, of course,
unlocked before returning from vget.)
Diffstat (limited to 'sys/fs/unionfs/union_vnops.c')
-rw-r--r-- | sys/fs/unionfs/union_vnops.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c index 1c6b124..d856da2 100644 --- a/sys/fs/unionfs/union_vnops.c +++ b/sys/fs/unionfs/union_vnops.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * @(#)union_vnops.c 8.32 (Berkeley) 6/23/95 - * $Id: union_vnops.c,v 1.47 1998/01/18 07:56:41 kato Exp $ + * $Id: union_vnops.c,v 1.48 1998/01/18 08:17:48 kato Exp $ */ #include <sys/param.h> @@ -58,9 +58,6 @@ } \ } -#define SETKLOCK(un) (un)->un_flags |= UN_KLOCK -#define CLEARKLOCK(un) (un)->un_flags &= ~UN_KLOCK - static int union_abortop __P((struct vop_abortop_args *ap)); static int union_access __P((struct vop_access_args *ap)); static int union_advlock __P((struct vop_advlock_args *ap)); @@ -1548,11 +1545,13 @@ start: un = VTOUNION(vp); if (un->un_uppervp != NULLVP) { - if (((un->un_flags & (UN_ULOCK | UN_KLOCK)) == 0) && + if (((un->un_flags & UN_ULOCK) == 0) && (vp->v_usecount != 0)) { - error = vn_lock(un->un_uppervp, flags, p); - if (error) - return (error); + if ((un->un_flags & UN_KLOCK) == 0) { + error = vn_lock(un->un_uppervp, flags, p); + if (error) + return (error); + } un->un_flags |= UN_ULOCK; } } @@ -1590,6 +1589,10 @@ start: * * If UN_KLOCK isn't set, then the upper vnode is unlocked here. */ +/* + * FreeBSD: Do not cleark UN_KLOCK flag. UN_KLOCK flag is tested + * in union_lock(). + */ static int union_unlock(ap) struct vop_unlock_args /* { |