Lines Matching refs:fpl
4123 static bool cache_fplookup_is_mp(struct cache_fpl *fpl);
4124 static int cache_fplookup_cross_mount(struct cache_fpl *fpl);
4125 static int cache_fplookup_partial_setup(struct cache_fpl *fpl);
4126 static int cache_fplookup_skip_slashes(struct cache_fpl *fpl);
4127 static int cache_fplookup_trailingslash(struct cache_fpl *fpl);
4128 static void cache_fpl_pathlen_dec(struct cache_fpl *fpl);
4129 static void cache_fpl_pathlen_inc(struct cache_fpl *fpl);
4130 static void cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n);
4131 static void cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n);
4143 cache_fpl_handle_root(struct cache_fpl *fpl) in cache_fpl_handle_root() argument
4148 ndp = fpl->ndp; in cache_fpl_handle_root()
4149 cnp = fpl->cnp; in cache_fpl_handle_root()
4153 cache_fpl_pathlen_dec(fpl); in cache_fpl_handle_root()
4158 cache_fpl_pathlen_dec(fpl); in cache_fpl_handle_root()
4166 cache_fpl_checkpoint_outer(struct cache_fpl *fpl) in cache_fpl_checkpoint_outer() argument
4169 fpl->snd_outer.ni_pathlen = fpl->ndp->ni_pathlen; in cache_fpl_checkpoint_outer()
4170 fpl->snd_outer.cn_flags = fpl->ndp->ni_cnd.cn_flags; in cache_fpl_checkpoint_outer()
4174 cache_fpl_checkpoint(struct cache_fpl *fpl) in cache_fpl_checkpoint() argument
4178 fpl->snd.cn_nameptr = fpl->ndp->ni_cnd.cn_nameptr; in cache_fpl_checkpoint()
4179 fpl->snd.ni_pathlen = fpl->debug.ni_pathlen; in cache_fpl_checkpoint()
4184 cache_fpl_restore_partial(struct cache_fpl *fpl) in cache_fpl_restore_partial() argument
4187 fpl->ndp->ni_cnd.cn_flags = fpl->snd_outer.cn_flags; in cache_fpl_restore_partial()
4189 fpl->debug.ni_pathlen = fpl->snd.ni_pathlen; in cache_fpl_restore_partial()
4194 cache_fpl_restore_abort(struct cache_fpl *fpl) in cache_fpl_restore_abort() argument
4197 cache_fpl_restore_partial(fpl); in cache_fpl_restore_abort()
4201 fpl->ndp->ni_resflags = 0; in cache_fpl_restore_abort()
4202 fpl->ndp->ni_cnd.cn_nameptr = fpl->ndp->ni_cnd.cn_pnbuf; in cache_fpl_restore_abort()
4203 fpl->ndp->ni_pathlen = fpl->snd_outer.ni_pathlen; in cache_fpl_restore_abort()
4207 #define cache_fpl_smr_assert_entered(fpl) ({ \ argument
4208 struct cache_fpl *_fpl = (fpl); \
4212 #define cache_fpl_smr_assert_not_entered(fpl) ({ \ argument
4213 struct cache_fpl *_fpl = (fpl); \
4218 cache_fpl_assert_status(struct cache_fpl *fpl) in cache_fpl_assert_status() argument
4221 switch (fpl->status) { in cache_fpl_assert_status()
4233 #define cache_fpl_smr_assert_entered(fpl) do { } while (0) argument
4234 #define cache_fpl_smr_assert_not_entered(fpl) do { } while (0) argument
4235 #define cache_fpl_assert_status(fpl) do { } while (0) argument
4238 #define cache_fpl_smr_enter_initial(fpl) ({ \ argument
4239 struct cache_fpl *_fpl = (fpl); \
4244 #define cache_fpl_smr_enter(fpl) ({ \ argument
4245 struct cache_fpl *_fpl = (fpl); \
4251 #define cache_fpl_smr_exit(fpl) ({ \ argument
4252 struct cache_fpl *_fpl = (fpl); \
4259 cache_fpl_aborted_early_impl(struct cache_fpl *fpl, int line) in cache_fpl_aborted_early_impl() argument
4262 if (fpl->status != CACHE_FPL_STATUS_UNSET) { in cache_fpl_aborted_early_impl()
4263 KASSERT(fpl->status == CACHE_FPL_STATUS_PARTIAL, in cache_fpl_aborted_early_impl()
4265 __func__, fpl->status, line, fpl->line)); in cache_fpl_aborted_early_impl()
4267 cache_fpl_smr_assert_not_entered(fpl); in cache_fpl_aborted_early_impl()
4268 fpl->status = CACHE_FPL_STATUS_ABORTED; in cache_fpl_aborted_early_impl()
4269 fpl->line = line; in cache_fpl_aborted_early_impl()
4276 cache_fpl_aborted_impl(struct cache_fpl *fpl, int line) in cache_fpl_aborted_impl() argument
4281 ndp = fpl->ndp; in cache_fpl_aborted_impl()
4282 cnp = fpl->cnp; in cache_fpl_aborted_impl()
4284 if (fpl->status != CACHE_FPL_STATUS_UNSET) { in cache_fpl_aborted_impl()
4285 KASSERT(fpl->status == CACHE_FPL_STATUS_PARTIAL, in cache_fpl_aborted_impl()
4287 __func__, fpl->status, line, fpl->line)); in cache_fpl_aborted_impl()
4289 fpl->status = CACHE_FPL_STATUS_ABORTED; in cache_fpl_aborted_impl()
4290 fpl->line = line; in cache_fpl_aborted_impl()
4291 if (fpl->in_smr) in cache_fpl_aborted_impl()
4292 cache_fpl_smr_exit(fpl); in cache_fpl_aborted_impl()
4293 cache_fpl_restore_abort(fpl); in cache_fpl_aborted_impl()
4299 fpl->status = CACHE_FPL_STATUS_DESTROYED; in cache_fpl_aborted_impl()
4308 cache_fpl_partial_impl(struct cache_fpl *fpl, int line) in cache_fpl_partial_impl() argument
4311 KASSERT(fpl->status == CACHE_FPL_STATUS_UNSET, in cache_fpl_partial_impl()
4313 __func__, line, fpl->status, fpl->line)); in cache_fpl_partial_impl()
4314 cache_fpl_smr_assert_entered(fpl); in cache_fpl_partial_impl()
4315 fpl->status = CACHE_FPL_STATUS_PARTIAL; in cache_fpl_partial_impl()
4316 fpl->line = line; in cache_fpl_partial_impl()
4317 return (cache_fplookup_partial_setup(fpl)); in cache_fpl_partial_impl()
4323 cache_fpl_handled_impl(struct cache_fpl *fpl, int line) in cache_fpl_handled_impl() argument
4326 KASSERT(fpl->status == CACHE_FPL_STATUS_UNSET, in cache_fpl_handled_impl()
4328 __func__, line, fpl->status, fpl->line)); in cache_fpl_handled_impl()
4329 cache_fpl_smr_assert_not_entered(fpl); in cache_fpl_handled_impl()
4330 fpl->status = CACHE_FPL_STATUS_HANDLED; in cache_fpl_handled_impl()
4331 fpl->line = line; in cache_fpl_handled_impl()
4338 cache_fpl_handled_error_impl(struct cache_fpl *fpl, int error, int line) in cache_fpl_handled_error_impl() argument
4341 KASSERT(fpl->status == CACHE_FPL_STATUS_UNSET, in cache_fpl_handled_error_impl()
4343 __func__, line, fpl->status, fpl->line)); in cache_fpl_handled_error_impl()
4346 cache_fpl_smr_assert_not_entered(fpl); in cache_fpl_handled_error_impl()
4347 fpl->status = CACHE_FPL_STATUS_HANDLED; in cache_fpl_handled_error_impl()
4348 fpl->line = line; in cache_fpl_handled_error_impl()
4349 fpl->dvp = NULL; in cache_fpl_handled_error_impl()
4350 fpl->tvp = NULL; in cache_fpl_handled_error_impl()
4357 cache_fpl_terminated(struct cache_fpl *fpl) in cache_fpl_terminated() argument
4360 return (fpl->status != CACHE_FPL_STATUS_UNSET); in cache_fpl_terminated()
4383 cache_fpl_istrailingslash(struct cache_fpl *fpl) in cache_fpl_istrailingslash() argument
4386 MPASS(fpl->nulchar > fpl->cnp->cn_pnbuf); in cache_fpl_istrailingslash()
4387 return (*(fpl->nulchar - 1) == '/'); in cache_fpl_istrailingslash()
4401 cache_can_fplookup(struct cache_fpl *fpl) in cache_can_fplookup() argument
4407 ndp = fpl->ndp; in cache_can_fplookup()
4408 cnp = fpl->cnp; in cache_can_fplookup()
4412 cache_fpl_aborted_early(fpl); in cache_can_fplookup()
4416 cache_fpl_aborted_early(fpl); in cache_can_fplookup()
4420 cache_fpl_aborted_early(fpl); in cache_can_fplookup()
4424 cache_fpl_aborted_early(fpl); in cache_can_fplookup()
4428 cache_fpl_aborted_early(fpl); in cache_can_fplookup()
4435 cache_fplookup_dirfd(struct cache_fpl *fpl, struct vnode **vpp) in cache_fplookup_dirfd() argument
4442 ndp = fpl->ndp; in cache_fplookup_dirfd()
4443 cnp = fpl->cnp; in cache_fplookup_dirfd()
4447 return (cache_fpl_aborted(fpl)); in cache_fplookup_dirfd()
4449 fpl->fsearch = fsearch; in cache_fplookup_dirfd()
4452 cache_fpl_smr_exit(fpl); in cache_fplookup_dirfd()
4453 return (cache_fpl_handled_error(fpl, ENOTDIR)); in cache_fplookup_dirfd()
4460 cache_fplookup_negative_promote(struct cache_fpl *fpl, struct namecache *oncp, in cache_fplookup_negative_promote() argument
4466 cnp = fpl->cnp; in cache_fplookup_negative_promote()
4467 dvp = fpl->dvp; in cache_fplookup_negative_promote()
4469 cache_fpl_smr_exit(fpl); in cache_fplookup_negative_promote()
4471 return (cache_fpl_handled_error(fpl, ENOENT)); in cache_fplookup_negative_promote()
4473 return (cache_fpl_aborted(fpl)); in cache_fplookup_negative_promote()
4480 cache_fplookup_partial_setup(struct cache_fpl *fpl) in cache_fplookup_partial_setup() argument
4489 ndp = fpl->ndp; in cache_fplookup_partial_setup()
4490 cnp = fpl->cnp; in cache_fplookup_partial_setup()
4491 pwd = *(fpl->pwd); in cache_fplookup_partial_setup()
4492 dvp = fpl->dvp; in cache_fplookup_partial_setup()
4493 dvp_seqc = fpl->dvp_seqc; in cache_fplookup_partial_setup()
4496 return (cache_fpl_aborted(fpl)); in cache_fplookup_partial_setup()
4510 cache_fpl_smr_exit(fpl); in cache_fplookup_partial_setup()
4513 return (cache_fpl_aborted(fpl)); in cache_fplookup_partial_setup()
4520 return (cache_fpl_aborted(fpl)); in cache_fplookup_partial_setup()
4523 cache_fpl_restore_partial(fpl); in cache_fplookup_partial_setup()
4525 if (cnp->cn_nameptr != fpl->snd.cn_nameptr) { in cache_fplookup_partial_setup()
4527 cnp->cn_nameptr, fpl->snd.cn_nameptr, cnp->cn_pnbuf); in cache_fplookup_partial_setup()
4545 cache_fpl_pathlen_dec(fpl); in cache_fplookup_partial_setup()
4549 ndp->ni_pathlen = fpl->nulchar - cnp->cn_nameptr + 1; in cache_fplookup_partial_setup()
4551 if (ndp->ni_pathlen != fpl->debug.ni_pathlen) { in cache_fplookup_partial_setup()
4553 __func__, ndp->ni_pathlen, fpl->debug.ni_pathlen, fpl->nulchar, in cache_fplookup_partial_setup()
4561 cache_fplookup_final_child(struct cache_fpl *fpl, enum vgetstate tvs) in cache_fplookup_final_child() argument
4568 cnp = fpl->cnp; in cache_fplookup_final_child()
4569 tvp = fpl->tvp; in cache_fplookup_final_child()
4570 tvp_seqc = fpl->tvp_seqc; in cache_fplookup_final_child()
4578 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_child()
4589 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_child()
4592 return (cache_fpl_handled(fpl)); in cache_fplookup_final_child()
4599 cache_fplookup_final_modifying(struct cache_fpl *fpl) in cache_fplookup_final_modifying() argument
4610 ndp = fpl->ndp; in cache_fplookup_final_modifying()
4611 cnp = fpl->cnp; in cache_fplookup_final_modifying()
4612 dvp = fpl->dvp; in cache_fplookup_final_modifying()
4613 dvp_seqc = fpl->dvp_seqc; in cache_fplookup_final_modifying()
4634 if (cache_fpl_istrailingslash(fpl)) { in cache_fplookup_final_modifying()
4635 return (cache_fpl_partial(fpl)); in cache_fplookup_final_modifying()
4640 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4644 cache_fpl_smr_exit(fpl); in cache_fplookup_final_modifying()
4650 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4652 return (cache_fpl_handled_error(fpl, EROFS)); in cache_fplookup_final_modifying()
4655 if (fpl->tvp != NULL && (cnp->cn_flags & FAILIFEXISTS) != 0) { in cache_fplookup_final_modifying()
4656 cache_fpl_smr_exit(fpl); in cache_fplookup_final_modifying()
4657 return (cache_fpl_handled_error(fpl, EEXIST)); in cache_fplookup_final_modifying()
4675 cache_fpl_smr_exit(fpl); in cache_fplookup_final_modifying()
4677 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4683 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4689 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4707 return (cache_fpl_handled_error(fpl, error)); in cache_fplookup_final_modifying()
4710 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4713 fpl->tvp = tvp; in cache_fplookup_final_modifying()
4720 return (cache_fpl_handled(fpl)); in cache_fplookup_final_modifying()
4733 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4744 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4752 if (__predict_false(cache_fplookup_is_mp(fpl))) { in cache_fplookup_final_modifying()
4755 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4761 return (cache_fpl_handled_error(fpl, EEXIST)); in cache_fplookup_final_modifying()
4772 return (cache_fpl_handled(fpl)); in cache_fplookup_final_modifying()
4776 cache_fplookup_modifying(struct cache_fpl *fpl) in cache_fplookup_modifying() argument
4780 ndp = fpl->ndp; in cache_fplookup_modifying()
4783 return (cache_fpl_partial(fpl)); in cache_fplookup_modifying()
4785 return (cache_fplookup_final_modifying(fpl)); in cache_fplookup_modifying()
4789 cache_fplookup_final_withparent(struct cache_fpl *fpl) in cache_fplookup_final_withparent() argument
4797 cnp = fpl->cnp; in cache_fplookup_final_withparent()
4798 dvp = fpl->dvp; in cache_fplookup_final_withparent()
4799 dvp_seqc = fpl->dvp_seqc; in cache_fplookup_final_withparent()
4800 tvp = fpl->tvp; in cache_fplookup_final_withparent()
4809 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_withparent()
4813 cache_fpl_smr_exit(fpl); in cache_fplookup_final_withparent()
4815 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_withparent()
4818 cache_fpl_smr_exit(fpl); in cache_fplookup_final_withparent()
4824 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_withparent()
4836 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_withparent()
4839 error = cache_fplookup_final_child(fpl, tvs); in cache_fplookup_final_withparent()
4841 MPASS(fpl->status == CACHE_FPL_STATUS_ABORTED || in cache_fplookup_final_withparent()
4842 fpl->status == CACHE_FPL_STATUS_DESTROYED); in cache_fplookup_final_withparent()
4850 MPASS(fpl->status == CACHE_FPL_STATUS_HANDLED); in cache_fplookup_final_withparent()
4855 cache_fplookup_final(struct cache_fpl *fpl) in cache_fplookup_final() argument
4862 cnp = fpl->cnp; in cache_fplookup_final()
4863 dvp = fpl->dvp; in cache_fplookup_final()
4864 dvp_seqc = fpl->dvp_seqc; in cache_fplookup_final()
4865 tvp = fpl->tvp; in cache_fplookup_final()
4870 return (cache_fplookup_final_modifying(fpl)); in cache_fplookup_final()
4874 return (cache_fplookup_final_withparent(fpl)); in cache_fplookup_final()
4878 return (cache_fpl_partial(fpl)); in cache_fplookup_final()
4882 cache_fpl_smr_exit(fpl); in cache_fplookup_final()
4884 return (cache_fpl_aborted(fpl)); in cache_fplookup_final()
4887 cache_fpl_smr_exit(fpl); in cache_fplookup_final()
4888 return (cache_fplookup_final_child(fpl, tvs)); in cache_fplookup_final()
4897 cache_fplookup_degenerate(struct cache_fpl *fpl) in cache_fplookup_degenerate() argument
4907 fpl->tvp = fpl->dvp; in cache_fplookup_degenerate()
4908 fpl->tvp_seqc = fpl->dvp_seqc; in cache_fplookup_degenerate()
4910 cnp = fpl->cnp; in cache_fplookup_degenerate()
4911 dvp = fpl->dvp; in cache_fplookup_degenerate()
4922 cache_fpl_smr_exit(fpl); in cache_fplookup_degenerate()
4923 return (cache_fpl_handled_error(fpl, EISDIR)); in cache_fplookup_degenerate()
4927 return (cache_fplookup_final_withparent(fpl)); in cache_fplookup_degenerate()
4931 cache_fpl_smr_exit(fpl); in cache_fplookup_degenerate()
4933 return (cache_fpl_aborted(fpl)); in cache_fplookup_degenerate()
4942 return (cache_fpl_aborted(fpl)); in cache_fplookup_degenerate()
4947 return (cache_fpl_handled(fpl)); in cache_fplookup_degenerate()
4951 cache_fplookup_emptypath(struct cache_fpl *fpl) in cache_fplookup_emptypath() argument
4959 fpl->tvp = fpl->dvp; in cache_fplookup_emptypath()
4960 fpl->tvp_seqc = fpl->dvp_seqc; in cache_fplookup_emptypath()
4962 ndp = fpl->ndp; in cache_fplookup_emptypath()
4963 cnp = fpl->cnp; in cache_fplookup_emptypath()
4964 tvp = fpl->tvp; in cache_fplookup_emptypath()
4969 cache_fpl_smr_exit(fpl); in cache_fplookup_emptypath()
4970 return (cache_fpl_handled_error(fpl, ENOENT)); in cache_fplookup_emptypath()
4976 cache_fpl_smr_exit(fpl); in cache_fplookup_emptypath()
4978 return (cache_fpl_aborted(fpl)); in cache_fplookup_emptypath()
4987 return (cache_fpl_aborted(fpl)); in cache_fplookup_emptypath()
4994 return (cache_fpl_handled(fpl)); in cache_fplookup_emptypath()
4998 cache_fplookup_noentry(struct cache_fpl *fpl) in cache_fplookup_noentry() argument
5007 ndp = fpl->ndp; in cache_fplookup_noentry()
5008 cnp = fpl->cnp; in cache_fplookup_noentry()
5009 dvp = fpl->dvp; in cache_fplookup_noentry()
5010 dvp_seqc = fpl->dvp_seqc; in cache_fplookup_noentry()
5022 cache_fpl_smr_exit(fpl); in cache_fplookup_noentry()
5023 return (cache_fpl_handled_error(fpl, ENAMETOOLONG)); in cache_fplookup_noentry()
5027 return (cache_fplookup_skip_slashes(fpl)); in cache_fplookup_noentry()
5031 return (cache_fplookup_emptypath(fpl)); in cache_fplookup_noentry()
5035 if (fpl->tvp == NULL) { in cache_fplookup_noentry()
5036 return (cache_fplookup_degenerate(fpl)); in cache_fplookup_noentry()
5038 return (cache_fplookup_trailingslash(fpl)); in cache_fplookup_noentry()
5042 fpl->tvp = NULL; in cache_fplookup_noentry()
5043 return (cache_fplookup_modifying(fpl)); in cache_fplookup_noentry()
5052 return (cache_fpl_partial(fpl)); in cache_fplookup_noentry()
5060 if (cache_fpl_istrailingslash(fpl)) { in cache_fplookup_noentry()
5061 return (cache_fpl_partial(fpl)); in cache_fplookup_noentry()
5069 cache_fpl_smr_exit(fpl); in cache_fplookup_noentry()
5071 return (cache_fpl_aborted(fpl)); in cache_fplookup_noentry()
5077 return (cache_fpl_aborted(fpl)); in cache_fplookup_noentry()
5083 return (cache_fpl_aborted(fpl)); in cache_fplookup_noentry()
5103 return (cache_fpl_handled_error(fpl, error)); in cache_fplookup_noentry()
5106 return (cache_fpl_aborted(fpl)); in cache_fplookup_noentry()
5109 fpl->tvp = tvp; in cache_fplookup_noentry()
5118 return (cache_fpl_handled(fpl)); in cache_fplookup_noentry()
5125 return (cache_fpl_aborted(fpl)); in cache_fplookup_noentry()
5129 if (__predict_false(cache_fplookup_is_mp(fpl))) { in cache_fplookup_noentry()
5132 return (cache_fpl_aborted(fpl)); in cache_fplookup_noentry()
5144 return (cache_fpl_handled(fpl)); in cache_fplookup_noentry()
5148 cache_fplookup_dot(struct cache_fpl *fpl) in cache_fplookup_dot() argument
5152 MPASS(!seqc_in_modify(fpl->dvp_seqc)); in cache_fplookup_dot()
5154 if (__predict_false(fpl->dvp->v_type != VDIR)) { in cache_fplookup_dot()
5155 cache_fpl_smr_exit(fpl); in cache_fplookup_dot()
5156 return (cache_fpl_handled_error(fpl, ENOTDIR)); in cache_fplookup_dot()
5164 fpl->tvp = fpl->dvp; in cache_fplookup_dot()
5165 fpl->tvp_seqc = fpl->dvp_seqc; in cache_fplookup_dot()
5167 SDT_PROBE3(vfs, namecache, lookup, hit, fpl->dvp, ".", fpl->dvp); in cache_fplookup_dot()
5170 if (cache_fplookup_is_mp(fpl)) { in cache_fplookup_dot()
5171 error = cache_fplookup_cross_mount(fpl); in cache_fplookup_dot()
5177 cache_fplookup_dotdot(struct cache_fpl *fpl) in cache_fplookup_dotdot() argument
5186 ndp = fpl->ndp; in cache_fplookup_dotdot()
5187 cnp = fpl->cnp; in cache_fplookup_dotdot()
5188 dvp = fpl->dvp; in cache_fplookup_dotdot()
5204 fpl->tvp = dvp; in cache_fplookup_dotdot()
5205 fpl->tvp_seqc = vn_seqc_read_any(dvp); in cache_fplookup_dotdot()
5206 if (seqc_in_modify(fpl->tvp_seqc)) { in cache_fplookup_dotdot()
5207 return (cache_fpl_aborted(fpl)); in cache_fplookup_dotdot()
5217 return (cache_fpl_partial(fpl)); in cache_fplookup_dotdot()
5221 cache_fpl_smr_exit(fpl); in cache_fplookup_dotdot()
5222 return (cache_fpl_handled_error(fpl, ENOTDIR)); in cache_fplookup_dotdot()
5227 return (cache_fpl_aborted(fpl)); in cache_fplookup_dotdot()
5233 return (cache_fpl_aborted(fpl)); in cache_fplookup_dotdot()
5234 fpl->tvp = ncp->nc_vp; in cache_fplookup_dotdot()
5236 fpl->tvp = ncp->nc_dvp; in cache_fplookup_dotdot()
5239 fpl->tvp_seqc = vn_seqc_read_any(fpl->tvp); in cache_fplookup_dotdot()
5240 if (seqc_in_modify(fpl->tvp_seqc)) { in cache_fplookup_dotdot()
5241 return (cache_fpl_partial(fpl)); in cache_fplookup_dotdot()
5248 return (cache_fpl_aborted(fpl)); in cache_fplookup_dotdot()
5252 return (cache_fpl_aborted(fpl)); in cache_fplookup_dotdot()
5259 cache_fplookup_neg(struct cache_fpl *fpl, struct namecache *ncp, uint32_t hash) in cache_fplookup_neg() argument
5271 if (__predict_false(fpl->cnp->cn_nameiop != LOOKUP)) { in cache_fplookup_neg()
5272 fpl->tvp = NULL; in cache_fplookup_neg()
5273 return (cache_fplookup_modifying(fpl)); in cache_fplookup_neg()
5278 return (cache_fpl_partial(fpl)); in cache_fplookup_neg()
5281 return (cache_fplookup_negative_promote(fpl, ncp, hash)); in cache_fplookup_neg()
5284 cache_fpl_smr_exit(fpl); in cache_fplookup_neg()
5285 return (cache_fpl_handled_error(fpl, ENOENT)); in cache_fplookup_neg()
5295 cache_symlink_resolve(struct cache_fpl *fpl, const char *string, size_t len) in cache_symlink_resolve() argument
5301 ndp = fpl->ndp; in cache_symlink_resolve()
5302 cnp = fpl->cnp; in cache_symlink_resolve()
5309 if (cache_fpl_istrailingslash(fpl)) { in cache_symlink_resolve()
5314 ndp->ni_pathlen = fpl->nulchar - cnp->cn_nameptr - cnp->cn_namelen + 1; in cache_symlink_resolve()
5316 if (ndp->ni_pathlen != fpl->debug.ni_pathlen) { in cache_symlink_resolve()
5318 __func__, ndp->ni_pathlen, fpl->debug.ni_pathlen, fpl->nulchar, in cache_symlink_resolve()
5335 if (cache_fpl_istrailingslash(fpl)) { in cache_symlink_resolve()
5346 cache_fpl_pathlen_add(fpl, adjust); in cache_symlink_resolve()
5348 fpl->nulchar = &cnp->cn_nameptr[ndp->ni_pathlen - 1]; in cache_symlink_resolve()
5349 fpl->tvp = NULL; in cache_symlink_resolve()
5354 cache_fplookup_symlink(struct cache_fpl *fpl) in cache_fplookup_symlink() argument
5363 ndp = fpl->ndp; in cache_fplookup_symlink()
5364 cnp = fpl->cnp; in cache_fplookup_symlink()
5365 dvp = fpl->dvp; in cache_fplookup_symlink()
5366 tvp = fpl->tvp; in cache_fplookup_symlink()
5367 pwd = *(fpl->pwd); in cache_fplookup_symlink()
5371 return (cache_fplookup_final(fpl)); in cache_fplookup_symlink()
5377 return (cache_fpl_aborted(fpl)); in cache_fplookup_symlink()
5385 cache_fpl_smr_exit(fpl); in cache_fplookup_symlink()
5386 return (cache_fpl_handled_error(fpl, EACCES)); in cache_fplookup_symlink()
5389 error = VOP_FPLOOKUP_SYMLINK(tvp, fpl); in cache_fplookup_symlink()
5393 return (cache_fpl_partial(fpl)); in cache_fplookup_symlink()
5397 cache_fpl_smr_exit(fpl); in cache_fplookup_symlink()
5398 return (cache_fpl_handled_error(fpl, error)); in cache_fplookup_symlink()
5400 return (cache_fpl_aborted(fpl)); in cache_fplookup_symlink()
5405 fpl->dvp = cache_fpl_handle_root(fpl); in cache_fplookup_symlink()
5406 fpl->dvp_seqc = vn_seqc_read_any(fpl->dvp); in cache_fplookup_symlink()
5407 if (seqc_in_modify(fpl->dvp_seqc)) { in cache_fplookup_symlink()
5408 return (cache_fpl_aborted(fpl)); in cache_fplookup_symlink()
5415 mp = atomic_load_ptr(&fpl->dvp->v_mount); in cache_fplookup_symlink()
5417 return (cache_fpl_aborted(fpl)); in cache_fplookup_symlink()
5420 cache_fpl_checkpoint(fpl); in cache_fplookup_symlink()
5421 return (cache_fpl_partial(fpl)); in cache_fplookup_symlink()
5424 return (cache_fpl_aborted(fpl)); in cache_fplookup_symlink()
5431 cache_fplookup_next(struct cache_fpl *fpl) in cache_fplookup_next() argument
5440 cnp = fpl->cnp; in cache_fplookup_next()
5441 dvp = fpl->dvp; in cache_fplookup_next()
5442 hash = fpl->hash; in cache_fplookup_next()
5446 return (cache_fplookup_dot(fpl)); in cache_fplookup_next()
5449 return (cache_fplookup_dotdot(fpl)); in cache_fplookup_next()
5462 return (cache_fplookup_noentry(fpl)); in cache_fplookup_next()
5468 return (cache_fplookup_neg(fpl, ncp, hash)); in cache_fplookup_next()
5472 return (cache_fpl_partial(fpl)); in cache_fplookup_next()
5475 fpl->tvp = tvp; in cache_fplookup_next()
5476 fpl->tvp_seqc = vn_seqc_read_any(tvp); in cache_fplookup_next()
5477 if (seqc_in_modify(fpl->tvp_seqc)) { in cache_fplookup_next()
5478 return (cache_fpl_partial(fpl)); in cache_fplookup_next()
5485 if (cache_fplookup_is_mp(fpl)) { in cache_fplookup_next()
5486 error = cache_fplookup_cross_mount(fpl); in cache_fplookup_next()
5520 cache_fplookup_climb_mount(struct cache_fpl *fpl) in cache_fplookup_climb_mount() argument
5527 vp = fpl->tvp; in cache_fplookup_climb_mount()
5528 vp_seqc = fpl->tvp_seqc; in cache_fplookup_climb_mount()
5541 return (cache_fpl_partial(fpl)); in cache_fplookup_climb_mount()
5547 return (cache_fpl_partial(fpl)); in cache_fplookup_climb_mount()
5551 return (cache_fpl_partial(fpl)); in cache_fplookup_climb_mount()
5556 return (cache_fpl_partial(fpl)); in cache_fplookup_climb_mount()
5561 return (cache_fpl_partial(fpl)); in cache_fplookup_climb_mount()
5571 fpl->tvp = vp; in cache_fplookup_climb_mount()
5572 fpl->tvp_seqc = vp_seqc; in cache_fplookup_climb_mount()
5577 cache_fplookup_cross_mount(struct cache_fpl *fpl) in cache_fplookup_cross_mount() argument
5584 vp = fpl->tvp; in cache_fplookup_cross_mount()
5585 vp_seqc = fpl->tvp_seqc; in cache_fplookup_cross_mount()
5594 return (cache_fpl_partial(fpl)); in cache_fplookup_cross_mount()
5598 return (cache_fpl_partial(fpl)); in cache_fplookup_cross_mount()
5602 return (cache_fpl_partial(fpl)); in cache_fplookup_cross_mount()
5607 return (cache_fpl_partial(fpl)); in cache_fplookup_cross_mount()
5612 return (cache_fpl_partial(fpl)); in cache_fplookup_cross_mount()
5621 return (cache_fplookup_climb_mount(fpl)); in cache_fplookup_cross_mount()
5624 fpl->tvp = vp; in cache_fplookup_cross_mount()
5625 fpl->tvp_seqc = vp_seqc; in cache_fplookup_cross_mount()
5633 cache_fplookup_is_mp(struct cache_fpl *fpl) in cache_fplookup_is_mp() argument
5637 vp = fpl->tvp; in cache_fplookup_is_mp()
5655 cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) in cache_fpl_pathlen_add() argument
5658 fpl->debug.ni_pathlen += n; in cache_fpl_pathlen_add()
5659 KASSERT(fpl->debug.ni_pathlen <= PATH_MAX, in cache_fpl_pathlen_add()
5660 ("%s: pathlen overflow to %zd\n", __func__, fpl->debug.ni_pathlen)); in cache_fpl_pathlen_add()
5664 cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) in cache_fpl_pathlen_sub() argument
5667 fpl->debug.ni_pathlen -= n; in cache_fpl_pathlen_sub()
5668 KASSERT(fpl->debug.ni_pathlen <= PATH_MAX, in cache_fpl_pathlen_sub()
5669 ("%s: pathlen underflow to %zd\n", __func__, fpl->debug.ni_pathlen)); in cache_fpl_pathlen_sub()
5673 cache_fpl_pathlen_inc(struct cache_fpl *fpl) in cache_fpl_pathlen_inc() argument
5676 cache_fpl_pathlen_add(fpl, 1); in cache_fpl_pathlen_inc()
5680 cache_fpl_pathlen_dec(struct cache_fpl *fpl) in cache_fpl_pathlen_dec() argument
5683 cache_fpl_pathlen_sub(fpl, 1); in cache_fpl_pathlen_dec()
5687 cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) in cache_fpl_pathlen_add() argument
5692 cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) in cache_fpl_pathlen_sub() argument
5697 cache_fpl_pathlen_inc(struct cache_fpl *fpl) in cache_fpl_pathlen_inc() argument
5702 cache_fpl_pathlen_dec(struct cache_fpl *fpl) in cache_fpl_pathlen_dec() argument
5708 cache_fplookup_parse(struct cache_fpl *fpl) in cache_fplookup_parse() argument
5716 ndp = fpl->ndp; in cache_fplookup_parse()
5717 cnp = fpl->cnp; in cache_fplookup_parse()
5718 dvp = fpl->dvp; in cache_fplookup_parse()
5729 MPASS(&cnp->cn_nameptr[fpl->debug.ni_pathlen - 1] >= cnp->cn_pnbuf); in cache_fplookup_parse()
5730 KASSERT(&cnp->cn_nameptr[fpl->debug.ni_pathlen - 1] == fpl->nulchar, in cache_fplookup_parse()
5732 __func__, fpl->debug.ni_pathlen, &cnp->cn_nameptr[fpl->debug.ni_pathlen - 1], in cache_fplookup_parse()
5733 fpl->nulchar, cnp->cn_pnbuf)); in cache_fplookup_parse()
5734 KASSERT(*fpl->nulchar == '\0', in cache_fplookup_parse()
5735 ("%s: expected nul at %p; string [%s]\n", __func__, fpl->nulchar, in cache_fplookup_parse()
5738 *fpl->nulchar = '/'; in cache_fplookup_parse()
5746 *fpl->nulchar = '\0'; in cache_fplookup_parse()
5747 fpl->hash = cache_get_hash_iter_finish(hash); in cache_fplookup_parse()
5750 cache_fpl_pathlen_sub(fpl, cnp->cn_namelen); in cache_fplookup_parse()
5758 if (fpl->hash != cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp)) { in cache_fplookup_parse()
5775 cache_fplookup_parse_advance(struct cache_fpl *fpl) in cache_fplookup_parse_advance() argument
5780 ndp = fpl->ndp; in cache_fplookup_parse_advance()
5781 cnp = fpl->cnp; in cache_fplookup_parse_advance()
5788 cache_fpl_pathlen_dec(fpl); in cache_fplookup_parse_advance()
5801 cache_fplookup_skip_slashes(struct cache_fpl *fpl) in cache_fplookup_skip_slashes() argument
5806 ndp = fpl->ndp; in cache_fplookup_skip_slashes()
5807 cnp = fpl->cnp; in cache_fplookup_skip_slashes()
5812 cache_fpl_pathlen_dec(fpl); in cache_fplookup_skip_slashes()
5820 cache_fpl_pathlen_inc(fpl); in cache_fplookup_skip_slashes()
5830 fpl->tvp = fpl->dvp; in cache_fplookup_skip_slashes()
5831 fpl->tvp_seqc = fpl->dvp_seqc; in cache_fplookup_skip_slashes()
5854 cache_fplookup_trailingslash(struct cache_fpl *fpl) in cache_fplookup_trailingslash() argument
5867 ndp = fpl->ndp; in cache_fplookup_trailingslash()
5868 cnp = fpl->cnp; in cache_fplookup_trailingslash()
5869 tvp = fpl->tvp; in cache_fplookup_trailingslash()
5870 tvp_seqc = fpl->tvp_seqc; in cache_fplookup_trailingslash()
5872 MPASS(fpl->dvp == fpl->tvp); in cache_fplookup_trailingslash()
5873 KASSERT(cache_fpl_istrailingslash(fpl), in cache_fplookup_trailingslash()
5874 ("%s: expected trailing slash at %p; string [%s]\n", __func__, fpl->nulchar - 1, in cache_fplookup_trailingslash()
5885 return (cache_fpl_aborted(fpl)); in cache_fplookup_trailingslash()
5890 return (cache_fpl_aborted(fpl)); in cache_fplookup_trailingslash()
5892 cache_fpl_smr_exit(fpl); in cache_fplookup_trailingslash()
5893 return (cache_fpl_handled_error(fpl, ENOTDIR)); in cache_fplookup_trailingslash()
5930 cache_fpl_pathlen_add(fpl, cn_nameptr_orig - cnp->cn_nameptr); in cache_fplookup_trailingslash()
5931 cache_fpl_checkpoint(fpl); in cache_fplookup_trailingslash()
5934 ni_pathlen = fpl->nulchar - cnp->cn_nameptr + 1; in cache_fplookup_trailingslash()
5935 if (ni_pathlen != fpl->debug.ni_pathlen) { in cache_fplookup_trailingslash()
5937 __func__, ni_pathlen, fpl->debug.ni_pathlen, fpl->nulchar, in cache_fplookup_trailingslash()
5952 tvp = fpl->tvp; in cache_fplookup_trailingslash()
5955 return (cache_fpl_aborted(fpl)); in cache_fplookup_trailingslash()
5959 return (cache_fpl_aborted(fpl)); in cache_fplookup_trailingslash()
5961 fpl->dvp = ncp->nc_dvp; in cache_fplookup_trailingslash()
5962 fpl->dvp_seqc = vn_seqc_read_any(fpl->dvp); in cache_fplookup_trailingslash()
5963 if (seqc_in_modify(fpl->dvp_seqc)) { in cache_fplookup_trailingslash()
5964 return (cache_fpl_aborted(fpl)); in cache_fplookup_trailingslash()
5973 cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error) in cache_fplookup_failed_vexec() argument
5979 cnp = fpl->cnp; in cache_fplookup_failed_vexec()
5980 dvp = fpl->dvp; in cache_fplookup_failed_vexec()
5981 dvp_seqc = fpl->dvp_seqc; in cache_fplookup_failed_vexec()
5987 return (cache_fplookup_emptypath(fpl)); in cache_fplookup_failed_vexec()
5997 if (cache_fpl_istrailingslash(fpl)) { in cache_fplookup_failed_vexec()
5998 return (cache_fpl_aborted(fpl)); in cache_fplookup_failed_vexec()
6004 if (cnp->cn_nameptr[0] == '\0' && fpl->tvp == NULL) { in cache_fplookup_failed_vexec()
6005 return (cache_fplookup_degenerate(fpl)); in cache_fplookup_failed_vexec()
6012 cache_fpl_smr_exit(fpl); in cache_fplookup_failed_vexec()
6013 return (cache_fpl_handled_error(fpl, ENAMETOOLONG)); in cache_fplookup_failed_vexec()
6049 if (fpl->fsearch) { in cache_fplookup_failed_vexec()
6050 return (cache_fpl_aborted(fpl)); in cache_fplookup_failed_vexec()
6056 error = cache_fpl_aborted(fpl); in cache_fplookup_failed_vexec()
6058 cache_fpl_partial(fpl); in cache_fplookup_failed_vexec()
6063 error = cache_fpl_aborted(fpl); in cache_fplookup_failed_vexec()
6065 cache_fpl_smr_exit(fpl); in cache_fplookup_failed_vexec()
6066 cache_fpl_handled_error(fpl, error); in cache_fplookup_failed_vexec()
6074 cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) in cache_fplookup_impl() argument
6081 ndp = fpl->ndp; in cache_fplookup_impl()
6082 cnp = fpl->cnp; in cache_fplookup_impl()
6084 cache_fpl_checkpoint(fpl); in cache_fplookup_impl()
6091 fpl->dvp = dvp; in cache_fplookup_impl()
6092 fpl->dvp_seqc = vn_seqc_read_notmodify(fpl->dvp); in cache_fplookup_impl()
6096 return (cache_fpl_aborted(fpl)); in cache_fplookup_impl()
6099 MPASS(fpl->tvp == NULL); in cache_fplookup_impl()
6102 cache_fplookup_parse(fpl); in cache_fplookup_impl()
6104 error = VOP_FPLOOKUP_VEXEC(fpl->dvp, cnp->cn_cred); in cache_fplookup_impl()
6106 error = cache_fplookup_failed_vexec(fpl, error); in cache_fplookup_impl()
6110 error = cache_fplookup_next(fpl); in cache_fplookup_impl()
6111 if (__predict_false(cache_fpl_terminated(fpl))) { in cache_fplookup_impl()
6115 VNPASS(!seqc_in_modify(fpl->tvp_seqc), fpl->tvp); in cache_fplookup_impl()
6117 if (fpl->tvp->v_type == VLNK) { in cache_fplookup_impl()
6118 error = cache_fplookup_symlink(fpl); in cache_fplookup_impl()
6119 if (cache_fpl_terminated(fpl)) { in cache_fplookup_impl()
6124 error = cache_fplookup_final(fpl); in cache_fplookup_impl()
6128 if (!vn_seqc_consistent(fpl->dvp, fpl->dvp_seqc)) { in cache_fplookup_impl()
6129 error = cache_fpl_aborted(fpl); in cache_fplookup_impl()
6133 fpl->dvp = fpl->tvp; in cache_fplookup_impl()
6134 fpl->dvp_seqc = fpl->tvp_seqc; in cache_fplookup_impl()
6135 cache_fplookup_parse_advance(fpl); in cache_fplookup_impl()
6138 cache_fpl_checkpoint(fpl); in cache_fplookup_impl()
6224 struct cache_fpl fpl; in cache_fplookup() local
6230 fpl.status = CACHE_FPL_STATUS_UNSET; in cache_fplookup()
6231 fpl.in_smr = false; in cache_fplookup()
6232 fpl.ndp = ndp; in cache_fplookup()
6233 fpl.cnp = cnp = &ndp->ni_cnd; in cache_fplookup()
6241 if (__predict_false(!cache_can_fplookup(&fpl))) { in cache_fplookup()
6242 *status = fpl.status; in cache_fplookup()
6243 SDT_PROBE3(vfs, fplookup, lookup, done, ndp, fpl.line, fpl.status); in cache_fplookup()
6247 cache_fpl_checkpoint_outer(&fpl); in cache_fplookup()
6249 cache_fpl_smr_enter_initial(&fpl); in cache_fplookup()
6251 fpl.debug.ni_pathlen = ndp->ni_pathlen; in cache_fplookup()
6253 fpl.nulchar = &cnp->cn_nameptr[ndp->ni_pathlen - 1]; in cache_fplookup()
6254 fpl.fsearch = false; in cache_fplookup()
6255 fpl.tvp = NULL; /* for degenerate path handling */ in cache_fplookup()
6256 fpl.pwd = pwdp; in cache_fplookup()
6258 *(fpl.pwd) = pwd; in cache_fplookup()
6263 dvp = cache_fpl_handle_root(&fpl); in cache_fplookup()
6269 error = cache_fplookup_dirfd(&fpl, &dvp); in cache_fplookup()
6277 error = cache_fplookup_impl(dvp, &fpl); in cache_fplookup()
6279 cache_fpl_smr_assert_not_entered(&fpl); in cache_fplookup()
6280 cache_fpl_assert_status(&fpl); in cache_fplookup()
6281 *status = fpl.status; in cache_fplookup()
6283 SDT_PROBE3(vfs, fplookup, lookup, done, ndp, fpl.line, fpl.status); in cache_fplookup()
6284 if (fpl.status == CACHE_FPL_STATUS_HANDLED) in cache_fplookup()
6289 if (__predict_true(fpl.status == CACHE_FPL_STATUS_HANDLED)) { in cache_fplookup()
6292 cache_fpl_cleanup_cnp(fpl.cnp); in cache_fplookup()
6293 MPASS(fpl.dvp == NULL); in cache_fplookup()
6294 MPASS(fpl.tvp == NULL); in cache_fplookup()
6296 ndp->ni_dvp = fpl.dvp; in cache_fplookup()
6297 ndp->ni_vp = fpl.tvp; in cache_fplookup()