When parent directory has to be unlocked, lock it back with the same lock

type. Before this change, if directory was shared-locked, it was relocked
exclusively.
This commit is contained in:
Pawel Jakub Dawidek 2007-05-02 00:41:44 +00:00
parent 9167141244
commit 5bec66402b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169198
2 changed files with 12 additions and 4 deletions

View File

@ -1109,11 +1109,15 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp,
}
}
if (error == 0 && (nm[0] != '.' || nm[1] != '\0')) {
if (cnp->cn_flags & ISDOTDOT)
int ltype = 0;
if (cnp->cn_flags & ISDOTDOT) {
ltype = VOP_ISLOCKED(dvp, td);
VOP_UNLOCK(dvp, 0, td);
}
error = vn_lock(*vpp, cnp->cn_lkflags, td);
if (cnp->cn_flags & ISDOTDOT)
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td);
vn_lock(dvp, ltype | LK_RETRY, td);
if (error != 0) {
VN_RELE(*vpp);
*vpp = NULL;

View File

@ -1109,11 +1109,15 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp,
}
}
if (error == 0 && (nm[0] != '.' || nm[1] != '\0')) {
if (cnp->cn_flags & ISDOTDOT)
int ltype = 0;
if (cnp->cn_flags & ISDOTDOT) {
ltype = VOP_ISLOCKED(dvp, td);
VOP_UNLOCK(dvp, 0, td);
}
error = vn_lock(*vpp, cnp->cn_lkflags, td);
if (cnp->cn_flags & ISDOTDOT)
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td);
vn_lock(dvp, ltype | LK_RETRY, td);
if (error != 0) {
VN_RELE(*vpp);
*vpp = NULL;