--- msdosfs_lookup.c.orig Mon Apr 10 04:39:57 2000 +++ msdosfs_lookup.c Sun Oct 22 23:52:33 2000 @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include @@ -124,6 +125,7 @@ int wincnt = 1; int chksum = -1; int olddos = 1; + cnp->cn_flags &= ~PDIRUNLOCK; #ifdef MSDOSFS_DEBUG printf("msdosfs_lookup(): looking for %s\n", cnp->cn_nameptr); @@ -379,8 +381,10 @@ * information cannot be used. */ cnp->cn_flags |= SAVENAME; - if (!lockparent) + if (!lockparent) { VOP_UNLOCK(vdp, 0, p); + cnp->cn_flags |= PDIRUNLOCK; + } return (EJUSTRETURN); } /* @@ -468,8 +472,10 @@ if (error) return (error); *vpp = DETOV(tdp); - if (!lockparent) + if (!lockparent) { VOP_UNLOCK(vdp, 0, p); + cnp->cn_flags |= PDIRUNLOCK; + } return (0); } @@ -499,8 +505,10 @@ return (error); *vpp = DETOV(tdp); cnp->cn_flags |= SAVENAME; - if (!lockparent) + if (!lockparent) { VOP_UNLOCK(vdp, 0, p); + cnp->cn_flags |= PDIRUNLOCK; + } return (0); } @@ -526,15 +534,20 @@ pdp = vdp; if (flags & ISDOTDOT) { VOP_UNLOCK(pdp, 0, p); + cnp->cn_flags |= PDIRUNLOCK; error = deget(pmp, cluster, blkoff, &tdp); if (error) { vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, p); + cnp->cn_flags &= ~PDIRUNLOCK; return (error); } - if (lockparent && (flags & ISLASTCN) && - (error = vn_lock(pdp, LK_EXCLUSIVE, p))) { - vput(DETOV(tdp)); - return (error); + if (lockparent && (flags & ISLASTCN)) { + error = vn_lock(pdp, LK_EXCLUSIVE, p); + if (error) { + vput(DETOV(tdp)); + return (error); + } + cnp->cn_flags &= ~PDIRUNLOCK; } *vpp = DETOV(tdp); } else if (dp->de_StartCluster == scn && isadir) { @@ -543,8 +556,10 @@ } else { if ((error = deget(pmp, cluster, blkoff, &tdp)) != 0) return (error); - if (!lockparent || !(flags & ISLASTCN)) + if (!lockparent || !(flags & ISLASTCN)) { VOP_UNLOCK(pdp, 0, p); + cnp->cn_flags |= PDIRUNLOCK; + } *vpp = DETOV(tdp); }