vfs: avoid VOP_ISLOCKED in the common case in lookup

This commit is contained in:
Mateusz Guzik 2016-11-30 02:14:53 +00:00
parent 54c7693f2c
commit 1babea0341
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=309307

View File

@ -807,10 +807,9 @@ lookup(struct nameidata *ndp)
* If we have a shared lock we may need to upgrade the lock for the
* last operation.
*/
if (dp != vp_crossmp &&
VOP_ISLOCKED(dp) == LK_SHARED &&
(cnp->cn_flags & ISLASTCN) && (cnp->cn_flags & LOCKPARENT))
vn_lock(dp, LK_UPGRADE|LK_RETRY);
if ((cnp->cn_flags & LOCKPARENT) && (cnp->cn_flags & ISLASTCN) &&
dp != vp_crossmp && VOP_ISLOCKED(dp) == LK_SHARED)
vn_lock(dp, LK_UPGRADE|LK_RETRY);
if ((dp->v_iflag & VI_DOOMED) != 0) {
error = ENOENT;
goto bad;