diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -748,7 +748,7 @@ } static int -compute_cn_lkflags(struct mount *mp, int lkflags, int cnflags) +enforce_lkflags(struct mount *mp, int lkflags) { if (mp == NULL || ((lkflags & LK_SHARED) && @@ -815,9 +815,7 @@ cnp->cn_lkflags |= LK_EXCLUSIVE; } - vn_lock(dp, - compute_cn_lkflags(mp, cnp->cn_lkflags | LK_RETRY, - cnp->cn_flags)); + vn_lock(dp, enforce_lkflags(mp, cnp->cn_lkflags | LK_RETRY)); if (dp->v_type != VDIR) { error = ENOTDIR; @@ -1009,8 +1007,7 @@ * we adjust based on the requesting flags. */ vn_lock(dp, - compute_cn_lkflags(dp->v_mount, cnp->cn_lkflags | LK_RETRY, - cnp->cn_flags)); + enforce_lkflags(dp->v_mount, cnp->cn_lkflags | LK_RETRY)); dirloop: /* @@ -1149,8 +1146,8 @@ VREF(dp); vput(tdp); vn_lock(dp, - compute_cn_lkflags(dp->v_mount, cnp->cn_lkflags | - LK_RETRY, ISDOTDOT)); + enforce_lkflags(dp->v_mount, cnp->cn_lkflags | + LK_RETRY)); error = nameicap_check_dotdot(ndp, dp); if (error != 0) { capdotdot: @@ -1196,8 +1193,7 @@ vn_printf(dp, "lookup in "); #endif lkflags_save = cnp->cn_lkflags; - cnp->cn_lkflags = compute_cn_lkflags(dp->v_mount, cnp->cn_lkflags, - cnp->cn_flags); + cnp->cn_lkflags = enforce_lkflags(dp->v_mount, cnp->cn_lkflags); error = VOP_LOOKUP(dp, &ndp->ni_vp, cnp); cnp->cn_lkflags = lkflags_save; if (error != 0) { @@ -1213,8 +1209,8 @@ VREF(dp); vput(tdp); vn_lock(dp, - compute_cn_lkflags(dp->v_mount, cnp->cn_lkflags | - LK_RETRY, cnp->cn_flags)); + enforce_lkflags(dp->v_mount, cnp->cn_lkflags | + LK_RETRY)); nameicap_tracker_add(ndp, dp); goto unionlookup; } @@ -1303,8 +1299,7 @@ KASSERT(mp != NULL, ("%s: NULL mountpoint for VIRF_MOUNTPOINT vnode", __func__)); crosslock = (dp->v_vflag & VV_CROSSLOCK) != 0; - crosslkflags = compute_cn_lkflags(mp, cnp->cn_lkflags, - cnp->cn_flags); + crosslkflags = enforce_lkflags(mp, cnp->cn_lkflags); if (__predict_false(crosslock)) { /* * We are going to be holding the vnode lock, which