diff options
author | jeff <jeff@FreeBSD.org> | 2005-03-28 13:39:16 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2005-03-28 13:39:16 +0000 |
commit | d673a4826633faadb96b1af1bb89da1e0a2d8db0 (patch) | |
tree | c8f407790ce3e21fd569d53180dc1c77c6b3372e /sys | |
parent | c4f7e758965ef1d0d15b468f53147e828a0abd70 (diff) | |
download | FreeBSD-src-d673a4826633faadb96b1af1bb89da1e0a2d8db0.zip FreeBSD-src-d673a4826633faadb96b1af1bb89da1e0a2d8db0.tar.gz |
- 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.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/coda/coda_vnops.c | 9 | ||||
-rw-r--r-- | sys/fs/coda/coda_vnops.c | 9 |
2 files changed, 8 insertions, 10 deletions
diff --git a/sys/coda/coda_vnops.c b/sys/coda/coda_vnops.c index 389f78b..c8cf74d 100644 --- a/sys/coda/coda_vnops.c +++ b/sys/coda/coda_vnops.c @@ -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); } } } diff --git a/sys/fs/coda/coda_vnops.c b/sys/fs/coda/coda_vnops.c index 389f78b..c8cf74d 100644 --- a/sys/fs/coda/coda_vnops.c +++ b/sys/fs/coda/coda_vnops.c @@ -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); } } } |