This changes give nullfs correctly work with latest unionfs.

Submitted by:   Masanori Ozawa <ozawa@ongs.co.jp> (unionfs developer)
Reviewed by:    jeff, kensmith
Approved by:    re (kensmith)
MFC after:      1 week
This commit is contained in:
daichi 2007-10-14 13:57:11 +00:00
parent b4e293afdf
commit 87bd60ac74
2 changed files with 25 additions and 5 deletions

View File

@ -298,6 +298,7 @@ null_checkvp(vp, fil, lno)
char *fil;
int lno;
{
int interlock = 0;
struct null_node *a = VTONULL(vp);
#ifdef notyet
/*
@ -321,6 +322,10 @@ null_checkvp(vp, fil, lno)
while (null_checkvp_barrier) /*WAIT*/ ;
panic("null_checkvp");
}
if (mtx_owned(VI_MTX(vp)) != 0) {
VI_UNLOCK(vp);
interlock = 1;
}
if (vrefcnt(a->null_lowervp) < 1) {
int i; u_long *p;
printf("vp = %p, unref'ed lowervp\n", (void *)vp);
@ -331,6 +336,8 @@ null_checkvp(vp, fil, lno)
while (null_checkvp_barrier) /*WAIT*/ ;
panic ("null with unref'ed lowervp");
};
if (interlock != 0)
VI_LOCK(vp);
#ifdef notyet
printf("null %x/%d -> %x/%d [%s, %d]\n",
NULLTOV(a), vrefcnt(NULLTOV(a)),

View File

@ -586,20 +586,33 @@ null_unlock(struct vop_unlock_args *ap)
{
struct vnode *vp = ap->a_vp;
int flags = ap->a_flags;
int mtxlkflag = 0;
struct thread *td = ap->a_td;
struct null_node *nn;
struct vnode *lvp;
int error;
if ((flags & LK_INTERLOCK) != 0) {
VI_UNLOCK(vp);
ap->a_flags = flags &= ~LK_INTERLOCK;
if ((flags & LK_INTERLOCK) != 0)
mtxlkflag = 1;
else if (mtx_owned(VI_MTX(vp)) == 0) {
VI_LOCK(vp);
mtxlkflag = 2;
}
nn = VTONULL(vp);
if (nn != NULL && (lvp = NULLVPTOLOWERVP(vp)) != NULL)
if (nn != NULL && (lvp = NULLVPTOLOWERVP(vp)) != NULL) {
VI_LOCK_FLAGS(lvp, MTX_DUPOK);
flags |= LK_INTERLOCK;
vholdl(lvp);
VI_UNLOCK(vp);
error = VOP_UNLOCK(lvp, flags, td);
else
vdrop(lvp);
if (mtxlkflag == 0)
VI_LOCK(vp);
} else {
if (mtxlkflag == 2)
VI_UNLOCK(vp);
error = vop_stdunlock(ap);
}
return (error);
}