- Don't panic if we can't lock a child in lookup, return an error instead.

- Only unlock the directory if this is a DOTDOT lookup.  Previously this
   code could have deadlocked if there was a DOTDOT lookup with LOCKPARENT
   set and another thread was locking the other way up the tree.

Sponsored by:	Isilon Systems, Inc.
This commit is contained in:
jeff 2005-03-28 13:39:16 +00:00
parent fc0171513c
commit 8468194797
2 changed files with 8 additions and 10 deletions

View File

@ -996,7 +996,7 @@ coda_lookup(struct vop_lookup_args *ap)
* we are ISLASTCN
*/
if (!error || (error == EJUSTRETURN)) {
if (!(cnp->cn_flags & LOCKPARENT) || !(cnp->cn_flags & ISLASTCN)) {
if (cnp->cn_flags & ISDOTDOT) {
if ((error = VOP_UNLOCK(dvp, 0, td))) {
return error;
}
@ -1006,8 +1006,8 @@ coda_lookup(struct vop_lookup_args *ap)
*/
if (*ap->a_vpp) {
if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, td))) {
printf("coda_lookup: ");
panic("unlocked parent but couldn't lock child");
vn_lock(dvp, LK_RETRY|LK_EXCLUSIVE, td);
return (error);
}
}
} else {
@ -1015,8 +1015,7 @@ coda_lookup(struct vop_lookup_args *ap)
if (*ap->a_vpp && (*ap->a_vpp != dvp)) {
/* Different, go ahead and lock it. */
if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, td))) {
printf("coda_lookup: ");
panic("unlocked parent but couldn't lock child");
return (error);
}
}
}

View File

@ -996,7 +996,7 @@ coda_lookup(struct vop_lookup_args *ap)
* we are ISLASTCN
*/
if (!error || (error == EJUSTRETURN)) {
if (!(cnp->cn_flags & LOCKPARENT) || !(cnp->cn_flags & ISLASTCN)) {
if (cnp->cn_flags & ISDOTDOT) {
if ((error = VOP_UNLOCK(dvp, 0, td))) {
return error;
}
@ -1006,8 +1006,8 @@ coda_lookup(struct vop_lookup_args *ap)
*/
if (*ap->a_vpp) {
if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, td))) {
printf("coda_lookup: ");
panic("unlocked parent but couldn't lock child");
vn_lock(dvp, LK_RETRY|LK_EXCLUSIVE, td);
return (error);
}
}
} else {
@ -1015,8 +1015,7 @@ coda_lookup(struct vop_lookup_args *ap)
if (*ap->a_vpp && (*ap->a_vpp != dvp)) {
/* Different, go ahead and lock it. */
if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, td))) {
printf("coda_lookup: ");
panic("unlocked parent but couldn't lock child");
return (error);
}
}
}