NDFREE() calculates unlock_dvp after ndp->ni_vp is unlocked and zeroed out. This makes the comparision of ni_dvp with ni_vp always fail.
Move the calculation of unlock_dvp right after unlock_vp, so that the code sees correct ni_vp value.
Differential D20304
NDFREE(): Fix unlocking for LOCKPARENT|LOCKLEAF and ndp->ni_dvp == ndp->ni_vp kib on May 18 2019, 5:57 PM. Authored by Tags None Referenced Files
Details NDFREE() calculates unlock_dvp after ndp->ni_vp is unlocked and zeroed out. This makes the comparision of ni_dvp with ni_vp always fail. Move the calculation of unlock_dvp right after unlock_vp, so that the code sees correct ni_vp value.
Diff Detail
Event TimelineComment Actions So if ni_dvp == ni_vp, does the caller hold two references on vp or one? It was not clear to me from some quick reading of the code. Comment Actions dvp == vp means that this was either dot lookup, or dotdot with vp == rootvp. For dotdot case, lookup() itself does the following: ndp->ni_dvp = dp; ndp->ni_vp = dp; VREF(dp); for the root directory case (also chroot, jail pseudo-roots). For UFS, ufs_lookup() takes a reference on the dvp directly in case of dot, see ufs_lookup(). So vp holds two references, but In either case, the code does not recurse on lock. Comment Actions I reproduced the problem and verified that the patch fixes it. |