Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/vfs_lookup.c
Show First 20 Lines • Show All 561 Lines • ▼ Show 20 Lines | KASSERT((cnp->cn_flags & NAMEI_INTERNAL_FLAGS) == 0, | ||||
cnp->cn_flags & NAMEI_INTERNAL_FLAGS)); | cnp->cn_flags & NAMEI_INTERNAL_FLAGS)); | ||||
if (cnp->cn_flags & NOCACHE) | if (cnp->cn_flags & NOCACHE) | ||||
KASSERT(cnp->cn_nameiop != LOOKUP, | KASSERT(cnp->cn_nameiop != LOOKUP, | ||||
("%s: NOCACHE passed with LOOKUP", __func__)); | ("%s: NOCACHE passed with LOOKUP", __func__)); | ||||
MPASS(ndp->ni_startdir == NULL || ndp->ni_startdir->v_type == VDIR || | MPASS(ndp->ni_startdir == NULL || ndp->ni_startdir->v_type == VDIR || | ||||
ndp->ni_startdir->v_type == VBAD); | ndp->ni_startdir->v_type == VBAD); | ||||
ndp->ni_lcf = 0; | ndp->ni_lcf = 0; | ||||
ndp->ni_loopcnt = 0; | |||||
ndp->ni_vp = NULL; | ndp->ni_vp = NULL; | ||||
error = namei_getpath(ndp); | error = namei_getpath(ndp); | ||||
kib: This refactoring can be (and should) committed in advance. | |||||
Done Inline Actionsok mjg: ok | |||||
if (__predict_false(error != 0)) { | if (__predict_false(error != 0)) { | ||||
return (error); | return (error); | ||||
} | } | ||||
#ifdef KTRACE | #ifdef KTRACE | ||||
if (KTRPOINT(td, KTR_NAMEI)) { | if (KTRPOINT(td, KTR_NAMEI)) { | ||||
KASSERT(cnp->cn_thread == curthread, | KASSERT(cnp->cn_thread == curthread, | ||||
("namei not using curthread")); | ("namei not using curthread")); | ||||
Show All 14 Lines | #endif | ||||
case CACHE_FPL_STATUS_HANDLED: | case CACHE_FPL_STATUS_HANDLED: | ||||
if (error == 0) | if (error == 0) | ||||
NDVALIDATE(ndp); | NDVALIDATE(ndp); | ||||
return (error); | return (error); | ||||
case CACHE_FPL_STATUS_PARTIAL: | case CACHE_FPL_STATUS_PARTIAL: | ||||
TAILQ_INIT(&ndp->ni_cap_tracker); | TAILQ_INIT(&ndp->ni_cap_tracker); | ||||
dp = ndp->ni_startdir; | dp = ndp->ni_startdir; | ||||
break; | break; | ||||
case CACHE_FPL_STATUS_DESTROYED: | |||||
ndp->ni_loopcnt = 0; | |||||
error = namei_getpath(ndp); | |||||
if (__predict_false(error != 0)) { | |||||
return (error); | |||||
} | |||||
/* FALLTHROUGH */ | |||||
case CACHE_FPL_STATUS_ABORTED: | case CACHE_FPL_STATUS_ABORTED: | ||||
TAILQ_INIT(&ndp->ni_cap_tracker); | TAILQ_INIT(&ndp->ni_cap_tracker); | ||||
MPASS(ndp->ni_lcf == 0); | |||||
error = namei_setup(ndp, &dp, &pwd); | error = namei_setup(ndp, &dp, &pwd); | ||||
if (error != 0) { | if (error != 0) { | ||||
namei_cleanup_cnp(cnp); | namei_cleanup_cnp(cnp); | ||||
return (error); | return (error); | ||||
} | } | ||||
break; | break; | ||||
} | } | ||||
ndp->ni_loopcnt = 0; | |||||
/* | /* | ||||
* Locked lookup. | * Locked lookup. | ||||
*/ | */ | ||||
for (;;) { | for (;;) { | ||||
ndp->ni_startdir = dp; | ndp->ni_startdir = dp; | ||||
error = lookup(ndp); | error = lookup(ndp); | ||||
if (error != 0) { | if (error != 0) { | ||||
▲ Show 20 Lines • Show All 1,060 Lines • Show Last 20 Lines |
This refactoring can be (and should) committed in advance.