track lockmgr lock status. makes lfs work again

This commit is contained in:
pooka 2007-08-12 13:34:11 +00:00
parent 5f3802ca6e
commit 74e8607136
2 changed files with 32 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lock_stub.c,v 1.4 2007/08/09 09:11:57 pooka Exp $ */
/* $NetBSD: lock_stub.c,v 1.5 2007/08/12 13:34:11 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -36,6 +36,33 @@
int
lockmgr(volatile struct lock *lock, u_int flags, struct simplelock *slock)
{
u_int lktype = flags & LK_TYPE_MASK;
switch (lktype) {
case LK_SHARED:
case LK_EXCLUSIVE:
lock->lk_flags = lktype;
break;
case LK_RELEASE:
lock->lk_flags = 0;
break;
case LK_UPGRADE:
case LK_EXCLUPGRADE:
assert(lock->lk_flags == LK_SHARED);
lock->lk_flags = LK_EXCLUSIVE;
break;
case LK_DOWNGRADE:
assert(lock->lk_flags == LK_EXCLUSIVE);
lock->lk_flags = LK_SHARED;
break;
case LK_DRAIN:
lock->lk_flags = LK_EXCLUSIVE;
break;
}
return 0;
}
@ -45,14 +72,14 @@ lockinit(struct lock *lock, pri_t prio, const char *wmesg, int timo,
int flags)
{
return;
lock->lk_flags = 0;
}
int
lockstatus(struct lock *lock)
{
return LK_EXCLUSIVE;
return lock->lk_flags;
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs.c,v 1.7 2007/08/09 20:57:23 pooka Exp $ */
/* $NetBSD: vfs.c,v 1.8 2007/08/12 13:34:11 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -82,6 +82,7 @@ getnewvnode(enum vtagtype tag, struct mount *mp, int (**vops)(void *),
vp->v_mount = mp;
vp->v_tag = tag;
vp->v_op = vops;
vp->v_vnlock = &vp->v_lock;
TAILQ_INSERT_TAIL(&mp->mnt_vnodelist, vp, v_mntvnodes);
uobj = &vp->v_uobj;